<!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>[162271] trunk/Source/WebKit2</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/162271">162271</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-18 13:14:42 -0800 (Sat, 18 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Flesh out session APIs (still not enabled at API level).
https://bugs.webkit.org/show_bug.cgi?id=126918

Patch by Martin Hock &lt;mhock@apple.com&gt; on 2014-01-18
Reviewed by Alexey Proskuryakov.

* CMakeLists.txt:
* GNUmakefile.list.am:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::storageSession):
(WebKit::NetworkConnectionToWebProcess::startDownload):
(WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
(WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
(WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
(WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
(WebKit::NetworkConnectionToWebProcess::getRawCookies):
(WebKit::NetworkConnectionToWebProcess::deleteCookie):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::ensurePrivateBrowsingSession):
(WebKit::NetworkProcess::destroyPrivateBrowsingSession):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/RemoteNetworkingContext.h:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::storageSession):
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
* NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
* Shared/SessionTracker.cpp: Copied from Source/WebKit2/UIProcess/APISession.cpp.
(WebKit::sessionMap):
(WebKit::identifierBase):
(WebKit::SessionTracker::getSessionMap):
(WebKit::SessionTracker::getIdentifierBase):
(WebKit::SessionTracker::session):
(WebKit::SessionTracker::destroySession):
(WebKit::SessionTracker::setIdentifierBase):
* Shared/SessionTracker.h: Copied from Source/WebKit2/UIProcess/APISession.h.
(WebKit::SessionTracker::isEphemeralID):
* Shared/mac/CookieStorageShim.cpp:
(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
* UIProcess/APISession.cpp:
(API::generateID):
(API::Session::defaultSession):
(API::Session::legacyPrivateSession):
(API::Session::Session):
(API::Session::create):
(API::Session::isEphemeral):
(API::Session::getID):
* UIProcess/APISession.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setAnyPageGroupMightHavePrivateBrowsingEnabled):
(WebKit::WebContext::createNewWebProcess):
(WebKit::WebContext::createWebPage):
* UIProcess/WebContext.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::create):
(WebKit::WebPageProxy::WebPageProxy):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::sessionID):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createWebPage):
* UIProcess/WebProcessProxy.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPrivateBrowsingEnabled):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::legacySessionID):
(WebKit::WebPlatformStrategies::cookiesForDOM):
(WebKit::WebPlatformStrategies::setCookiesFromDOM):
(WebKit::WebPlatformStrategies::cookiesEnabled):
(WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
(WebKit::WebPlatformStrategies::getRawCookies):
(WebKit::WebPlatformStrategies::deleteCookie):
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
(WebKit::WebFrameNetworkingContext::storageSession):
* WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::WebFrameNetworkingContext::storageSession):
* WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::ensurePrivateBrowsingSession):
(WebKit::WebProcess::destroyPrivateBrowsingSession):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2GNUmakefilelistam">trunk/Source/WebKit2/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessmessagesin">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessmessagesin">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessRemoteNetworkingContexth">trunk/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessmacRemoteNetworkingContextmm">trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesssoupRemoteNetworkingContextSoupcpp">trunk/Source/WebKit2/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedmacCookieStorageShimcpp">trunk/Source/WebKit2/Shared/mac/CookieStorageShim.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPISessioncpp">trunk/Source/WebKit2/UIProcess/APISession.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPISessionh">trunk/Source/WebKit2/UIProcess/APISession.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebContextcpp">trunk/Source/WebKit2/UIProcess/WebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebContexth">trunk/Source/WebKit2/UIProcess/WebContext.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxyh">trunk/Source/WebKit2/UIProcess/WebProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebPlatformStrategiescpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebFrameNetworkingContexth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebFrameNetworkingContextmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContextcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContexth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessmessagesin">trunk/Source/WebKit2/WebProcess/WebProcess.messages.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedSessionTrackercpp">trunk/Source/WebKit2/Shared/SessionTracker.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedSessionTrackerh">trunk/Source/WebKit2/Shared/SessionTracker.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/CMakeLists.txt        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -204,6 +204,7 @@
</span><span class="cx">     Shared/PrintInfo.cpp
</span><span class="cx">     Shared/SecurityOriginData.cpp
</span><span class="cx">     Shared/SessionState.cpp
</span><ins>+    Shared/SessionTracker.cpp
</ins><span class="cx">     Shared/ShareableBitmap.cpp
</span><span class="cx">     Shared/ShareableResource.cpp
</span><span class="cx">     Shared/StatisticsData.cpp
</span><span class="lines">@@ -293,6 +294,7 @@
</span><span class="cx">     Shared/Plugins/Netscape/PluginInformation.cpp
</span><span class="cx"> 
</span><span class="cx">     UIProcess/APINavigationData.cpp
</span><ins>+    UIProcess/APISession.cpp
</ins><span class="cx">     UIProcess/BackingStore.cpp
</span><span class="cx">     UIProcess/DrawingAreaProxy.cpp
</span><span class="cx">     UIProcess/FindIndicator.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -1,3 +1,96 @@
</span><ins>+2014-01-18  Martin Hock  &lt;mhock@apple.com&gt;
+
+        Flesh out session APIs (still not enabled at API level).
+        https://bugs.webkit.org/show_bug.cgi?id=126918
+
+        Reviewed by Alexey Proskuryakov.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::storageSession):
+        (WebKit::NetworkConnectionToWebProcess::startDownload):
+        (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
+        (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
+        (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
+        (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
+        (WebKit::NetworkConnectionToWebProcess::getRawCookies):
+        (WebKit::NetworkConnectionToWebProcess::deleteCookie):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
+        (WebKit::NetworkProcess::destroyPrivateBrowsingSession):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/RemoteNetworkingContext.h:
+        * NetworkProcess/mac/RemoteNetworkingContext.mm:
+        (WebKit::RemoteNetworkingContext::storageSession):
+        (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
+        * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
+        (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
+        * Shared/SessionTracker.cpp: Copied from Source/WebKit2/UIProcess/APISession.cpp.
+        (WebKit::sessionMap):
+        (WebKit::identifierBase):
+        (WebKit::SessionTracker::getSessionMap):
+        (WebKit::SessionTracker::getIdentifierBase):
+        (WebKit::SessionTracker::session):
+        (WebKit::SessionTracker::destroySession):
+        (WebKit::SessionTracker::setIdentifierBase):
+        * Shared/SessionTracker.h: Copied from Source/WebKit2/UIProcess/APISession.h.
+        (WebKit::SessionTracker::isEphemeralID):
+        * Shared/mac/CookieStorageShim.cpp:
+        (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
+        * UIProcess/APISession.cpp:
+        (API::generateID):
+        (API::Session::defaultSession):
+        (API::Session::legacyPrivateSession):
+        (API::Session::Session):
+        (API::Session::create):
+        (API::Session::isEphemeral):
+        (API::Session::getID):
+        * UIProcess/APISession.h:
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::setAnyPageGroupMightHavePrivateBrowsingEnabled):
+        (WebKit::WebContext::createNewWebProcess):
+        (WebKit::WebContext::createWebPage):
+        * UIProcess/WebContext.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::create):
+        (WebKit::WebPageProxy::WebPageProxy):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::sessionID):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::createWebPage):
+        * UIProcess/WebProcessProxy.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::legacySessionID):
+        (WebKit::WebPlatformStrategies::cookiesForDOM):
+        (WebKit::WebPlatformStrategies::setCookiesFromDOM):
+        (WebKit::WebPlatformStrategies::cookiesEnabled):
+        (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
+        (WebKit::WebPlatformStrategies::getRawCookies):
+        (WebKit::WebPlatformStrategies::deleteCookie):
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+        (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+        (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
+        (WebKit::WebFrameNetworkingContext::storageSession):
+        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
+        (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+        (WebKit::WebFrameNetworkingContext::storageSession):
+        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        (WebKit::WebProcess::ensurePrivateBrowsingSession):
+        (WebKit::WebProcess::destroyPrivateBrowsingSession):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
</ins><span class="cx"> 2014-01-18  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Page should use std::unique_ptr for InspectorController
</span></span></pre></div>
<a id="trunkSourceWebKit2GNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/GNUmakefile.list.am (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/GNUmakefile.list.am        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/GNUmakefile.list.am        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -442,6 +442,8 @@
</span><span class="cx">         Source/WebKit2/Shared/SecurityOriginData.cpp \
</span><span class="cx">         Source/WebKit2/Shared/SessionState.cpp \
</span><span class="cx">         Source/WebKit2/Shared/SessionState.h \
</span><ins>+        Source/WebKit2/Shared/SessionTracker.cpp \
+        Source/WebKit2/Shared/SessionTracker.h \
</ins><span class="cx">         Source/WebKit2/Shared/StatisticsData.cpp \
</span><span class="cx">         Source/WebKit2/Shared/StatisticsData.h \
</span><span class="cx">         Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h \
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;NetworkResourceLoader.h&quot;
</span><span class="cx"> #include &quot;NetworkResourceLoaderMessages.h&quot;
</span><span class="cx"> #include &quot;RemoteNetworkingContext.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &lt;WebCore/BlobData.h&gt;
</span><span class="cx"> #include &lt;WebCore/PlatformCookieJar.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceLoaderOptions.h&gt;
</span><span class="lines">@@ -147,10 +148,10 @@
</span><span class="cx">     m_serialLoadingEnabled = enabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NetworkStorageSession&amp; storageSession(bool privateBrowsingEnabled)
</del><ins>+static NetworkStorageSession&amp; storageSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><del>-    if (privateBrowsingEnabled) {
-        NetworkStorageSession* privateSession = RemoteNetworkingContext::privateBrowsingSession();
</del><ins>+    if (SessionTracker::isEphemeralID(sessionID)) {
+        NetworkStorageSession* privateSession = SessionTracker::session(sessionID).get();
</ins><span class="cx">         if (privateSession)
</span><span class="cx">             return *privateSession;
</span><span class="cx">         // Some requests with private browsing mode requested may still be coming shortly after NetworkProcess was told to destroy its session.
</span><span class="lines">@@ -160,9 +161,9 @@
</span><span class="cx">     return NetworkStorageSession::defaultStorageSession();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::startDownload(bool privateBrowsingEnabled, uint64_t downloadID, const ResourceRequest&amp; request)
</del><ins>+void NetworkConnectionToWebProcess::startDownload(uint64_t sessionID, uint64_t downloadID, const ResourceRequest&amp; request)
</ins><span class="cx"> {
</span><del>-    // FIXME: Do something with the private browsing flag.
</del><ins>+    // FIXME: Do something with the session ID.
</ins><span class="cx">     NetworkProcess::shared().downloadManager().startDownload(downloadID, request);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -182,34 +183,34 @@
</span><span class="cx">     loader-&gt;didConvertHandleToDownload();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::cookiesForDOM(bool privateBrowsingEnabled, const URL&amp; firstParty, const URL&amp; url, String&amp; result)
</del><ins>+void NetworkConnectionToWebProcess::cookiesForDOM(uint64_t sessionID, const URL&amp; firstParty, const URL&amp; url, String&amp; result)
</ins><span class="cx"> {
</span><del>-    result = WebCore::cookiesForDOM(storageSession(privateBrowsingEnabled), firstParty, url);
</del><ins>+    result = WebCore::cookiesForDOM(storageSession(sessionID), firstParty, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::setCookiesFromDOM(bool privateBrowsingEnabled, const URL&amp; firstParty, const URL&amp; url, const String&amp; cookieString)
</del><ins>+void NetworkConnectionToWebProcess::setCookiesFromDOM(uint64_t sessionID, const URL&amp; firstParty, const URL&amp; url, const String&amp; cookieString)
</ins><span class="cx"> {
</span><del>-    WebCore::setCookiesFromDOM(storageSession(privateBrowsingEnabled), firstParty, url, cookieString);
</del><ins>+    WebCore::setCookiesFromDOM(storageSession(sessionID), firstParty, url, cookieString);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::cookiesEnabled(bool privateBrowsingEnabled, const URL&amp; firstParty, const URL&amp; url, bool&amp; result)
</del><ins>+void NetworkConnectionToWebProcess::cookiesEnabled(uint64_t sessionID, const URL&amp; firstParty, const URL&amp; url, bool&amp; result)
</ins><span class="cx"> {
</span><del>-    result = WebCore::cookiesEnabled(storageSession(privateBrowsingEnabled), firstParty, url);
</del><ins>+    result = WebCore::cookiesEnabled(storageSession(sessionID), firstParty, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(bool privateBrowsingEnabled, const URL&amp; firstParty, const URL&amp; url, String&amp; result)
</del><ins>+void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(uint64_t sessionID, const URL&amp; firstParty, const URL&amp; url, String&amp; result)
</ins><span class="cx"> {
</span><del>-    result = WebCore::cookieRequestHeaderFieldValue(storageSession(privateBrowsingEnabled), firstParty, url);
</del><ins>+    result = WebCore::cookieRequestHeaderFieldValue(storageSession(sessionID), firstParty, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::getRawCookies(bool privateBrowsingEnabled, const URL&amp; firstParty, const URL&amp; url, Vector&lt;Cookie&gt;&amp; result)
</del><ins>+void NetworkConnectionToWebProcess::getRawCookies(uint64_t sessionID, const URL&amp; firstParty, const URL&amp; url, Vector&lt;Cookie&gt;&amp; result)
</ins><span class="cx"> {
</span><del>-    WebCore::getRawCookies(storageSession(privateBrowsingEnabled), firstParty, url, result);
</del><ins>+    WebCore::getRawCookies(storageSession(sessionID), firstParty, url, result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkConnectionToWebProcess::deleteCookie(bool privateBrowsingEnabled, const URL&amp; url, const String&amp; cookieName)
</del><ins>+void NetworkConnectionToWebProcess::deleteCookie(uint64_t sessionID, const URL&amp; url, const String&amp; cookieName)
</ins><span class="cx"> {
</span><del>-    WebCore::deleteCookie(storageSession(privateBrowsingEnabled), url, cookieName);
</del><ins>+    WebCore::deleteCookie(storageSession(sessionID), url, cookieName);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkConnectionToWebProcess::registerBlobURL(const URL&amp; url, const BlobRegistrationData&amp; data)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -76,15 +76,15 @@
</span><span class="cx">     void crossOriginRedirectReceived(ResourceLoadIdentifier, const WebCore::URL&amp; redirectURL);
</span><span class="cx">     void servePendingRequests(uint32_t resourceLoadPriority);
</span><span class="cx">     void setSerialLoadingEnabled(bool);
</span><del>-    void startDownload(bool privateBrowsingEnabled, uint64_t downloadID, const WebCore::ResourceRequest&amp;);
</del><ins>+    void startDownload(uint64_t sessionID, uint64_t downloadID, const WebCore::ResourceRequest&amp;);
</ins><span class="cx">     void convertMainResourceLoadToDownload(uint64_t mainResourceLoadIdentifier, uint64_t downloadID, const WebCore::ResourceRequest&amp;, const WebCore::ResourceResponse&amp;);
</span><span class="cx"> 
</span><del>-    void cookiesForDOM(bool privateBrowsingEnabled, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, String&amp; result);
-    void setCookiesFromDOM(bool privateBrowsingEnabled, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, const String&amp;);
-    void cookiesEnabled(bool privateBrowsingEnabled, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, bool&amp; result);
-    void cookieRequestHeaderFieldValue(bool privateBrowsingEnabled, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, String&amp; result);
-    void getRawCookies(bool privateBrowsingEnabled, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, Vector&lt;WebCore::Cookie&gt;&amp;);
-    void deleteCookie(bool privateBrowsingEnabled, const WebCore::URL&amp;, const String&amp; cookieName);
</del><ins>+    void cookiesForDOM(uint64_t sessionID, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, String&amp; result);
+    void setCookiesFromDOM(uint64_t sessionID, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, const String&amp;);
+    void cookiesEnabled(uint64_t sessionID, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, bool&amp; result);
+    void cookieRequestHeaderFieldValue(uint64_t sessionID, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, String&amp; result);
+    void getRawCookies(uint64_t sessionID, const WebCore::URL&amp; firstParty, const WebCore::URL&amp;, Vector&lt;WebCore::Cookie&gt;&amp;);
+    void deleteCookie(uint64_t sessionID, const WebCore::URL&amp;, const String&amp; cookieName);
</ins><span class="cx"> 
</span><span class="cx">     void registerBlobURL(const WebCore::URL&amp;, const BlobRegistrationData&amp;);
</span><span class="cx">     void registerBlobURLFromURL(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -32,15 +32,15 @@
</span><span class="cx">     
</span><span class="cx">     SetSerialLoadingEnabled(bool enabled) -&gt; ()
</span><span class="cx"> 
</span><del>-    StartDownload(bool privateBrowsingEnabled, uint64_t downloadID, WebCore::ResourceRequest request)
</del><ins>+    StartDownload(uint64_t sessionID, uint64_t downloadID, WebCore::ResourceRequest request)
</ins><span class="cx">     ConvertMainResourceLoadToDownload(uint64_t mainResourceLoadIdentifier, uint64_t downloadID, WebCore::ResourceRequest request, WebCore::ResourceResponse response)
</span><span class="cx"> 
</span><del>-    CookiesForDOM(bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -&gt; (String result)
-    SetCookiesFromDOM(bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url, String cookieString)
-    CookiesEnabled(bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -&gt; (bool enabled)
-    CookieRequestHeaderFieldValue(bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -&gt; (String result)
-    GetRawCookies(bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -&gt; (Vector&lt;WebCore::Cookie&gt; cookies)
-    DeleteCookie(bool privateBrowsingEnabled, WebCore::URL url, String cookieName)
</del><ins>+    CookiesForDOM(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -&gt; (String result)
+    SetCookiesFromDOM(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url, String cookieString)
+    CookiesEnabled(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -&gt; (bool enabled)
+    CookieRequestHeaderFieldValue(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -&gt; (String result)
+    GetRawCookies(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -&gt; (Vector&lt;WebCore::Cookie&gt; cookies)
+    DeleteCookie(uint64_t sessionID, WebCore::URL url, String cookieName)
</ins><span class="cx"> 
</span><span class="cx">     RegisterBlobURL(WebCore::URL url, WebKit::BlobRegistrationData data)
</span><span class="cx">     RegisterBlobURLFromURL(WebCore::URL url, WebCore::URL srcURL)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include &quot;NetworkProcessProxyMessages.h&quot;
</span><span class="cx"> #include &quot;NetworkResourceLoader.h&quot;
</span><span class="cx"> #include &quot;RemoteNetworkingContext.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;StatisticsData.h&quot;
</span><span class="cx"> #include &quot;WebContextMessages.h&quot;
</span><span class="cx"> #include &quot;WebCookieManager.h&quot;
</span><span class="lines">@@ -157,11 +158,12 @@
</span><span class="cx">     setCacheModel(static_cast&lt;uint32_t&gt;(parameters.cacheModel));
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK)
</span><del>-    RemoteNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);
</del><ins>+    SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions)
</ins><span class="cx">     if (parameters.privateBrowsingEnabled)
</span><del>-        RemoteNetworkingContext::ensurePrivateBrowsingSession();
</del><ins>+        RemoteNetworkingContext::ensurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID);
</ins><span class="cx"> 
</span><span class="cx">     if (parameters.shouldUseTestingNetworkSession)
</span><span class="cx">         NetworkStorageSession::switchToNewTestingSession();
</span><span class="lines">@@ -212,14 +214,14 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcess::ensurePrivateBrowsingSession()
</del><ins>+void NetworkProcess::ensurePrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><del>-    RemoteNetworkingContext::ensurePrivateBrowsingSession();
</del><ins>+    RemoteNetworkingContext::ensurePrivateBrowsingSession(sessionID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcess::destroyPrivateBrowsingSession()
</del><ins>+void NetworkProcess::destroyPrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><del>-    RemoteNetworkingContext::destroyPrivateBrowsingSession();
</del><ins>+    SessionTracker::destroySession(sessionID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::downloadRequest(uint64_t downloadID, const ResourceRequest&amp; request)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -104,8 +104,8 @@
</span><span class="cx">     void didReceiveNetworkProcessMessage(IPC::Connection*, IPC::MessageDecoder&amp;);
</span><span class="cx">     void initializeNetworkProcess(const NetworkProcessCreationParameters&amp;);
</span><span class="cx">     void createNetworkConnectionToWebProcess();
</span><del>-    void ensurePrivateBrowsingSession();
-    void destroyPrivateBrowsingSession();
</del><ins>+    void ensurePrivateBrowsingSession(uint64_t sessionID);
+    void destroyPrivateBrowsingSession(uint64_t sessionID);
</ins><span class="cx">     void downloadRequest(uint64_t downloadID, const WebCore::ResourceRequest&amp;);
</span><span class="cx">     void cancelDownload(uint64_t downloadID);
</span><span class="cx">     void setCacheModel(uint32_t);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -34,8 +34,8 @@
</span><span class="cx">     UserPreferredLanguagesChanged(Vector&lt;String&gt; languages)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    EnsurePrivateBrowsingSession()
-    DestroyPrivateBrowsingSession()
</del><ins>+    EnsurePrivateBrowsingSession(uint64_t sessionID)
+    DestroyPrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> 
</span><span class="cx">     DownloadRequest(uint64_t downloadID, WebCore::ResourceRequest request)
</span><span class="cx">     CancelDownload(uint64_t downloadID)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessRemoteNetworkingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -39,12 +39,9 @@
</span><span class="cx">     }
</span><span class="cx">     virtual ~RemoteNetworkingContext();
</span><span class="cx"> 
</span><del>-    static void setPrivateBrowsingStorageSessionIdentifierBase(const String&amp;);
-    static void ensurePrivateBrowsingSession();
-    static void destroyPrivateBrowsingSession();
</del><ins>+    // FIXME: remove platform-specific code and use SessionTracker
+    static void ensurePrivateBrowsingSession(uint64_t sessionID);
</ins><span class="cx"> 
</span><del>-    static WebCore::NetworkStorageSession* privateBrowsingSession();
-
</del><span class="cx">     virtual bool shouldClearReferrerOnHTTPSToHTTPRedirect() const override { return m_shouldClearReferrerOnHTTPSToHTTPRedirect; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacRemoteNetworkingContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;RemoteNetworkingContext.h&quot;
</span><span class="cx"> 
</span><ins>+#import &quot;SessionTracker.h&quot;
</ins><span class="cx"> #import &quot;WebErrors.h&quot;
</span><span class="cx"> #import &lt;WebCore/ResourceError.h&gt;
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="lines">@@ -36,12 +37,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static std::unique_ptr&lt;NetworkStorageSession&gt;&amp; privateBrowsingStorageSession()
-{
-    ASSERT(isMainThread());
-    static NeverDestroyed&lt;std::unique_ptr&lt;NetworkStorageSession&gt;&gt; session;
-    return session;
-}
</del><span class="cx"> 
</span><span class="cx"> RemoteNetworkingContext::~RemoteNetworkingContext()
</span><span class="cx"> {
</span><span class="lines">@@ -65,7 +60,7 @@
</span><span class="cx"> NetworkStorageSession&amp; RemoteNetworkingContext::storageSession() const
</span><span class="cx"> {
</span><span class="cx">     if (m_privateBrowsingEnabled) {
</span><del>-        NetworkStorageSession* privateSession = privateBrowsingStorageSession().get();
</del><ins>+        NetworkStorageSession* privateSession = SessionTracker::session(SessionTracker::legacyPrivateSessionID).get();
</ins><span class="cx">         if (privateSession)
</span><span class="cx">             return *privateSession;
</span><span class="cx">         // Some requests with private browsing mode requested may still be coming shortly after NetworkProcess was told to destroy its session.
</span><span class="lines">@@ -76,11 +71,6 @@
</span><span class="cx">     return NetworkStorageSession::defaultStorageSession();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NetworkStorageSession* RemoteNetworkingContext::privateBrowsingSession()
-{
-    return privateBrowsingStorageSession().get();
-}
-
</del><span class="cx"> RetainPtr&lt;CFDataRef&gt; RemoteNetworkingContext::sourceApplicationAuditData() const
</span><span class="cx"> {
</span><span class="cx">     return nil;
</span><span class="lines">@@ -91,32 +81,13 @@
</span><span class="cx">     return WebKit::blockedError(request);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static String&amp; privateBrowsingStorageSessionIdentifierBase()
</del><ins>+void RemoteNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
-    static NeverDestroyed&lt;String&gt; base;
-    return base;
-}
-
-void RemoteNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(const String&amp; identifier)
-{
-    privateBrowsingStorageSessionIdentifierBase() = identifier;
-}
-
-void RemoteNetworkingContext::ensurePrivateBrowsingSession()
-{
-    if (privateBrowsingStorageSession())
</del><ins>+    if (SessionTracker::session(sessionID))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ASSERT(!privateBrowsingStorageSessionIdentifierBase().isNull());
-    RetainPtr&lt;CFStringRef&gt; cfIdentifier = String(privateBrowsingStorageSessionIdentifierBase() + &quot;.PrivateBrowsing&quot;).createCFString();
-
-    privateBrowsingStorageSession() = std::move(NetworkStorageSession::createPrivateBrowsingSession(privateBrowsingStorageSessionIdentifierBase()));
</del><ins>+    ASSERT(!SessionTracker::getIdentifierBase().isNull());
+    SessionTracker::session(sessionID) = NetworkStorageSession::createPrivateBrowsingSession(SessionTracker::getIdentifierBase() + '.' + String::number(sessionID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteNetworkingContext::destroyPrivateBrowsingSession()
-{
-    privateBrowsingStorageSession() = nullptr;
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesssoupRemoteNetworkingContextSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -52,31 +52,16 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(const String&amp;)
</del><ins>+void RemoteNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteNetworkingContext::ensurePrivateBrowsingSession()
-{
-    notImplemented();
-}
-
-void RemoteNetworkingContext::destroyPrivateBrowsingSession()
-{
-}
-
</del><span class="cx"> NetworkStorageSession&amp; RemoteNetworkingContext::storageSession() const
</span><span class="cx"> {
</span><span class="cx">     return NetworkStorageSession::defaultStorageSession();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NetworkStorageSession* RemoteNetworkingContext::privateBrowsingSession()
-{
-    notImplemented();
-    return &amp;NetworkStorageSession::defaultStorageSession();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-}
-
</del><span class="cx"> #endif // ENABLE(NETWORK_PROCESS)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionTrackercppfromrev162270trunkSourceWebKit2UIProcessAPISessioncpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/SessionTracker.cpp (from rev 162270, trunk/Source/WebKit2/UIProcess/APISession.cpp) (0 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionTracker.cpp                                (rev 0)
+++ trunk/Source/WebKit2/Shared/SessionTracker.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 &quot;config.h&quot;
+#include &quot;SessionTracker.h&quot;
+
+#include &lt;wtf/MainThread.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static HashMap&lt;uint64_t, std::unique_ptr&lt;NetworkStorageSession&gt;&gt;&amp; sessionMap()
+{
+    ASSERT(isMainThread());
+
+    static NeverDestroyed&lt;HashMap&lt;uint64_t, std::unique_ptr&lt;NetworkStorageSession&gt;&gt;&gt; map;
+    return map.get();
+}
+
+static String&amp; identifierBase()
+{
+    ASSERT(isMainThread());
+
+    static NeverDestroyed&lt;String&gt; base;
+    return base;
+}
+
+const HashMap&lt;uint64_t, std::unique_ptr&lt;NetworkStorageSession&gt;&gt;&amp; SessionTracker::getSessionMap()
+{
+    return sessionMap();
+}
+
+const String&amp; SessionTracker::getIdentifierBase()
+{
+    return identifierBase();
+}
+
+std::unique_ptr&lt;NetworkStorageSession&gt;&amp; SessionTracker::session(uint64_t sessionID)
+{
+    return sessionMap().add(sessionID, nullptr).iterator-&gt;value;
+}
+
+void SessionTracker::destroySession(uint64_t sessionID)
+{
+    ASSERT(isMainThread());
+
+    sessionMap().remove(sessionID);
+}
+
+void SessionTracker::setIdentifierBase(const String&amp; identifier)
+{
+    ASSERT(isMainThread());
+
+    identifierBase() = identifier;
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedSessionTrackerhfromrev162270trunkSourceWebKit2UIProcessAPISessionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/SessionTracker.h (from rev 162270, trunk/Source/WebKit2/UIProcess/APISession.h) (0 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SessionTracker.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/SessionTracker.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 SessionTracker_h
+#define SessionTracker_h
+
+#include &lt;WebCore/NetworkStorageSession.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+namespace WebKit {
+
+class SessionTracker {
+    WTF_MAKE_NONCOPYABLE(SessionTracker);
+public:
+    static const uint64_t defaultSessionID = 1;
+    static const uint64_t legacyPrivateSessionID = 2;
+    static bool isEphemeralID(uint64_t sessionID) { return sessionID != SessionTracker::defaultSessionID; }
+    static const HashMap&lt;uint64_t, std::unique_ptr&lt;WebCore::NetworkStorageSession&gt;&gt;&amp; getSessionMap();
+    static const String&amp; getIdentifierBase();
+    static std::unique_ptr&lt;WebCore::NetworkStorageSession&gt;&amp; session(uint64_t sessionID);
+    static void destroySession(uint64_t sessionID);
+    static void setIdentifierBase(const String&amp;);
+};
+
+} // namespace WebKit
+
+#endif // SessionTracker_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedmacCookieStorageShimcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/CookieStorageShim.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/CookieStorageShim.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/Shared/mac/CookieStorageShim.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CookieStorageShimLibrary.h&quot;
</span><span class="cx"> #include &quot;NetworkConnectionToWebProcess.h&quot;
</span><span class="cx"> #include &quot;NetworkProcessConnection.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><span class="cx"> #include &lt;WebCore/URL.h&gt;
</span><span class="lines">@@ -47,7 +48,7 @@
</span><span class="cx"> {
</span><span class="cx">     String cookies;
</span><span class="cx">     URL firstPartyForCookiesURL;
</span><del>-    if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(false, firstPartyForCookiesURL, inRequestURL), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookies), 0))
</del><ins>+    if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(SessionTracker::defaultSessionID, firstPartyForCookiesURL, inRequestURL), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookies), 0))
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;CFStringRef&gt; cfCookies = cookies.createCFString();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPISessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/APISession.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/APISession.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/APISession.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -26,23 +26,63 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;APISession.h&quot;
</span><span class="cx"> 
</span><ins>+#include &lt;wtf/MainThread.h&gt;
+
</ins><span class="cx"> namespace API {
</span><span class="cx"> 
</span><ins>+static uint64_t generateID(bool isEphemeral)
+{
+    ASSERT(isMainThread());
+
+    static uint64_t uniqueSessionID = WebKit::SessionTracker::legacyPrivateSessionID;
+    ASSERT(isEphemeral);
+    return ++uniqueSessionID;
+}
+
+Session&amp; Session::defaultSession()
+{
+    ASSERT(isMainThread());
+
+    static Session* defaultSession = new Session(false, WebKit::SessionTracker::defaultSessionID);
+    return *defaultSession;
+}
+
+Session&amp; Session::legacyPrivateSession()
+{
+    ASSERT(isMainThread());
+
+    static Session* legacyPrivateSession = new Session(true, WebKit::SessionTracker::legacyPrivateSessionID);
+    return *legacyPrivateSession;
+}
+
</ins><span class="cx"> Session::Session(bool isEphemeral)
</span><span class="cx">     : m_isEphemeral(isEphemeral)
</span><ins>+    , m_sessionID(generateID(isEphemeral))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Session::Session(bool isEphemeral, uint64_t sessionID)
+    : m_isEphemeral(isEphemeral)
+    , m_sessionID(sessionID)
+{
+}
+
</ins><span class="cx"> PassRefPtr&lt;Session&gt; Session::create(bool isEphemeral)
</span><span class="cx"> {
</span><ins>+    // FIXME: support creation of non-default, non-ephemeral sessions
</ins><span class="cx">     return adoptRef(new Session(isEphemeral));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Session::isEphemeral()
</del><ins>+bool Session::isEphemeral() const
</ins><span class="cx"> {
</span><span class="cx">     return m_isEphemeral;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+uint64_t Session::getID() const
+{
+    return m_sessionID;
+}
+
</ins><span class="cx"> Session::~Session()
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPISessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/APISession.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/APISession.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/APISession.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define APISession_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="lines">@@ -34,12 +35,17 @@
</span><span class="cx"> class Session : public API::ObjectImpl&lt;API::Object::Type::Session&gt; {
</span><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;Session&gt; create(bool isEphemeral);
</span><del>-    bool isEphemeral();
</del><ins>+    static Session&amp; defaultSession();
+    static Session&amp; legacyPrivateSession();
+    bool isEphemeral() const;
+    uint64_t getID() const;
</ins><span class="cx">     virtual ~Session();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit Session(bool isEphemeral);
</span><ins>+    Session(bool isEphemeral, uint64_t sessionID);
</ins><span class="cx">     bool m_isEphemeral;
</span><ins>+    uint64_t m_sessionID;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace API
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebContext.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MutableDictionary.h&quot;
</span><span class="cx"> #include &quot;SandboxExtension.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;StatisticsData.h&quot;
</span><span class="cx"> #include &quot;TextChecker.h&quot;
</span><span class="cx"> #include &quot;WKContextPrivate.h&quot;
</span><span class="lines">@@ -467,16 +468,16 @@
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (usesNetworkProcess() &amp;&amp; networkProcess()) {
</span><span class="cx">         if (privateBrowsingEnabled)
</span><del>-            networkProcess()-&gt;send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(), 0);
</del><ins>+            networkProcess()-&gt;send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0);
</ins><span class="cx">         else
</span><del>-            networkProcess()-&gt;send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
</del><ins>+            networkProcess()-&gt;send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0);
</ins><span class="cx">     }
</span><span class="cx"> #endif // ENABLED(NETWORK_PROCESS)
</span><span class="cx"> 
</span><span class="cx">     if (privateBrowsingEnabled)
</span><del>-        sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession());
</del><ins>+        sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID));
</ins><span class="cx">     else
</span><del>-        sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession());
</del><ins>+        sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession(SessionTracker::legacyPrivateSessionID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void (*s_invalidMessageCallback)(WKStringRef messageName);
</span><span class="lines">@@ -597,7 +598,7 @@
</span><span class="cx">     process-&gt;send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get(), *process)), 0);
</span><span class="cx"> 
</span><span class="cx">     if (WebPreferences::anyPageGroupsAreUsingPrivateBrowsing())
</span><del>-        process-&gt;send(Messages::WebProcess::EnsurePrivateBrowsingSession(), 0);
</del><ins>+        process-&gt;send(Messages::WebProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0);
</ins><span class="cx"> 
</span><span class="cx">     m_processes.append(process);
</span><span class="cx"> 
</span><span class="lines">@@ -740,7 +741,7 @@
</span><span class="cx">     return *result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebPageProxy&gt; WebContext::createWebPage(PageClient&amp; pageClient, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
</del><ins>+PassRefPtr&lt;WebPageProxy&gt; WebContext::createWebPage(PageClient&amp; pageClient, WebPageGroup* pageGroup, API::Session&amp; session, WebPageProxy* relatedPage)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;WebProcessProxy&gt; process;
</span><span class="cx">     if (m_processModel == ProcessModelSharedSecondaryProcess) {
</span><span class="lines">@@ -756,9 +757,15 @@
</span><span class="cx">             process = &amp;createNewWebProcessRespectingProcessCountLimit();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return process-&gt;createWebPage(pageClient, pageGroup ? *pageGroup : m_defaultPageGroup.get());
</del><ins>+    return process-&gt;createWebPage(pageClient, pageGroup ? *pageGroup : m_defaultPageGroup.get(), session);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;WebPageProxy&gt; WebContext::createWebPage(PageClient&amp; pageClient, WebPageGroup* pageGroup, WebPageProxy* relatedPage)
+{
+    WebPageGroup* group = pageGroup ? pageGroup : &amp;m_defaultPageGroup.get();
+    return createWebPage(pageClient, group, group-&gt;preferences()-&gt;privateBrowsingEnabled() ? API::Session::legacyPrivateSession() : API::Session::defaultSession(), relatedPage);
+}
+
</ins><span class="cx"> DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const ResourceRequest&amp; request)
</span><span class="cx"> {
</span><span class="cx">     DownloadProxy* downloadProxy = createDownloadProxy();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebContext.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -149,6 +149,7 @@
</span><span class="cx"> 
</span><span class="cx">     StorageManager&amp; storageManager() const { return *m_storageManager; }
</span><span class="cx"> 
</span><ins>+    PassRefPtr&lt;WebPageProxy&gt; createWebPage(PageClient&amp;, WebPageGroup*, API::Session&amp;, WebPageProxy* relatedPage = 0);
</ins><span class="cx">     PassRefPtr&lt;WebPageProxy&gt; createWebPage(PageClient&amp;, WebPageGroup*, WebPageProxy* relatedPage = 0);
</span><span class="cx"> 
</span><span class="cx">     const String&amp; injectedBundlePath() const { return m_injectedBundlePath; }
</span><span class="lines">@@ -292,6 +293,8 @@
</span><span class="cx">     static void willStartUsingPrivateBrowsing();
</span><span class="cx">     static void willStopUsingPrivateBrowsing();
</span><span class="cx"> 
</span><ins>+    static bool isEphemeralSession(uint64_t sessionID);
+
</ins><span class="cx"> #if USE(SOUP)
</span><span class="cx">     void setIgnoreTLSErrors(bool);
</span><span class="cx">     bool ignoreTLSErrors() const { return m_ignoreTLSErrors; }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -228,12 +228,12 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // !LOG_DISABLED
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebPageProxy&gt; WebPageProxy::create(PageClient&amp; pageClient, WebProcessProxy&amp; process, WebPageGroup&amp; pageGroup, uint64_t pageID)
</del><ins>+PassRefPtr&lt;WebPageProxy&gt; WebPageProxy::create(PageClient&amp; pageClient, WebProcessProxy&amp; process, WebPageGroup&amp; pageGroup, API::Session&amp; session, uint64_t pageID)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
</del><ins>+    return adoptRef(new WebPageProxy(pageClient, process, pageGroup, session, pageID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebPageProxy::WebPageProxy(PageClient&amp; pageClient, WebProcessProxy&amp; process, WebPageGroup&amp; pageGroup, uint64_t pageID)
</del><ins>+WebPageProxy::WebPageProxy(PageClient&amp; pageClient, WebProcessProxy&amp; process, WebPageGroup&amp; pageGroup, API::Session&amp; session, uint64_t pageID)
</ins><span class="cx">     : m_pageClient(pageClient)
</span><span class="cx">     , m_process(process)
</span><span class="cx">     , m_pageGroup(pageGroup)
</span><span class="lines">@@ -279,6 +279,7 @@
</span><span class="cx">     , m_needTouchEvents(false)
</span><span class="cx"> #endif
</span><span class="cx">     , m_pageID(pageID)
</span><ins>+    , m_session(session)
</ins><span class="cx">     , m_isPageSuspended(false)
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     , m_isSmartInsertDeleteEnabled(TextChecker::isSmartInsertDeleteEnabled())
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define WebPageProxy_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><ins>+#include &quot;APISession.h&quot;
</ins><span class="cx"> #include &quot;AutoCorrectionCallback.h&quot;
</span><span class="cx"> #include &quot;Connection.h&quot;
</span><span class="cx"> #include &quot;DragControllerAction.h&quot;
</span><span class="lines">@@ -74,6 +75,7 @@
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/PassOwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><ins>+#include &lt;wtf/Ref.h&gt;
</ins><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -327,10 +329,11 @@
</span><span class="cx">     , public IPC::MessageSender {
</span><span class="cx"> public:
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;WebPageProxy&gt; create(PageClient&amp;, WebProcessProxy&amp;, WebPageGroup&amp;, uint64_t pageID);
</del><ins>+    static PassRefPtr&lt;WebPageProxy&gt; create(PageClient&amp;, WebProcessProxy&amp;, WebPageGroup&amp;, API::Session&amp;, uint64_t pageID);
</ins><span class="cx">     virtual ~WebPageProxy();
</span><span class="cx"> 
</span><span class="cx">     uint64_t pageID() const { return m_pageID; }
</span><ins>+    uint64_t sessionID() const { return m_session-&gt;getID(); }
</ins><span class="cx"> 
</span><span class="cx">     WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
</span><span class="cx">     WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
</span><span class="lines">@@ -855,7 +858,7 @@
</span><span class="cx">     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
</span><span class="cx">         
</span><span class="cx"> private:
</span><del>-    WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, WebPageGroup&amp;, uint64_t pageID);
</del><ins>+    WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, WebPageGroup&amp;, API::Session&amp;, uint64_t pageID);
</ins><span class="cx">     void platformInitialize();
</span><span class="cx"> 
</span><span class="cx">     void updateViewState(WebCore::ViewState::Flags flagsToUpdate = WebCore::ViewState::AllFlags);
</span><span class="lines">@@ -1312,6 +1315,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     uint64_t m_pageID;
</span><ins>+    Ref&lt;API::Session&gt; m_session;
</ins><span class="cx"> 
</span><span class="cx">     bool m_isPageSuspended;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -167,10 +167,10 @@
</span><span class="cx">     return globalPageMap().get(pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebPageProxy&gt; WebProcessProxy::createWebPage(PageClient&amp; pageClient, WebPageGroup&amp; pageGroup)
</del><ins>+PassRefPtr&lt;WebPageProxy&gt; WebProcessProxy::createWebPage(PageClient&amp; pageClient, WebPageGroup&amp; pageGroup, API::Session&amp; session)
</ins><span class="cx"> {
</span><span class="cx">     uint64_t pageID = generatePageID();
</span><del>-    RefPtr&lt;WebPageProxy&gt; webPage = WebPageProxy::create(pageClient, *this, pageGroup, pageID);
</del><ins>+    RefPtr&lt;WebPageProxy&gt; webPage = WebPageProxy::create(pageClient, *this, pageGroup, session, pageID);
</ins><span class="cx">     m_pageMap.set(pageID, webPage.get());
</span><span class="cx">     globalPageMap().set(pageID, webPage.get());
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef WebProcessProxy_h
</span><span class="cx"> #define WebProcessProxy_h
</span><span class="cx"> 
</span><ins>+#include &quot;APISession.h&quot;
</ins><span class="cx"> #include &quot;ChildProcessProxy.h&quot;
</span><span class="cx"> #include &quot;MessageReceiverMap.h&quot;
</span><span class="cx"> #include &quot;PlatformProcessIdentifier.h&quot;
</span><span class="lines">@@ -77,7 +78,7 @@
</span><span class="cx">     WebContext&amp; context() { return m_context.get(); }
</span><span class="cx"> 
</span><span class="cx">     static WebPageProxy* webPage(uint64_t pageID);
</span><del>-    PassRefPtr&lt;WebPageProxy&gt; createWebPage(PageClient&amp;, WebPageGroup&amp;);
</del><ins>+    PassRefPtr&lt;WebPageProxy&gt; createWebPage(PageClient&amp;, WebPageGroup&amp;, API::Session&amp;);
</ins><span class="cx">     void addExistingWebPage(WebPageProxy*, uint64_t pageID);
</span><span class="cx">     void removeWebPage(uint64_t pageID);
</span><span class="cx">     Vector&lt;WebPageProxy*&gt; pages() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -787,6 +787,8 @@
</span><span class="cx">                 6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; };
</span><span class="cx">                 728E86F21795188C0087879E /* WebColorPickerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 728E86F01795188C0087879E /* WebColorPickerMac.mm */; };
</span><ins>+                753E3E0D1887398500188496 /* SessionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 753E3E0B1887397300188496 /* SessionTracker.cpp */; };
+                753E3E0E1887398900188496 /* SessionTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 753E3E091887394B00188496 /* SessionTracker.h */; };
</ins><span class="cx">                 755422BD18062BB20046F6A8 /* WKOriginDataManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755422B918062B9C0046F6A8 /* WKOriginDataManager.cpp */; };
</span><span class="cx">                 755422C418062BF90046F6A8 /* WebOriginDataManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755422BE18062BE40046F6A8 /* WebOriginDataManagerProxy.cpp */; };
</span><span class="cx">                 755422CB180650020046F6A8 /* WebOriginDataManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755422C618064FFC0046F6A8 /* WebOriginDataManager.cpp */; };
</span><span class="lines">@@ -2468,6 +2470,8 @@
</span><span class="cx">                 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 728E86EF1795188C0087879E /* WebColorPickerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPickerMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 728E86F01795188C0087879E /* WebColorPickerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebColorPickerMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                753E3E091887394B00188496 /* SessionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionTracker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                753E3E0B1887397300188496 /* SessionTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionTracker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 755422B918062B9C0046F6A8 /* WKOriginDataManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKOriginDataManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 755422BA18062B9C0046F6A8 /* WKOriginDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOriginDataManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 755422BE18062BE40046F6A8 /* WebOriginDataManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebOriginDataManagerProxy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3728,6 +3732,8 @@
</span><span class="cx">                                 33152974130D0CB200ED2483 /* SecurityOriginData.h */,
</span><span class="cx">                                 518D2CC812D51DFB003BB93B /* SessionState.cpp */,
</span><span class="cx">                                 518D2CC912D51DFB003BB93B /* SessionState.h */,
</span><ins>+                                753E3E0B1887397300188496 /* SessionTracker.cpp */,
+                                753E3E091887394B00188496 /* SessionTracker.h */,
</ins><span class="cx">                                 1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */,
</span><span class="cx">                                 1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */,
</span><span class="cx">                                 5121745E164C20E30037A5C1 /* ShareableResource.cpp */,
</span><span class="lines">@@ -6653,6 +6659,7 @@
</span><span class="cx">                                 BC40761C124FF0370068F20A /* WKURLCF.h in Headers */,
</span><span class="cx">                                 BC40760C124FF0270068F20A /* WKURLRequest.h in Headers */,
</span><span class="cx">                                 BC407629124FF0400068F20A /* WKURLRequestNS.h in Headers */,
</span><ins>+                                753E3E0E1887398900188496 /* SessionTracker.h in Headers */,
</ins><span class="cx">                                 BC40760E124FF0270068F20A /* WKURLResponse.h in Headers */,
</span><span class="cx">                                 759CCD5A1808F6160078E8A8 /* WebOriginDataManagerProxy.h in Headers */,
</span><span class="cx">                                 BC40762B124FF0400068F20A /* WKURLResponseNS.h in Headers */,
</span><span class="lines">@@ -7911,6 +7918,7 @@
</span><span class="cx">                                 BCD25F1811D6BDE100169B0E /* WKBundleFrame.cpp in Sources */,
</span><span class="cx">                                 BC498630124D18C100D834E1 /* WKBundleHitTestResult.cpp in Sources */,
</span><span class="cx">                                 6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */,
</span><ins>+                                753E3E0D1887398500188496 /* SessionTracker.cpp in Sources */,
</ins><span class="cx">                                 BC7043CD12F75EE0006472B9 /* WKBundleNavigationAction.cpp in Sources */,
</span><span class="cx">                                 BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */,
</span><span class="cx">                                 BC20528211C94284008F3375 /* WKBundlePage.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;InjectedBundleUserMessageCoders.h&quot;
</span><span class="cx"> #include &quot;LayerTreeHost.h&quot;
</span><span class="cx"> #include &quot;NotificationPermissionRequestManager.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="cx"> #include &quot;WKBundleAPICast.h&quot;
</span><span class="cx"> #include &quot;WebApplicationCacheManager.h&quot;
</span><span class="lines">@@ -299,9 +300,9 @@
</span><span class="cx">     // FIXME (NetworkProcess): This test-only function doesn't work with NetworkProcess, &lt;https://bugs.webkit.org/show_bug.cgi?id=115274&gt;.
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
</span><span class="cx">     if (enabled)
</span><del>-        WebFrameNetworkingContext::ensurePrivateBrowsingSession();
</del><ins>+        WebFrameNetworkingContext::ensurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID);
</ins><span class="cx">     else
</span><del>-        WebFrameNetworkingContext::destroyPrivateBrowsingSession();
</del><ins>+        SessionTracker::destroySession(SessionTracker::legacyPrivateSessionID);
</ins><span class="cx"> #endif
</span><span class="cx">     const HashSet&lt;Page*&gt;&amp; pages = PageGroup::pageGroup(pageGroup-&gt;identifier())-&gt;pages();
</span><span class="cx">     for (HashSet&lt;Page*&gt;::iterator iter = pages.begin(); iter != pages.end(); ++iter)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebPlatformStrategiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;DataReference.h&quot;
</span><span class="cx"> #include &quot;NetworkResourceLoadParameters.h&quot;
</span><span class="cx"> #include &quot;PluginInfoStore.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;StorageNamespaceImpl.h&quot;
</span><span class="cx"> #include &quot;WebContextMessages.h&quot;
</span><span class="cx"> #include &quot;WebCookieManager.h&quot;
</span><span class="lines">@@ -72,6 +73,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><ins>+#if ENABLE(NETWORK_PROCESS)
+static uint64_t legacySessionID(const NetworkStorageSession &amp;session)
+{
+    return session.isPrivateBrowsingSession() ? SessionTracker::legacyPrivateSessionID : SessionTracker::defaultSessionID;
+}
+#endif
+
</ins><span class="cx"> void WebPlatformStrategies::initialize()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;WebPlatformStrategies&gt; platformStrategies;
</span><span class="lines">@@ -133,7 +141,7 @@
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (WebProcess::shared().usesNetworkProcess()) {
</span><span class="cx">         String result;
</span><del>-        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
</del><ins>+        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
</ins><span class="cx">             return String();
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -146,7 +154,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (WebProcess::shared().usesNetworkProcess()) {
</span><del>-        WebProcess::shared().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(session.isPrivateBrowsingSession(), firstParty, url, cookieString), 0);
</del><ins>+        WebProcess::shared().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(legacySessionID(session), firstParty, url, cookieString), 0);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -159,7 +167,7 @@
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (WebProcess::shared().usesNetworkProcess()) {
</span><span class="cx">         bool result;
</span><del>-        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
</del><ins>+        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
</ins><span class="cx">             return false;
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -173,7 +181,7 @@
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (WebProcess::shared().usesNetworkProcess()) {
</span><span class="cx">         String result;
</span><del>-        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))
</del><ins>+        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))
</ins><span class="cx">             return String();
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -186,7 +194,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (WebProcess::shared().usesNetworkProcess()) {
</span><del>-        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
</del><ins>+        if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
</ins><span class="cx">             return false;
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="lines">@@ -199,7 +207,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">     if (WebProcess::shared().usesNetworkProcess()) {
</span><del>-        WebProcess::shared().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::DeleteCookie(session.isPrivateBrowsingSession(), url, cookieName), 0);
</del><ins>+        WebProcess::shared().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::DeleteCookie(legacySessionID(session), url, cookieName), 0);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebFrameNetworkingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -39,9 +39,9 @@
</span><span class="cx">         return adoptRef(new WebFrameNetworkingContext(frame));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static void setPrivateBrowsingStorageSessionIdentifierBase(const String&amp;);
-    static void ensurePrivateBrowsingSession();
-    static void destroyPrivateBrowsingSession();
</del><ins>+    // FIXME: remove platform-specific code and use SessionTracker
+    static void ensurePrivateBrowsingSession(uint64_t sessionID);
+
</ins><span class="cx">     static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy);
</span><span class="cx"> 
</span><span class="cx">     WebFrameLoaderClient* webFrameLoaderClient() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebFrameNetworkingContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -24,6 +24,8 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+
+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;WebCookieManager.h&quot;
</span><span class="cx"> #include &quot;WebFrameNetworkingContext.h&quot;
</span><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><span class="lines">@@ -34,54 +36,25 @@
</span><span class="cx"> #include &lt;WebCore/ResourceError.h&gt;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><span class="cx"> #include &lt;WebKitSystemInterface.h&gt;
</span><del>-#include &lt;wtf/NeverDestroyed.h&gt;
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><del>-
-static std::unique_ptr&lt;NetworkStorageSession&gt;&amp; privateSession()
-{
-    static NeverDestroyed&lt;std::unique_ptr&lt;NetworkStorageSession&gt;&gt; session;
-    return session;
-}
-
-static String&amp; identifierBase()
-{
-    static NeverDestroyed&lt;String&gt; base;
-    return base;
-}
</del><span class="cx">     
</span><del>-void WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(const String&amp; base)
</del><ins>+void WebFrameNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
-
-    identifierBase() = base;
-}
-
-void WebFrameNetworkingContext::ensurePrivateBrowsingSession()
-{
-    ASSERT(isMainThread());
-
-    if (privateSession())
</del><ins>+    if (SessionTracker::session(sessionID))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     String base;
</span><del>-    if (identifierBase().isNull())
</del><ins>+    if (SessionTracker::getIdentifierBase().isNull())
</ins><span class="cx">         base = [[NSBundle mainBundle] bundleIdentifier];
</span><span class="cx">     else
</span><del>-        base = identifierBase();
</del><ins>+        base = SessionTracker::getIdentifierBase();
</ins><span class="cx"> 
</span><del>-    privateSession() = NetworkStorageSession::createPrivateBrowsingSession(base);
</del><ins>+    SessionTracker::session(sessionID) = NetworkStorageSession::createPrivateBrowsingSession(base + '.' + String::number(sessionID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
-{
-    ASSERT(isMainThread());
-
-    privateSession() = nullptr;
-}
-
</del><span class="cx"> void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy policy)
</span><span class="cx"> {
</span><span class="cx">     [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast&lt;NSHTTPCookieAcceptPolicy&gt;(policy)];
</span><span class="lines">@@ -89,8 +62,10 @@
</span><span class="cx">     if (RetainPtr&lt;CFHTTPCookieStorageRef&gt; cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage())
</span><span class="cx">         WKSetHTTPCookieAcceptPolicy(cookieStorage.get(), policy);
</span><span class="cx"> 
</span><del>-    if (privateSession())
-        WKSetHTTPCookieAcceptPolicy(privateSession()-&gt;cookieStorage().get(), policy);
</del><ins>+    for (const auto&amp; session : SessionTracker::getSessionMap().values()) {
+        if (session)
+            WKSetHTTPCookieAcceptPolicy(session-&gt;cookieStorage().get(), policy);
+    }
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
</span><span class="lines">@@ -125,11 +100,10 @@
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx"> 
</span><span class="cx">     if (frame() &amp;&amp; frame()-&gt;settings().privateBrowsingEnabled())
</span><del>-        return *privateSession();
</del><ins>+        return *SessionTracker::session(SessionTracker::legacyPrivateSessionID);
</ins><span class="cx"> 
</span><span class="cx">     return NetworkStorageSession::defaultStorageSession();
</span><span class="cx"> }
</span><del>-    
</del><span class="cx"> WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
</span><span class="cx"> {
</span><span class="cx">     if (!frame())
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebFrameNetworkingContext.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="cx"> #include &quot;WebPage.h&quot;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><span class="lines">@@ -36,29 +37,16 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static std::unique_ptr&lt;NetworkStorageSession&gt;&amp; privateSession()
</del><ins>+void WebFrameNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><del>-    static NeverDestroyed&lt;std::unique_ptr&lt;NetworkStorageSession&gt;&gt; session;
-    return session;
-}
-
-void WebFrameNetworkingContext::ensurePrivateBrowsingSession()
-{
</del><span class="cx">     ASSERT(isMainThread());
</span><span class="cx"> 
</span><del>-    if (privateSession())
</del><ins>+    if (SessionTracker::session(sessionID))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    privateSession() = NetworkStorageSession::createPrivateBrowsingSession();
</del><ins>+    SessionTracker::session(sessionID) = NetworkStorageSession::createPrivateBrowsingSession(String::number(sessionID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
-{
-    ASSERT(isMainThread());
-
-    privateSession() = nullptr;
-}
-
</del><span class="cx"> WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame)
</span><span class="cx">     : FrameNetworkingContext(frame-&gt;coreFrame())
</span><span class="cx">     , m_initiatingPageID(0)
</span><span class="lines">@@ -70,7 +58,7 @@
</span><span class="cx"> NetworkStorageSession&amp; WebFrameNetworkingContext::storageSession() const
</span><span class="cx"> {
</span><span class="cx">     if (frame() &amp;&amp; frame()-&gt;settings().privateBrowsingEnabled())
</span><del>-        return *privateSession();
</del><ins>+        return *SessionTracker::session(SessionTracker::legacyPrivateSessionID);
</ins><span class="cx"> 
</span><span class="cx">     return NetworkStorageSession::defaultStorageSession();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportsoupWebFrameNetworkingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -42,8 +42,7 @@
</span><span class="cx">         return adoptRef(new WebFrameNetworkingContext(frame));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static void ensurePrivateBrowsingSession();
-    static void destroyPrivateBrowsingSession();
</del><ins>+    static void ensurePrivateBrowsingSession(uint64_t sessionID);
</ins><span class="cx"> 
</span><span class="cx">     WebFrameLoaderClient* webFrameLoaderClient() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;InjectedBundleUserMessageCoders.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;PluginProcessConnectionManager.h&quot;
</span><ins>+#include &quot;SessionTracker.h&quot;
</ins><span class="cx"> #include &quot;StatisticsData.h&quot;
</span><span class="cx"> #include &quot;UserData.h&quot;
</span><span class="cx"> #include &quot;WebApplicationCacheManager.h&quot;
</span><span class="lines">@@ -335,7 +336,7 @@
</span><span class="cx">         setShouldUseFontSmoothing(true);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK)
</span><del>-    WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);
</del><ins>+    SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (parameters.shouldUseTestingNetworkSession)
</span><span class="lines">@@ -452,17 +453,17 @@
</span><span class="cx">     m_fullKeyboardAccessEnabled = fullKeyboardAccessEnabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcess::ensurePrivateBrowsingSession()
</del><ins>+void WebProcess::ensurePrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
</span><del>-    WebFrameNetworkingContext::ensurePrivateBrowsingSession();
</del><ins>+    WebFrameNetworkingContext::ensurePrivateBrowsingSession(sessionID);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcess::destroyPrivateBrowsingSession()
</del><ins>+void WebProcess::destroyPrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP)
</span><del>-    WebFrameNetworkingContext::destroyPrivateBrowsingSession();
</del><ins>+    SessionTracker::destroySession(sessionID);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -165,9 +165,9 @@
</span><span class="cx"> 
</span><span class="cx">     void setCacheModel(uint32_t);
</span><span class="cx"> 
</span><del>-    void ensurePrivateBrowsingSession();
-    void destroyPrivateBrowsingSession();
-    
</del><ins>+    void ensurePrivateBrowsingSession(uint64_t sessionID);
+    void destroyPrivateBrowsingSession(uint64_t sessionID);
+
</ins><span class="cx">     void pageDidEnterWindow(uint64_t pageID);
</span><span class="cx">     void pageWillLeaveWindow(uint64_t pageID);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (162270 => 162271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in        2014-01-18 21:11:56 UTC (rev 162270)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in        2014-01-18 21:14:42 UTC (rev 162271)
</span><span class="lines">@@ -51,9 +51,9 @@
</span><span class="cx">     SetIgnoreTLSErrors(bool ignoreTLSErrors)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    // Private browsing session is per process. Individual pages or page groups may use the private session or the default one as appropriate.
-    EnsurePrivateBrowsingSession()
-    DestroyPrivateBrowsingSession()
</del><ins>+    // Legacy private browsing session is per process. Individual pages or page groups may use the private session or the default one as appropriate.
+    EnsurePrivateBrowsingSession(uint64_t sessionID)
+    DestroyPrivateBrowsingSession(uint64_t sessionID)
</ins><span class="cx"> 
</span><span class="cx">     # Plug-ins.
</span><span class="cx">     DidAddPlugInAutoStartOriginHash(uint32_t hash, double expirationTime)
</span></span></pre>
</div>
</div>

</body>
</html>