<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161890] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161890">161890</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-13 10:25:43 -0800 (Mon, 13 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[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):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCorePlatformEflcmake">trunk/Source/WebCore/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkStorageSessionh">trunk/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupCookieJarSoupcpp">trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupDNSSoupcpp">trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupNetworkStorageSessionSoupcpp">trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp</a></li>
<li><a href="#trunkSourceWebKiteflChangeLog">trunk/Source/WebKit/efl/ChangeLog</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_cookiescpp">trunk/Source/WebKit/efl/ewk/ewk_cookies.cpp</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_maincpp">trunk/Source/WebKit/efl/ewk/ewk_main.cpp</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_networkcpp">trunk/Source/WebKit/efl/ewk/ewk_network.cpp</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_viewcpp">trunk/Source/WebKit/efl/ewk/ewk_view.cpp</a></li>
<li><a href="#trunkSourceWebKitgtkChangeLog">trunk/Source/WebKit/gtk/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitgtkwebkitwebkitglobalscpp">trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesssoupNetworkProcessSoupcpp">trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixcpp">trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessCookiessoupWebCookieManagerSoupcpp">trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesseflWebProcessMainEflcpp">trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessgtkWebProcessMainGtkcpp">trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesssoupWebProcessSoupcpp">trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesssoupWebSoupRequestManagercpp">trunk/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformnetworksoupSoupNetworkSessioncpp">trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupSoupNetworkSessionh">trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/ChangeLog        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [SOUP] Add SoupNetworkSession class to wrap a SoupSession
+ https://bugs.webkit.org/show_bug.cgi?id=126813
+
+ Reviewed by Gustavo Noronha Silva.
+
+ 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.
+
</ins><span class="cx"> 2014-01-13 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebGL] Error messages should use source code labels, not internal mangled symbols.
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -5472,7 +5472,6 @@
</span><span class="cx">         Source/WebCore/platform/network/BlobRegistryImpl.h \
</span><span class="cx">         Source/WebCore/platform/network/BlobResourceHandle.cpp \
</span><span class="cx">         Source/WebCore/platform/network/BlobResourceHandle.h \
</span><del>-        Source/WebCore/platform/network/soup/CertificateInfo.h \
</del><span class="cx">         Source/WebCore/platform/network/BlobStorageData.h \
</span><span class="cx">         Source/WebCore/platform/network/FormDataBuilder.cpp \
</span><span class="cx">         Source/WebCore/platform/network/FormDataBuilder.h \
</span><span class="lines">@@ -5494,6 +5493,7 @@
</span><span class="cx">         Source/WebCore/platform/network/SynchronousLoaderClient.h \
</span><span class="cx">         Source/WebCore/platform/network/soup/AuthenticationChallenge.h \
</span><span class="cx">         Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp \
</span><ins>+        Source/WebCore/platform/network/soup/CertificateInfo.h \
</ins><span class="cx">         Source/WebCore/platform/network/soup/CertificateInfo.cpp \
</span><span class="cx">         Source/WebCore/platform/network/soup/CookieJarSoup.cpp \
</span><span class="cx">         Source/WebCore/platform/network/soup/CookieJarSoup.h \
</span><span class="lines">@@ -5506,6 +5506,8 @@
</span><span class="cx">         Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp \
</span><span class="cx">         Source/WebCore/platform/network/soup/ResourceResponse.h \
</span><span class="cx">         Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp \
</span><ins>+        Source/WebCore/platform/network/soup/SoupNetworkSession.h \
+        Source/WebCore/platform/network/soup/SoupNetworkSession.cpp \
</ins><span class="cx">         Source/WebCore/platform/network/soup/SynchronousLoaderClientSoup.cpp \
</span><span class="cx">         Source/WebCore/platform/ScrollableArea.cpp \
</span><span class="cx">         Source/WebCore/platform/ScrollableArea.h \
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformEfl.cmake (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformEfl.cmake        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/PlatformEfl.cmake        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -166,6 +166,7 @@
</span><span class="cx"> platform/network/soup/ResourceRequestSoup.cpp
</span><span class="cx"> platform/network/soup/ResourceResponseSoup.cpp
</span><span class="cx"> platform/network/soup/SocketStreamHandleSoup.cpp
</span><ins>+ platform/network/soup/SoupNetworkSession.cpp
</ins><span class="cx"> platform/network/soup/SoupURIUtils.cpp
</span><span class="cx"> platform/network/soup/SynchronousLoaderClientSoup.cpp
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> platform/network/soup/ResourceRequestSoup.cpp
</span><span class="cx"> platform/network/soup/ResourceResponseSoup.cpp
</span><span class="cx"> platform/network/soup/SocketStreamHandleSoup.cpp
</span><ins>+ platform/network/soup/SoupNetworkSession.cpp
</ins><span class="cx"> platform/network/soup/SoupURIUtils.cpp
</span><span class="cx"> platform/network/soup/SynchronousLoaderClientSoup.cpp
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -32,15 +32,12 @@
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK)
</span><span class="cx"> typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
</span><span class="cx"> typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
</span><del>-#elif USE(SOUP)
-#include <wtf/gobject/GRefPtr.h>
-typedef struct _SoupCookieJar SoupCookieJar;
-typedef struct _SoupSession SoupSession;
</del><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class NetworkingContext;
</span><ins>+class SoupNetworkSession;
</ins><span class="cx">
</span><span class="cx"> class NetworkStorageSession {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -60,9 +57,10 @@
</span><span class="cx"> CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
</span><span class="cx"> RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const;
</span><span class="cx"> #elif USE(SOUP)
</span><del>- NetworkStorageSession(SoupSession*);
- void setSoupSession(SoupSession* session) { m_session = session; }
- SoupSession* soupSession() const { return m_session.get(); }
</del><ins>+ NetworkStorageSession(std::unique_ptr<SoupNetworkSession>);
+ ~NetworkStorageSession();
+ SoupNetworkSession& soupNetworkSession() const;
+ void setSoupNetworkSession(std::unique_ptr<SoupNetworkSession>);
</ins><span class="cx"> #else
</span><span class="cx"> NetworkStorageSession(NetworkingContext*);
</span><span class="cx"> ~NetworkStorageSession();
</span><span class="lines">@@ -74,7 +72,7 @@
</span><span class="cx"> NetworkStorageSession();
</span><span class="cx"> RetainPtr<CFURLStorageSessionRef> m_platformSession;
</span><span class="cx"> #elif USE(SOUP)
</span><del>- GRefPtr<SoupSession> m_session;
</del><ins>+ std::unique_ptr<SoupNetworkSession> m_session;
</ins><span class="cx"> #else
</span><span class="cx"> RefPtr<NetworkingContext> m_context;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.h        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -180,9 +180,7 @@
</span><span class="cx"> bool cancelledOrClientless();
</span><span class="cx"> void ensureReadBuffer();
</span><span class="cx"> size_t currentStreamPosition() const;
</span><del>- static SoupSession* defaultSession();
- static SoupSession* createTestingSession();
- static SoupSession* createPrivateBrowsingSession();
</del><ins>+ void didStartRequest();
</ins><span class="cx"> static uint64_t getSoupRequestInitiatingPageID(SoupRequest*);
</span><span class="cx"> static void setHostAllowsAnyHTTPSCertificate(const String&);
</span><span class="cx"> static void setClientCertificate(const String& host, GTlsCertificate*);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupCookieJarSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include "URL.h"
</span><span class="cx"> #include "NetworkingContext.h"
</span><span class="cx"> #include "PlatformCookieJar.h"
</span><del>-#include "ResourceHandle.h"
</del><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span><span class="lines">@@ -34,8 +34,7 @@
</span><span class="cx">
</span><span class="cx"> static SoupCookieJar* cookieJarForSession(const NetworkStorageSession& session)
</span><span class="cx"> {
</span><del>- ASSERT(session.soupSession());
- return SOUP_COOKIE_JAR(soup_session_get_feature(session.soupSession(), SOUP_TYPE_COOKIE_JAR));
</del><ins>+ return session.soupNetworkSession().cookieJar();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static GRefPtr<SoupCookieJar>& defaultCookieJar()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupDNSSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include "DNSResolveQueue.h"
</span><span class="cx">
</span><span class="cx"> #include "GOwnPtrSoup.h"
</span><del>-#include "ResourceHandle.h"
</del><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include <libsoup/soup.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx">
</span><del>- soup_session_prefetch_dns(ResourceHandle::defaultSession(), hostname.utf8().data(), 0, resolvedCallback, 0);
</del><ins>+ soup_session_prefetch_dns(SoupNetworkSession::defaultSession().soupSession(), hostname.utf8().data(), nullptr, resolvedCallback, nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void prefetchDNS(const String& hostname)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupNetworkStorageSessionSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -28,17 +28,22 @@
</span><span class="cx"> #include "NetworkStorageSession.h"
</span><span class="cx">
</span><span class="cx"> #include "ResourceHandle.h"
</span><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-NetworkStorageSession::NetworkStorageSession(SoupSession* session)
- : m_session(adoptGRef(session))
</del><ins>+NetworkStorageSession::NetworkStorageSession(std::unique_ptr<SoupNetworkSession> session)
+ : m_session(std::move(session))
</ins><span class="cx"> , m_isPrivate(false)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+NetworkStorageSession::~NetworkStorageSession()
+{
+}
+
</ins><span class="cx"> static std::unique_ptr<NetworkStorageSession>& defaultSession()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="lines">@@ -49,20 +54,30 @@
</span><span class="cx"> NetworkStorageSession& NetworkStorageSession::defaultStorageSession()
</span><span class="cx"> {
</span><span class="cx"> if (!defaultSession())
</span><del>- defaultSession() = std::make_unique<NetworkStorageSession>(ResourceHandle::defaultSession());
</del><ins>+ defaultSession() = std::make_unique<NetworkStorageSession>(nullptr);
</ins><span class="cx"> return *defaultSession();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(const String&)
</span><span class="cx"> {
</span><del>- auto session = std::make_unique<NetworkStorageSession>(ResourceHandle::createPrivateBrowsingSession());
</del><ins>+ auto session = std::make_unique<NetworkStorageSession>(SoupNetworkSession::createPrivateBrowsingSession());
</ins><span class="cx"> session->m_isPrivate = true;
</span><span class="cx"> return session;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkStorageSession::switchToNewTestingSession()
</span><span class="cx"> {
</span><del>- defaultSession() = std::make_unique<NetworkStorageSession>(ResourceHandle::createTestingSession());
</del><ins>+ defaultSession() = std::make_unique<NetworkStorageSession>(SoupNetworkSession::createTestingSession());
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+SoupNetworkSession& NetworkStorageSession::soupNetworkSession() const
+{
+ return m_session ? *m_session : SoupNetworkSession::defaultSession();
</ins><span class="cx"> }
</span><ins>+
+void NetworkStorageSession::setSoupNetworkSession(std::unique_ptr<SoupNetworkSession> session)
+{
+ m_session = std::move(session);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #include "GOwnPtrSoup.h"
</span><span class="cx"> #include "HTTPParsers.h"
</span><span class="cx"> #include "LocalizedStrings.h"
</span><del>-#include "Logging.h"
</del><span class="cx"> #include "MIMETypeRegistry.h"
</span><span class="cx"> #include "NetworkingContext.h"
</span><span class="cx"> #include "NotImplemented.h"
</span><span class="lines">@@ -44,6 +43,7 @@
</span><span class="cx"> #include "ResourceHandleInternal.h"
</span><span class="cx"> #include "ResourceResponse.h"
</span><span class="cx"> #include "SharedBuffer.h"
</span><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include "SoupURIUtils.h"
</span><span class="cx"> #include "TextEncoding.h"
</span><span class="cx"> #include <errno.h>
</span><span class="lines">@@ -72,15 +72,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-inline static void soupLogPrinter(SoupLogger*, SoupLoggerLogLevel, char direction, const char* data, gpointer)
-{
-#if LOG_DISABLED
- UNUSED_PARAM(direction);
- UNUSED_PARAM(data);
-#endif
- LOG(Network, "%c %s", direction, data);
-}
-
</del><span class="cx"> static bool loadingSynchronousRequest = false;
</span><span class="cx"> static const size_t gDefaultReadBufferSize = 8192;
</span><span class="cx">
</span><span class="lines">@@ -260,8 +251,8 @@
</span><span class="cx"> static SoupSession* sessionFromContext(NetworkingContext* context)
</span><span class="cx"> {
</span><span class="cx"> if (!context || !context->isValid())
</span><del>- return ResourceHandle::defaultSession();
- return context->storageSession().soupSession();
</del><ins>+ return SoupNetworkSession::defaultSession().soupSession();
+ return context->storageSession().soupNetworkSession().soupSession();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ResourceHandle::~ResourceHandle()
</span><span class="lines">@@ -269,36 +260,9 @@
</span><span class="cx"> cleanupSoupRequestOperation(this, true);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void ensureSessionIsInitialized(SoupSession* session)
-{
- if (g_object_get_data(G_OBJECT(session), "webkit-init"))
- return;
-
- if (session == ResourceHandle::defaultSession()) {
- SoupCookieJar* jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
- if (!jar)
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCookieJar()));
- else
- setSoupCookieJar(jar);
- }
-
-#if !LOG_DISABLED
- if (!soup_session_get_feature(session, SOUP_TYPE_LOGGER) && LogNetwork.state == WTFLogChannelOn) {
- SoupLogger* logger = soup_logger_new(static_cast<SoupLoggerLogLevel>(SOUP_LOGGER_LOG_BODY), -1);
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(logger));
- soup_logger_set_printer(logger, soupLogPrinter, 0, 0);
- g_object_unref(logger);
- }
-#endif // !LOG_DISABLED
-
- g_object_set_data(G_OBJECT(session), "webkit-init", reinterpret_cast<void*>(0xdeadbeef));
-}
-
</del><span class="cx"> SoupSession* ResourceHandleInternal::soupSession()
</span><span class="cx"> {
</span><del>- SoupSession* session = sessionFromContext(m_context.get());
- ensureSessionIsInitialized(session);
- return session;
</del><ins>+ return sessionFromContext(m_context.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ResourceHandle::cancelledOrClientless()
</span><span class="lines">@@ -879,13 +843,9 @@
</span><span class="cx"> d->m_response.resourceLoadTiming()->sendEnd = milisecondsSinceRequest(d->m_response.resourceLoadTiming()->requestTime);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void requestStartedCallback(SoupSession*, SoupMessage* soupMessage, SoupSocket*, gpointer)
</del><ins>+void ResourceHandle::didStartRequest()
</ins><span class="cx"> {
</span><del>- RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
- if (!handle)
- return;
-
- ResourceHandleInternal* d = handle->getInternal();
</del><ins>+ ResourceHandleInternal* d = getInternal();
</ins><span class="cx"> if (!d->m_response.resourceLoadTiming())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -1431,62 +1391,6 @@
</span><span class="cx"> return FALSE;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void authenticateCallback(SoupSession* session, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)
-{
- RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
- if (!handle)
- return;
- handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(session, soupMessage, soupAuth, retrying, handle.get()));
-}
-
-static SoupSession* createSoupSession()
-{
- // Values taken from http://www.browserscope.org/ following
- // the rule "Do What Every Other Modern Browser Is Doing". They seem
- // to significantly improve page loading time compared to soup's
- // default values.
- static const int maxConnections = 35;
- static const int maxConnectionsPerHost = 6;
-
- SoupSession* session = soup_session_async_new();
- g_object_set(session,
- SOUP_SESSION_MAX_CONNS, maxConnections,
- SOUP_SESSION_MAX_CONNS_PER_HOST, maxConnectionsPerHost,
- SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
- SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,
- SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
- SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
- NULL);
- g_signal_connect(session, "authenticate", G_CALLBACK(authenticateCallback), 0);
-
-#if ENABLE(WEB_TIMING)
- g_signal_connect(session, "request-started", G_CALLBACK(requestStartedCallback), 0);
-#endif
-
- return session;
-}
-
-SoupSession* ResourceHandle::defaultSession()
-{
- static SoupSession* session = createSoupSession();
- return session;
-}
-
-SoupSession* ResourceHandle::createTestingSession()
-{
- SoupSession* session = createSoupSession();
- // The testing session operates with the default cookie jar.
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCookieJar()));
- return session;
-}
-
-SoupSession* ResourceHandle::createPrivateBrowsingSession()
-{
- SoupSession* session = createSoupSession();
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(createPrivateBrowsingCookieJar()));
- return session;
-}
-
</del><span class="cx"> uint64_t ResourceHandle::getSoupRequestInitiatingPageID(SoupRequest* request)
</span><span class="cx"> {
</span><span class="cx"> uint64_t* initiatingPageIDPtr = static_cast<uint64_t*>(g_object_get_data(G_OBJECT(request), gSoupRequestInitiatingPageIDKey));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupSoupNetworkSessioncpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp (0 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -0,0 +1,276 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SoupNetworkSession.h"
+
+#include "AuthenticationChallenge.h"
+#include "CookieJarSoup.h"
+#include "GOwnPtrSoup.h"
+#include "Logging.h"
+#include "ResourceHandle.h"
+#include <libsoup/soup.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+
+#if PLATFORM(EFL)
+#include "ProxyResolverSoup.h"
+#endif
+
+namespace WebCore {
+
+#if !LOG_DISABLED
+inline static void soupLogPrinter(SoupLogger*, SoupLoggerLogLevel, char direction, const char* data, gpointer)
+{
+ LOG(Network, "%c %s", direction, data);
+}
+#endif
+
+SoupNetworkSession& SoupNetworkSession::defaultSession()
+{
+ static NeverDestroyed<SoupNetworkSession> networkSession(soupCookieJar());
+ return networkSession;
+}
+
+std::unique_ptr<SoupNetworkSession> SoupNetworkSession::createPrivateBrowsingSession()
+{
+ return std::unique_ptr<SoupNetworkSession>(new SoupNetworkSession(soupCookieJar()));
+}
+
+std::unique_ptr<SoupNetworkSession> SoupNetworkSession::createTestingSession()
+{
+ GRefPtr<SoupCookieJar> cookieJar = adoptGRef(createPrivateBrowsingCookieJar());
+ return std::unique_ptr<SoupNetworkSession>(new SoupNetworkSession(cookieJar.get()));
+}
+
+std::unique_ptr<SoupNetworkSession> SoupNetworkSession::createForSoupSession(SoupSession* soupSession)
+{
+ return std::unique_ptr<SoupNetworkSession>(new SoupNetworkSession(soupSession));
+}
+
+static void authenticateCallback(SoupSession* session, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)
+{
+ RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
+ if (!handle)
+ return;
+ handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(session, soupMessage, soupAuth, retrying, handle.get()));
+}
+
+static void requestStartedCallback(SoupSession*, SoupMessage* soupMessage, SoupSocket*, gpointer)
+{
+ RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
+ if (!handle)
+ return;
+ handle->didStartRequest();
+}
+
+SoupNetworkSession::SoupNetworkSession(SoupCookieJar* cookieJar)
+ : m_soupSession(adoptGRef(soup_session_async_new()))
+{
+ // Values taken from http://www.browserscope.org/ following
+ // the rule "Do What Every Other Modern Browser Is Doing". They seem
+ // to significantly improve page loading time compared to soup's
+ // default values.
+ static const int maxConnections = 35;
+ static const int maxConnectionsPerHost = 6;
+
+ g_object_set(m_soupSession.get(),
+ SOUP_SESSION_MAX_CONNS, maxConnections,
+ SOUP_SESSION_MAX_CONNS_PER_HOST, maxConnectionsPerHost,
+ SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
+ SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,
+ SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
+ SOUP_SESSION_ADD_FEATURE, cookieJar,
+ SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
+ nullptr);
+
+ setupLogger();
+
+ g_signal_connect(m_soupSession.get(), "authenticate", G_CALLBACK(authenticateCallback), nullptr);
+#if ENABLE(WEB_TIMING)
+ g_signal_connect(m_soupSession.get(), "request-started", G_CALLBACK(requestStartedCallback), nullptr);
+#endif
+}
+
+SoupNetworkSession::SoupNetworkSession(SoupSession* soupSession)
+ : m_soupSession(soupSession)
+{
+ setupLogger();
+}
+
+SoupNetworkSession::~SoupNetworkSession()
+{
+}
+
+void SoupNetworkSession::setupLogger()
+{
+#if !LOG_DISABLED
+ if (LogNetwork.state != WTFLogChannelOn || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER))
+ return;
+
+ GRefPtr<SoupLogger> logger = adoptGRef(soup_logger_new(SOUP_LOGGER_LOG_BODY, -1));
+ soup_session_add_feature(m_soupSession.get(), SOUP_SESSION_FEATURE(logger.get()));
+ soup_logger_set_printer(logger.get(), soupLogPrinter, nullptr, nullptr);
+#endif
+}
+
+void SoupNetworkSession::setCookieJar(SoupCookieJar* jar)
+{
+ if (SoupCookieJar* currentJar = cookieJar())
+ soup_session_remove_feature(m_soupSession.get(), SOUP_SESSION_FEATURE(currentJar));
+ soup_session_add_feature(m_soupSession.get(), SOUP_SESSION_FEATURE(jar));
+}
+
+SoupCookieJar* SoupNetworkSession::cookieJar() const
+{
+ return SOUP_COOKIE_JAR(soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_COOKIE_JAR));
+}
+
+void SoupNetworkSession::setCache(SoupCache* cache)
+{
+ ASSERT(!soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_CACHE));
+ soup_session_add_feature(m_soupSession.get(), SOUP_SESSION_FEATURE(cache));
+}
+
+SoupCache* SoupNetworkSession::cache() const
+{
+ SoupSessionFeature* soupCache = soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_CACHE);
+ return soupCache ? SOUP_CACHE(soupCache) : nullptr;
+}
+
+void SoupNetworkSession::setSSLPolicy(SSLPolicy flags)
+{
+ g_object_set(m_soupSession.get(),
+ SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, flags & SSLUseSystemCAFile ? TRUE : FALSE,
+ SOUP_SESSION_SSL_STRICT, flags & SSLStrict ? TRUE : FALSE,
+ nullptr);
+}
+
+SoupNetworkSession::SSLPolicy SoupNetworkSession::sslPolicy() const
+{
+ gboolean useSystemCAFile, strict;
+ g_object_get(m_soupSession.get(),
+ SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, &useSystemCAFile,
+ SOUP_SESSION_SSL_STRICT, &strict,
+ nullptr);
+
+ SSLPolicy flags = 0;
+ if (useSystemCAFile)
+ flags |= SSLUseSystemCAFile;
+ if (strict)
+ flags |= SSLStrict;
+ return flags;
+}
+
+void SoupNetworkSession::setHTTPProxy(const char* httpProxy, const char* httpProxyExceptions)
+{
+#if PLATFORM(EFL)
+ // Only for EFL because GTK port uses the default resolver, which uses GIO's proxy resolver.
+ if (!httpProxy) {
+ soup_session_remove_feature_by_type(m_soupSession.get(), SOUP_TYPE_PROXY_URI_RESOLVER);
+ return;
+ }
+
+ GRefPtr<SoupProxyURIResolver> resolver = adoptGRef(soupProxyResolverWkNew(httpProxy, httpProxyExceptions));
+ soup_session_add_feature(m_soupSession.get(), SOUP_SESSION_FEATURE(resolver.get()));
+#else
+ UNUSED_PARAM(httpProxy);
+ UNUSED_PARAM(httpProxyExceptions);
+#endif
+}
+
+char* SoupNetworkSession::httpProxy() const
+{
+#if PLATFORM(EFL)
+ SoupSessionFeature* soupResolver = soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_PROXY_URI_RESOLVER);
+ if (!soupResolver)
+ return nullptr;
+
+ GOwnPtr<SoupURI> uri;
+ g_object_get(soupResolver, SOUP_PROXY_RESOLVER_WK_PROXY_URI, &uri.outPtr(), nullptr);
+
+ return uri ? soup_uri_to_string(uri.get(), FALSE) : nullptr;
+#else
+ return nullptr;
+#endif
+}
+
+void SoupNetworkSession::setupHTTPProxyFromEnvironment()
+{
+#if PLATFORM(EFL)
+ const char* httpProxy = getenv("http_proxy");
+ if (!httpProxy)
+ return;
+
+ setHTTPProxy(httpProxy, getenv("no_proxy"));
+#endif
+}
+
+static CString buildAcceptLanguages(Vector<String> languages)
+{
+ // Ignore "C" locale.
+ size_t position = languages.find("c");
+ if (position != notFound)
+ languages.remove(position);
+
+ // Fallback to "en" if the list is empty.
+ if (languages.isEmpty())
+ return "en";
+
+ // Calculate deltas for the quality values.
+ int delta;
+ if (languages.size() < 10)
+ delta = 10;
+ else if (languages.size() < 20)
+ delta = 5;
+ else
+ delta = 1;
+
+ // Set quality values for each language.
+ StringBuilder builder;
+ for (size_t i = 0; i < languages.size(); ++i) {
+ if (i)
+ builder.append(", ");
+
+ builder.append(languages[i]);
+
+ int quality = 100 - i * delta;
+ if (quality > 0 && quality < 100) {
+ char buffer[8];
+ g_ascii_formatd(buffer, 8, "%.2f", quality / 100.0);
+ builder.append(String::format(";q=%s", buffer));
+ }
+ }
+
+ return builder.toString().utf8();
+}
+
+void SoupNetworkSession::setAcceptLanguages(Vector<String> languages)
+{
+ g_object_set(m_soupSession.get(), "accept-language", buildAcceptLanguages(languages).data(), nullptr);
+}
+
+} // namespace WebCore
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupSoupNetworkSessionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h (0 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h         (rev 0)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SoupNetworkSession_h
+#define SoupNetworkSession_h
+
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/WTFString.h>
+
+typedef struct _SoupCache SoupCache;
+typedef struct _SoupCookieJar SoupCookieJar;
+typedef struct _SoupSession SoupSession;
+
+namespace WebCore {
+
+class SoupNetworkSession {
+ WTF_MAKE_NONCOPYABLE(SoupNetworkSession); WTF_MAKE_FAST_ALLOCATED;
+ friend class NeverDestroyed<SoupNetworkSession>;
+public:
+ ~SoupNetworkSession();
+
+ static SoupNetworkSession& defaultSession();
+ static std::unique_ptr<SoupNetworkSession> createPrivateBrowsingSession();
+ static std::unique_ptr<SoupNetworkSession> createTestingSession();
+ static std::unique_ptr<SoupNetworkSession> createForSoupSession(SoupSession*);
+
+ enum SSLPolicyFlags {
+ SSLStrict = 1 << 0,
+ SSLUseSystemCAFile = 1 << 1
+ };
+ typedef unsigned SSLPolicy;
+
+ SoupSession* soupSession() const { return m_soupSession.get(); }
+
+ void setCookieJar(SoupCookieJar*);
+ SoupCookieJar* cookieJar() const;
+
+ void setCache(SoupCache*);
+ SoupCache* cache() const;
+
+ void setSSLPolicy(SSLPolicy);
+ SSLPolicy sslPolicy() const;
+
+ void setHTTPProxy(const char* httpProxy, const char* httpProxyExceptions);
+ char* httpProxy() const;
+ void setupHTTPProxyFromEnvironment();
+
+ void setAcceptLanguages(Vector<String>);
+
+private:
+ SoupNetworkSession(SoupCookieJar*);
+ SoupNetworkSession(SoupSession*);
+
+ void setupLogger();
+
+ GRefPtr<SoupSession> m_soupSession;
+};
+
+} // namespace WebCore
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKiteflChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ChangeLog (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ChangeLog        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/efl/ChangeLog        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [SOUP] Add SoupNetworkSession class to wrap a SoupSession
+ https://bugs.webkit.org/show_bug.cgi?id=126813
+
+ Reviewed by Gustavo Noronha Silva.
+
+ 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):
+
</ins><span class="cx"> 2014-01-12 Jinwoo Song <jinwoo7.song@samsung.com>
</span><span class="cx">
</span><span class="cx"> Fix build warnings by unused parameter
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_cookiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_cookies.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_cookies.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/efl/ewk/ewk_cookies.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> #include "ewk_cookies.h"
</span><span class="cx">
</span><span class="cx"> #include "CookieJarSoup.h"
</span><del>-#include "ResourceHandle.h"
</del><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include <Eina.h>
</span><span class="cx"> #include <eina_safety_checks.h>
</span><span class="cx"> #include <glib.h>
</span><span class="lines">@@ -42,13 +42,9 @@
</span><span class="cx">
</span><span class="cx"> soup_cookie_jar_set_accept_policy(cookieJar, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY);
</span><span class="cx">
</span><del>- SoupSession* session = WebCore::ResourceHandle::defaultSession();
- SoupSessionFeature* oldjar = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR);
- if (oldjar)
- soup_session_remove_feature(session, oldjar);
-
</del><ins>+ WebCore::SoupNetworkSession::defaultSession().setCookieJar(cookieJar);
</ins><span class="cx"> WebCore::setSoupCookieJar(cookieJar);
</span><del>- soup_session_add_feature(session, SOUP_SESSION_FEATURE(cookieJar));
</del><ins>+ g_object_unref(cookieJar);
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_maincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_main.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_main.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/efl/ewk/ewk_main.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "ResourceHandle.h"
</span><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "Settings.h"
</span><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include "StorageTracker.h"
</span><span class="cx"> #include "StorageTrackerClientEfl.h"
</span><span class="cx"> #include "ewk_auth_soup_private.h"
</span><span class="lines">@@ -204,9 +205,8 @@
</span><span class="cx">
</span><span class="cx"> WebCore::StorageTracker::initializeTracker(localStorageDirectory.utf8().data(), trackerClient());
</span><span class="cx">
</span><del>- SoupSession* session = WebCore::ResourceHandle::defaultSession();
</del><span class="cx"> SoupSessionFeature* auth_dialog = static_cast<SoupSessionFeature*>(g_object_new(EWK_TYPE_SOUP_AUTH_DIALOG, 0));
</span><del>- soup_session_add_feature(session, auth_dialog);
</del><ins>+ soup_session_add_feature(WebCore::SoupNetworkSession::defaultSession().soupSession(), auth_dialog);
</ins><span class="cx">
</span><span class="cx"> WebCore::ResourceHandle::setIgnoreSSLErrors(true);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_networkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_network.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_network.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/efl/ewk/ewk_network.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> #include "NetworkStateNotifier.h"
</span><span class="cx"> #include "ProxyResolverSoup.h"
</span><span class="cx"> #include "ResourceHandle.h"
</span><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include "ewk_private.h"
</span><span class="cx"> #include <Eina.h>
</span><span class="cx"> #include <libsoup/soup.h>
</span><span class="lines">@@ -30,59 +31,39 @@
</span><span class="cx">
</span><span class="cx"> void ewk_network_proxy_uri_set(const char* proxy)
</span><span class="cx"> {
</span><del>- SoupSession* session = WebCore::ResourceHandle::defaultSession();
-
- if (!proxy) {
</del><ins>+ if (!proxy)
</ins><span class="cx"> ERR("no proxy uri. remove proxy feature in soup.");
</span><del>- soup_session_remove_feature_by_type(session, SOUP_TYPE_PROXY_URI_RESOLVER);
- return;
- }
-
- SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(proxy, 0);
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl));
- g_object_unref(resolverEfl);
</del><ins>+ WebCore::SoupNetworkSession::defaultSession().setHTTPProxy(proxy, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const char* ewk_network_proxy_uri_get(void)
</span><span class="cx"> {
</span><del>- SoupURI* uri;
- SoupSession* session = WebCore::ResourceHandle::defaultSession();
- SoupProxyURIResolver* resolver = SOUP_PROXY_URI_RESOLVER(soup_session_get_feature(session, SOUP_TYPE_PROXY_URI_RESOLVER));
- if (!resolver)
- return 0;
-
- g_object_get(resolver, SOUP_PROXY_RESOLVER_WK_PROXY_URI, &uri, NULL);
-
</del><ins>+ char* uri = WebCore::SoupNetworkSession::defaultSession().httpProxy();
</ins><span class="cx"> if (!uri) {
</span><span class="cx"> ERR("no proxy uri");
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- WTF::String proxy = soup_uri_to_string(uri, false);
- return eina_stringshare_add(proxy.utf8().data());
</del><ins>+ return eina_stringshare_add(uri);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Eina_Bool ewk_network_tls_certificate_check_get()
</span><span class="cx"> {
</span><del>- bool checkCertificates = false;
-
- SoupSession* defaultSession = WebCore::ResourceHandle::defaultSession();
- g_object_get(defaultSession, "ssl-strict", &checkCertificates, NULL);
-
- return checkCertificates;
</del><ins>+ unsigned policy = WebCore::SoupNetworkSession::defaultSession().sslPolicy();
+ return policy & WebCore::SoupNetworkSession::SSLStrict;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ewk_network_tls_certificate_check_set(Eina_Bool checkCertificates)
</span><span class="cx"> {
</span><del>- SoupSession* defaultSession = WebCore::ResourceHandle::defaultSession();
- g_object_set(defaultSession, "ssl-strict", checkCertificates, NULL);
</del><ins>+ unsigned policy = WebCore::SoupNetworkSession::defaultSession().sslPolicy();
+ WebCore::SoupNetworkSession::defaultSession().setSSLPolicy(policy | WebCore::SoupNetworkSession::SSLStrict);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const char* ewk_network_tls_ca_certificates_path_get()
</span><span class="cx"> {
</span><span class="cx"> const char* bundlePath = 0;
</span><span class="cx">
</span><del>- SoupSession* defaultSession = WebCore::ResourceHandle::defaultSession();
</del><ins>+ SoupSession* defaultSession = WebCore::SoupNetworkSession::defaultSession().soupSession();
</ins><span class="cx"> g_object_get(defaultSession, "ssl-ca-file", &bundlePath, NULL);
</span><span class="cx">
</span><span class="cx"> return bundlePath;
</span><span class="lines">@@ -90,11 +71,11 @@
</span><span class="cx">
</span><span class="cx"> void ewk_network_tls_ca_certificates_path_set(const char* bundlePath)
</span><span class="cx"> {
</span><del>- SoupSession* defaultSession = WebCore::ResourceHandle::defaultSession();
</del><ins>+ SoupSession* defaultSession = WebCore::SoupNetworkSession::defaultSession().soupSession();
</ins><span class="cx"> g_object_set(defaultSession, "ssl-ca-file", bundlePath, NULL);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> SoupSession* ewk_network_default_soup_session_get()
</span><span class="cx"> {
</span><del>- return WebCore::ResourceHandle::defaultSession();
</del><ins>+ return WebCore::SoupNetworkSession::defaultSession().soupSession();
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_viewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "Settings.h"
</span><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include "TiledBackingStore.h"
</span><span class="cx"> #include "c_instance.h"
</span><span class="cx"> #include "ewk_contextmenu_private.h"
</span><span class="lines">@@ -4546,7 +4547,7 @@
</span><span class="cx"> {
</span><span class="cx"> EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
</span><span class="cx"> EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
</span><del>- return priv->storageSession->soupSession();
</del><ins>+ return priv->storageSession->soupNetworkSession().soupSession();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ewk_view_soup_session_set(Evas_Object* ewkView, SoupSession* session)
</span><span class="lines">@@ -4558,7 +4559,7 @@
</span><span class="cx"> "a SoupSessionSync was provided.");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- priv->storageSession->setSoupSession(session);
</del><ins>+ priv->storageSession->setSoupNetworkSession(WebCore::SoupNetworkSession::createForSoupSession(session));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Eina_Bool ewk_view_setting_enable_xss_auditor_get(const Evas_Object* ewkView)
</span></span></pre></div>
<a id="trunkSourceWebKitgtkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/gtk/ChangeLog (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/gtk/ChangeLog        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/gtk/ChangeLog        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [SOUP] Add SoupNetworkSession class to wrap a SoupSession
+ https://bugs.webkit.org/show_bug.cgi?id=126813
+
+ Reviewed by Gustavo Noronha Silva.
+
+ * webkit/webkitglobals.cpp:
+ (webkit_get_default_session): Use the new SoupNetworkSession API
+ to get the default SoupSession
+
+2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> Unreviewed. Update NEWS and Versions.m4 for 2.3.4 release.
</span><span class="cx">
</span><span class="cx"> * NEWS: Added release notes for 2.3.4.
</span></span></pre></div>
<a id="trunkSourceWebKitgtkwebkitwebkitglobalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "ResourceHandleInternal.h"
</span><span class="cx"> #include "ResourceResponse.h"
</span><span class="cx"> #include "SchemeRegistry.h"
</span><ins>+#include "SoupNetworkSession.h"
</ins><span class="cx"> #include "TextEncodingRegistry.h"
</span><span class="cx"> #include "webkitapplicationcache.h"
</span><span class="cx"> #include "webkitfavicondatabase.h"
</span><span class="lines">@@ -83,7 +84,7 @@
</span><span class="cx"> SoupSession* webkit_get_default_session ()
</span><span class="cx"> {
</span><span class="cx"> webkitInit();
</span><del>- return ResourceHandle::defaultSession();
</del><ins>+ return SoupNetworkSession::defaultSession().soupSession();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [SOUP] Add SoupNetworkSession class to wrap a SoupSession
+ https://bugs.webkit.org/show_bug.cgi?id=126813
+
+ Reviewed by Gustavo Noronha Silva.
+
+ 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):
+
</ins><span class="cx"> 2014-01-13 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Enable SUBPIXEL_LAYOUT on Mac
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesssoupNetworkProcessSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include <WebCore/FileSystem.h>
</span><span class="cx"> #include <WebCore/NotImplemented.h>
</span><span class="cx"> #include <WebCore/ResourceHandle.h>
</span><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <libsoup/soup.h>
</span><span class="cx"> #include <wtf/gobject/GOwnPtr.h>
</span><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="lines">@@ -78,7 +79,7 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!parameters.diskCacheDirectory.isEmpty());
</span><span class="cx"> GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER));
</span><del>- soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get()));
</del><ins>+ SoupNetworkSession::defaultSession().setCache(soupCache.get());
</ins><span class="cx"> soup_cache_load(soupCache.get());
</span><span class="cx">
</span><span class="cx"> if (!parameters.cookiePersistentStoragePath.isEmpty()) {
</span><span class="lines">@@ -101,8 +102,7 @@
</span><span class="cx"> unsigned long urlCacheMemoryCapacity = 0;
</span><span class="cx"> unsigned long urlCacheDiskCapacity = 0;
</span><span class="cx">
</span><del>- SoupSession* session = ResourceHandle::defaultSession();
- SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE));
</del><ins>+ SoupCache* cache = SoupNetworkSession::defaultSession().cache();
</ins><span class="cx"> uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024;
</span><span class="cx">
</span><span class="cx"> uint64_t memSize = getMemorySize();
</span><span class="lines">@@ -129,8 +129,7 @@
</span><span class="cx"> if (cachesToClear == InMemoryResourceCachesOnly)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- SoupSession* session = ResourceHandle::defaultSession();
- soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)));
</del><ins>+ soup_cache_clear(SoupNetworkSession::defaultSession().cache());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkProcess::platformTerminate()
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> #include "WKBase.h"
</span><span class="cx"> #include "WebKit2Initialize.h"
</span><del>-#include <WebCore/ResourceHandle.h>
</del><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <WebKit2/NetworkProcess.h>
</span><span class="cx"> #include <error.h>
</span><span class="cx"> #include <runtime/InitializeThreading.h>
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(EFL)
</span><del>-#include "ProxyResolverSoup.h"
</del><span class="cx"> #include <Ecore.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -68,18 +67,7 @@
</span><span class="cx">
</span><span class="cx"> InitializeWebKit2();
</span><span class="cx">
</span><del>-#if USE(SOUP)
- SoupSession* session = ResourceHandle::defaultSession();
-#if PLATFORM(EFL)
- // Only for EFL because GTK port uses the default resolver, which uses GIO's proxy resolver.
- const char* httpProxy = getenv("http_proxy");
- if (httpProxy) {
- const char* noProxy = getenv("no_proxy");
- GRefPtr<SoupProxyURIResolver> resolver = adoptGRef(soupProxyResolverWkNew(httpProxy, noProxy));
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolver.get()));
- }
-#endif
-#endif
</del><ins>+ SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
</ins><span class="cx">
</span><span class="cx"> int socket = atoi(argv[1]);
</span><span class="cx">
</span><span class="lines">@@ -92,16 +80,15 @@
</span><span class="cx"> // Despite using system CAs to validate certificates we're
</span><span class="cx"> // accepting invalid certificates by default. New API will be
</span><span class="cx"> // added later to let client accept/discard invalid certificates.
</span><del>- g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
- SOUP_SESSION_SSL_STRICT, FALSE, NULL);
</del><ins>+ SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> RunLoop::run();
</span><span class="cx">
</span><span class="cx"> #if USE(SOUP)
</span><del>- if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
- soup_cache_flush(SOUP_CACHE(soupCache));
- soup_cache_dump(SOUP_CACHE(soupCache));
</del><ins>+ if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+ soup_cache_flush(soupCache);
+ soup_cache_dump(soupCache);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessCookiessoupWebCookieManagerSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include "ChildProcess.h"
</span><span class="cx"> #include "WebKitSoupCookieJarSqlite.h"
</span><span class="cx"> #include <WebCore/CookieJarSoup.h>
</span><del>-#include <WebCore/ResourceHandle.h>
</del><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <libsoup/soup.h>
</span><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="lines">@@ -96,12 +96,8 @@
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- SoupCookieJar* currentJar = WebCore::soupCookieJar();
- soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(currentJar));
- SoupSession* session = ResourceHandle::defaultSession();
- soup_session_remove_feature(session, SOUP_SESSION_FEATURE(currentJar));
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(jar.get()));
-
</del><ins>+ soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(WebCore::soupCookieJar()));
+ SoupNetworkSession::defaultSession().setCookieJar(jar.get());
</ins><span class="cx"> WebCore::setSoupCookieJar(jar.get());
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesseflWebProcessMainEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #include <Efreet.h>
</span><span class="cx"> #include <WebCore/AuthenticationChallenge.h>
</span><span class="cx"> #include <WebCore/NetworkingContext.h>
</span><del>-#include <WebCore/ResourceHandle.h>
</del><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <WebKit2/WebProcess.h>
</span><span class="cx"> #include <libsoup/soup.h>
</span><span class="cx"> #include <runtime/Operations.h>
</span><span class="lines">@@ -114,14 +114,7 @@
</span><span class="cx">
</span><span class="cx"> InitializeWebKit2();
</span><span class="cx">
</span><del>- SoupSession* session = WebCore::ResourceHandle::defaultSession();
- const char* httpProxy = getenv("http_proxy");
- if (httpProxy) {
- const char* noProxy = getenv("no_proxy");
- SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy);
- soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl));
- g_object_unref(resolverEfl);
- }
</del><ins>+ SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
</ins><span class="cx">
</span><span class="cx"> int socket = atoi(argv[1]);
</span><span class="cx">
</span><span class="lines">@@ -132,9 +125,9 @@
</span><span class="cx">
</span><span class="cx"> RunLoop::run();
</span><span class="cx">
</span><del>- if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
- soup_cache_flush(SOUP_CACHE(soupCache));
- soup_cache_dump(SOUP_CACHE(soupCache));
</del><ins>+ if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+ soup_cache_flush(soupCache);
+ soup_cache_dump(soupCache);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> edje_shutdown();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessgtkWebProcessMainGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #include "WebKit2Initialize.h"
</span><span class="cx"> #include <WebCore/AuthenticationChallenge.h>
</span><span class="cx"> #include <WebCore/NetworkingContext.h>
</span><del>-#include <WebCore/ResourceHandle.h>
</del><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <WebKit2/WebProcess.h>
</span><span class="cx"> #include <gtk/gtk.h>
</span><span class="cx"> #include <libintl.h>
</span><span class="lines">@@ -71,15 +71,13 @@
</span><span class="cx"> // Despite using system CAs to validate certificates we're
</span><span class="cx"> // accepting invalid certificates by default. New API will be
</span><span class="cx"> // added later to let client accept/discard invalid certificates.
</span><del>- SoupSession* session = WebCore::ResourceHandle::defaultSession();
- g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
- SOUP_SESSION_SSL_STRICT, FALSE, NULL);
</del><ins>+ SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
</ins><span class="cx">
</span><span class="cx"> RunLoop::run();
</span><span class="cx">
</span><del>- if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
- soup_cache_flush(SOUP_CACHE(soupCache));
- soup_cache_dump(SOUP_CACHE(soupCache));
</del><ins>+ if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+ soup_cache_flush(soupCache);
+ soup_cache_dump(soupCache);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesssoupWebProcessSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -40,11 +40,10 @@
</span><span class="cx"> #include <WebCore/MemoryCache.h>
</span><span class="cx"> #include <WebCore/PageCache.h>
</span><span class="cx"> #include <WebCore/ResourceHandle.h>
</span><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <libsoup/soup.h>
</span><span class="cx"> #include <wtf/gobject/GOwnPtr.h>
</span><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><del>-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
</del><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="lines">@@ -94,7 +93,7 @@
</span><span class="cx"> SoupCache* cache = nullptr;
</span><span class="cx">
</span><span class="cx"> if (!usesNetworkProcess()) {
</span><del>- cache = SOUP_CACHE(soup_session_get_feature(WebCore::ResourceHandle::defaultSession(), SOUP_TYPE_CACHE));
</del><ins>+ cache = WebCore::SoupNetworkSession::defaultSession().cache();
</ins><span class="cx"> diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -122,52 +121,12 @@
</span><span class="cx"> if (usesNetworkProcess())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- soup_cache_clear(SOUP_CACHE(soup_session_get_feature(WebCore::ResourceHandle::defaultSession(), SOUP_TYPE_CACHE)));
</del><ins>+ soup_cache_clear(WebCore::SoupNetworkSession::defaultSession().cache());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// This function is based on Epiphany code in ephy-embed-prefs.c.
-static CString buildAcceptLanguages(Vector<String> languages)
-{
- // Ignore "C" locale.
- size_t position = languages.find("c");
- if (position != notFound)
- languages.remove(position);
-
- // Fallback to "en" if the list is empty.
- if (languages.isEmpty())
- return "en";
-
- // Calculate deltas for the quality values.
- int delta;
- if (languages.size() < 10)
- delta = 10;
- else if (languages.size() < 20)
- delta = 5;
- else
- delta = 1;
-
- // Set quality values for each language.
- StringBuilder builder;
- for (size_t i = 0; i < languages.size(); ++i) {
- if (i)
- builder.append(", ");
-
- builder.append(languages[i]);
-
- int quality = 100 - i * delta;
- if (quality > 0 && quality < 100) {
- char buffer[8];
- g_ascii_formatd(buffer, 8, "%.2f", quality / 100.0);
- builder.append(String::format(";q=%s", buffer));
- }
- }
-
- return builder.toString().utf8();
-}
-
</del><span class="cx"> static void setSoupSessionAcceptLanguage(Vector<String> languages)
</span><span class="cx"> {
</span><del>- g_object_set(WebCore::ResourceHandle::defaultSession(), "accept-language", buildAcceptLanguages(languages).data(), NULL);
</del><ins>+ WebCore::SoupNetworkSession::defaultSession().setAcceptLanguages(languages);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void languageChanged(void*)
</span><span class="lines">@@ -191,7 +150,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(!parameters.diskCacheDirectory.isEmpty());
</span><span class="cx"> GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER));
</span><del>- soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get()));
</del><ins>+ WebCore::SoupNetworkSession::defaultSession().setCache(soupCache.get());
</ins><span class="cx"> soup_cache_load(soupCache.get());
</span><span class="cx">
</span><span class="cx"> if (!parameters.cookiePersistentStoragePath.isEmpty()) {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesssoupWebSoupRequestManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp (161889 => 161890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp        2014-01-13 18:21:56 UTC (rev 161889)
+++ trunk/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp        2014-01-13 18:25:43 UTC (rev 161890)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "WebSoupRequestManagerProxyMessages.h"
</span><span class="cx"> #include <WebCore/ResourceHandle.h>
</span><span class="cx"> #include <WebCore/ResourceRequest.h>
</span><ins>+#include <WebCore/SoupNetworkSession.h>
</ins><span class="cx"> #include <wtf/gobject/GOwnPtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span><span class="lines">@@ -98,7 +99,7 @@
</span><span class="cx"> g_ptr_array_add(m_schemes.get(), g_strdup(scheme.utf8().data()));
</span><span class="cx"> g_ptr_array_add(m_schemes.get(), 0);
</span><span class="cx">
</span><del>- SoupSession* session = WebCore::ResourceHandle::defaultSession();
</del><ins>+ SoupSession* session = WebCore::SoupNetworkSession::defaultSession().soupSession();
</ins><span class="cx"> SoupRequestClass* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC));
</span><span class="cx"> genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_schemes->pdata));
</span><span class="cx"> soup_session_add_feature_by_type(session, WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
</span></span></pre>
</div>
</div>
</body>
</html>