[SOUP] Add SoupNetworkSession class to wrap a SoupSession
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jan 2014 18:25:43 +0000 (18:25 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jan 2014 18:25:43 +0000 (18:25 +0000)
commita58ae86a3caf0563620a6ce54f5b8620f1dc5c2a
tree88080fdbfd54d3b974a45ea22b07d3930fbb9ca5
parent3db80f828912bdeb0f7d0373def7363efae8a03c
[SOUP] Add SoupNetworkSession class to wrap a SoupSession
https://bugs.webkit.org/show_bug.cgi?id=126813

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Add SoupNetworkSession class that wraps a SoupSession and move all
the code related to the SoupSession from ResourceHandle to
SoupNetworkSession, including the static methods to get the
default session and create testing and private sessions.

* GNUmakefile.list.am: Add new files to compilation.
* PlatformEfl.cmake: Ditto.
* PlatformGTK.cmake: Ditto.
* platform/network/NetworkStorageSession.h: Use SoupNetworkSession
instead of SoupSession.
* platform/network/ResourceHandle.h:
* platform/network/soup/CookieJarSoup.cpp:
(WebCore::cookieJarForSession): Use SoupNetworkSession to get the
SoupSession.
* platform/network/soup/DNSSoup.cpp:
(WebCore::DNSResolveQueue::platformResolve): Ditto.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::NetworkStorageSession): Use
SoupNetworkSession instead of SoupSession.
(WebCore::NetworkStorageSession::~NetworkStorageSession):
(WebCore::NetworkStorageSession::defaultStorageSession): Create a
NetworkStorageSession with a NULL SoupNetworkSession which means
that the default SoupNetworkSession will be used.
(WebCore::NetworkStorageSession::createPrivateBrowsingSession):
Call SoupNetworkSession::createPrivateBrowsingSession() to create
the private session.
(WebCore::NetworkStorageSession::switchToNewTestingSession): Call
SoupNetworkSession::createTestingSession() to create the testing
session.
(WebCore::NetworkStorageSession::soupNetworkSession): Return the
SoupNetworkSession or the default one.
(WebCore::NetworkStorageSession::setSoupNetworkSession): Set a new
SoupNetworkSession.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::sessionFromContext): Use SoupNetworkSession to get the
SoupSession.
(WebCore::ResourceHandleInternal::soupSession): Simply call
sessionFromContext(), since ensureSessionIsInitialized() is no
longer needed, because the SoupSession are now initialized in the
SoupNetworkSession constructor.
(WebCore::ResourceHandle::didStartRequest): Function to notify the
ResourceHandle that current request has just started for web timing.
* platform/network/soup/SoupNetworkSession.cpp: Added.
(WebCore::soupLogPrinter): Logger callback.
(WebCore::SoupNetworkSession::defaultSession): Return a reference
to the default SoupNetworkSession.
(WebCore::SoupNetworkSession::createPrivateBrowsingSession):
Create a new private session.
(WebCore::SoupNetworkSession::createTestingSession): Create a new
testing session.
(WebCore::SoupNetworkSession::createForSoupSession): Create a new
SoupNetworkSession for the given SoupSession.
(WebCore::authenticateCallback): Callback emitted by the
SoupSession when the request needs authentication.
(WebCore::requestStartedCallback): Callback emitted by the
SoupSession when as request has just started.
(WebCore::SoupNetworkSession::SoupNetworkSession):
(WebCore::SoupNetworkSession::~SoupNetworkSession):
(WebCore::SoupNetworkSession::setupLogger): Helper private
function to setup the logger.
(WebCore::SoupNetworkSession::setCookieJar): Set a new CookieJar
in the session replacing the existing one.
(WebCore::SoupNetworkSession::cookieJar): Return the current
CookieJar of the session.
(WebCore::SoupNetworkSession::setCache): Set a disk cache.
(WebCore::SoupNetworkSession::cache): Return the current disk cache.
(WebCore::SoupNetworkSession::setSSLPolicy): Set the SSL policy.
(WebCore::SoupNetworkSession::sslPolicy): Get the current SSL policy.
(WebCore::SoupNetworkSession::setHTTPProxy): Set the HTTP proxy.
(WebCore::SoupNetworkSession::httpProxy): Get the current HTTP proxy.
(WebCore::SoupNetworkSession::setupHTTPProxyFromEnvironment): Set
the HTTP proxy using the environment variables.
(WebCore::buildAcceptLanguages): Helper function build the accept
language string in the format expected by soup (RFC 2616).
(WebCore::SoupNetworkSession::setAcceptLanguages): Set the accept
language for the given list of languages.
* platform/network/soup/SoupNetworkSession.h: Added.
(WebCore::SoupNetworkSession::soupSession): Return the SoupSession.

Source/WebKit/efl:

Use the new SoupNetworkSession API.

* ewk/ewk_cookies.cpp:
(ewk_cookies_file_set):
* ewk/ewk_main.cpp:
(_ewk_init_body):
* ewk/ewk_network.cpp:
(ewk_network_proxy_uri_set):
(ewk_network_proxy_uri_get):
(ewk_network_tls_certificate_check_get):
(ewk_network_tls_certificate_check_set):
(ewk_network_tls_ca_certificates_path_get):
(ewk_network_tls_ca_certificates_path_set):
(ewk_network_default_soup_session_get):
* ewk/ewk_view.cpp:
(ewk_view_soup_session_get):
(ewk_view_soup_session_set):

Source/WebKit/gtk:

* webkit/webkitglobals.cpp:
(webkit_get_default_session): Use the new SoupNetworkSession API
to get the default SoupSession

Source/WebKit2:

Use the new SoupNetworkSession API.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
(WebKit::NetworkProcess::platformSetCacheModel):
(WebKit::NetworkProcess::clearCacheForAllOrigins):
* NetworkProcess/unix/NetworkProcessMainUnix.cpp:
(WebKit::NetworkProcessMain):
* WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
(WebKit::WebCookieManager::setCookiePersistentStorage):
* WebProcess/efl/WebProcessMainEfl.cpp:
(WebKit::WebProcessMainEfl):
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMainGtk):
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformSetCacheModel):
(WebKit::WebProcess::platformClearResourceCaches):
(WebKit::setSoupSessionAcceptLanguage):
(WebKit::WebProcess::platformInitializeWebProcess):
* WebProcess/soup/WebSoupRequestManager.cpp:
(WebKit::WebSoupRequestManager::registerURIScheme):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/soup/CookieJarSoup.cpp
Source/WebCore/platform/network/soup/DNSSoup.cpp
Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp [new file with mode: 0644]
Source/WebCore/platform/network/soup/SoupNetworkSession.h [new file with mode: 0644]
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_cookies.cpp
Source/WebKit/efl/ewk/ewk_main.cpp
Source/WebKit/efl/ewk/ewk_network.cpp
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/webkit/webkitglobals.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp
Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp
Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp
Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp