Replace SessionTracker with HashMap member of NetworkProcess
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 03:08:07 +0000 (03:08 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 03:08:07 +0000 (03:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193266

Reviewed by Joseph Pecoraro.

* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload):
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::resume):
* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::startPreflight):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::preconnectTo):
(WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
(WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
(WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::clearCachedCredentials):
(WebKit::NetworkProcess::networkSession):
(WebKit::NetworkProcess::setSession):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::preconnectTo):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::sendResultForCacheEntry):
(WebKit::NetworkResourceLoader::shouldLogCookieInformation):
(WebKit::NetworkResourceLoader::logCookieInformation const):
(WebKit::logBlockedCookieInformation):
(WebKit::logCookieInformationInternal):
(WebKit::NetworkResourceLoader::logCookieInformation):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::loadRequest):
* NetworkProcess/PingLoad.h:
* NetworkProcess/PreconnectTask.cpp:
(WebKit::PreconnectTask::PreconnectTask):
* NetworkProcess/PreconnectTask.h:
* NetworkProcess/RemoteNetworkingContext.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
* Shared/SessionTracker.cpp: Removed.
* Shared/SessionTracker.h: Removed.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPrivateBrowsingEnabled):
* WebProcess/Network/WebLoaderStrategy.cpp:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess):
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239815 268f45cc-cd09-0410-ab3c-d52691b4dbfc

39 files changed:
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Downloads/DownloadManager.cpp
Source/WebKit/NetworkProcess/Downloads/DownloadManager.h
Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm
Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/NetworkResourceLoader.h
Source/WebKit/NetworkProcess/PingLoad.cpp
Source/WebKit/NetworkProcess/PingLoad.h
Source/WebKit/NetworkProcess/PreconnectTask.cpp
Source/WebKit/NetworkProcess/PreconnectTask.h
Source/WebKit/NetworkProcess/RemoteNetworkingContext.h
Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp
Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
Source/WebKit/Shared/SessionTracker.cpp [deleted file]
Source/WebKit/Shared/SessionTracker.h [deleted file]
Source/WebKit/Sources.txt
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp
Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h
Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

index 3c526f1..b999447 100644 (file)
@@ -1,5 +1,74 @@
 2019-01-09  Alex Christensen  <achristensen@webkit.org>
 
+        Replace SessionTracker with HashMap member of NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=193266
+
+        Reviewed by Joseph Pecoraro.
+
+        * NetworkProcess/Downloads/DownloadManager.cpp:
+        (WebKit::DownloadManager::startDownload):
+        * NetworkProcess/Downloads/DownloadManager.h:
+        * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
+        (WebKit::Download::resume):
+        * NetworkProcess/NetworkCORSPreflightChecker.cpp:
+        (WebKit::NetworkCORSPreflightChecker::startPreflight):
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::preconnectTo):
+        (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
+        (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
+        (WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::clearCachedCredentials):
+        (WebKit::NetworkProcess::networkSession):
+        (WebKit::NetworkProcess::setSession):
+        (WebKit::NetworkProcess::destroySession):
+        (WebKit::NetworkProcess::preconnectTo):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::startNetworkLoad):
+        (WebKit::NetworkResourceLoader::didFinishLoading):
+        (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
+        (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
+        (WebKit::NetworkResourceLoader::logCookieInformation const):
+        (WebKit::logBlockedCookieInformation):
+        (WebKit::logCookieInformationInternal):
+        (WebKit::NetworkResourceLoader::logCookieInformation):
+        * NetworkProcess/NetworkResourceLoader.h:
+        * NetworkProcess/PingLoad.cpp:
+        (WebKit::PingLoad::loadRequest):
+        * NetworkProcess/PingLoad.h:
+        * NetworkProcess/PreconnectTask.cpp:
+        (WebKit::PreconnectTask::PreconnectTask):
+        * NetworkProcess/PreconnectTask.h:
+        * NetworkProcess/RemoteNetworkingContext.h:
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
+        (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        * NetworkProcess/mac/RemoteNetworkingContext.mm:
+        (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
+        * Shared/SessionTracker.cpp: Removed.
+        * Shared/SessionTracker.h: Removed.
+        * Sources.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess):
+        * WebProcess/WebProcess.h:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+
+2019-01-09  Alex Christensen  <achristensen@webkit.org>
+
         Expand use of sourceApplicationAuditData
         https://bugs.webkit.org/show_bug.cgi?id=192995
         <rdar://problem/46627875>
index ab9ff5f..41cec37 100644 (file)
@@ -31,7 +31,6 @@
 #include "NetworkLoad.h"
 #include "NetworkSession.h"
 #include "PendingDownload.h"
-#include "SessionTracker.h"
 #include <WebCore/NotImplemented.h>
 #include <pal/SessionID.h>
 #include <wtf/StdLibExtras.h>
@@ -46,7 +45,7 @@ DownloadManager::DownloadManager(Client& client)
 
 void DownloadManager::startDownload(NetworkConnectionToWebProcess* connection, PAL::SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
 {
-    auto* networkSession = SessionTracker::networkSession(sessionID);
+    auto* networkSession = client().networkSession(sessionID);
     if (!networkSession)
         return;
 
index ef08a5f..8a0ed49 100644 (file)
@@ -72,6 +72,7 @@ public:
         virtual IPC::Connection* parentProcessConnectionForDownloads() = 0;
         virtual AuthenticationManager& downloadsAuthenticationManager() = 0;
         virtual void pendingDownloadCanceled(DownloadID) = 0;
+        virtual NetworkSession* networkSession(const PAL::SessionID&) const = 0;
         virtual void ref() const = 0;
         virtual void deref() const = 0;
     };
index d30e479..1b9e3f2 100644 (file)
@@ -28,7 +28,6 @@
 
 #import "DataReference.h"
 #import "NetworkSessionCocoa.h"
-#import "SessionTracker.h"
 #import "WKDownloadProgress.h"
 #import <pal/spi/cf/CFNetworkSPI.h>
 #import <pal/spi/cocoa/NSProgressSPI.h>
@@ -41,7 +40,7 @@ void Download::resume(const IPC::DataReference& resumeData, const String& path,
     if (m_sandboxExtension)
         m_sandboxExtension->consume();
 
-    auto* networkSession = SessionTracker::networkSession(m_sessionID);
+    auto* networkSession = m_downloadManager.client().networkSession(m_sessionID);
     if (!networkSession) {
         WTFLogAlways("Could not find network session with given session ID");
         return;
index 1cc6235..bef8d06 100644 (file)
@@ -31,7 +31,6 @@
 #include "Logging.h"
 #include "NetworkLoadParameters.h"
 #include "NetworkProcess.h"
-#include "SessionTracker.h"
 #include <WebCore/CrossOriginAccessControl.h>
 
 #define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(m_parameters.sessionID.isAlwaysOnLoggingAllowed(), Network, "%p - NetworkCORSPreflightChecker::" fmt, this, ##__VA_ARGS__)
@@ -72,7 +71,7 @@ void NetworkCORSPreflightChecker::startPreflight()
     if (m_shouldCaptureExtraNetworkLoadMetrics)
         m_loadInformation = NetworkTransactionInformation { NetworkTransactionInformation::Type::Preflight, loadParameters.request, { }, { } };
 
-    if (auto* networkSession = SessionTracker::networkSession(loadParameters.sessionID)) {
+    if (auto* networkSession = m_networkProcess->networkSession(loadParameters.sessionID)) {
         m_task = NetworkDataTask::create(*networkSession, *this, WTFMove(loadParameters));
         m_task->resume();
     } else
index 4506b07..cc2f27b 100644 (file)
@@ -45,7 +45,6 @@
 #include "NetworkSocketStreamMessages.h"
 #include "PingLoad.h"
 #include "PreconnectTask.h"
-#include "SessionTracker.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
 #include "WebIDBConnectionToClient.h"
@@ -391,7 +390,7 @@ void NetworkConnectionToWebProcess::prefetchDNS(const String& hostname)
 void NetworkConnectionToWebProcess::preconnectTo(uint64_t preconnectionIdentifier, NetworkResourceLoadParameters&& parameters)
 {
 #if ENABLE(SERVER_PRECONNECT)
-    new PreconnectTask(WTFMove(parameters), [this, protectedThis = makeRef(*this), identifier = preconnectionIdentifier] (const ResourceError& error) {
+    new PreconnectTask(networkProcess(), WTFMove(parameters), [this, protectedThis = makeRef(*this), identifier = preconnectionIdentifier] (const ResourceError& error) {
         didFinishPreconnection(identifier, error);
     });
 #else
@@ -451,9 +450,9 @@ void NetworkConnectionToWebProcess::cookiesForDOM(PAL::SessionID sessionID, cons
     auto& networkStorageSession = storageSession(sessionID);
     std::tie(cookieString, secureCookiesAccessed) = networkStorageSession.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies);
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
-    if (auto session = SessionTracker::networkSession(sessionID)) {
+    if (auto session = networkProcess().networkSession(sessionID)) {
         if (session->shouldLogCookieInformation())
-            NetworkResourceLoader::logCookieInformation("NetworkConnectionToWebProcess::cookiesForDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, WTF::nullopt);
+            NetworkResourceLoader::logCookieInformation(*this, "NetworkConnectionToWebProcess::cookiesForDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, WTF::nullopt);
     }
 #endif
 }
@@ -463,9 +462,9 @@ void NetworkConnectionToWebProcess::setCookiesFromDOM(PAL::SessionID sessionID,
     auto& networkStorageSession = storageSession(sessionID);
     networkStorageSession.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString);
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
-    if (auto session = SessionTracker::networkSession(sessionID)) {
+    if (auto session = networkProcess().networkSession(sessionID)) {
         if (session->shouldLogCookieInformation())
-            NetworkResourceLoader::logCookieInformation("NetworkConnectionToWebProcess::setCookiesFromDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, WTF::nullopt);
+            NetworkResourceLoader::logCookieInformation(*this, "NetworkConnectionToWebProcess::setCookiesFromDOM", reinterpret_cast<const void*>(this), networkStorageSession, firstParty, sameSiteInfo, url, emptyString(), frameID, pageID, WTF::nullopt);
     }
 #endif
 }
@@ -555,6 +554,11 @@ void NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession()
     m_networkProcess->addWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
 }
 
+void NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession()
+{
+    m_networkProcess->destroySession(PAL::SessionID::legacyPrivateSessionID());
+}
+
 void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
 {
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
index e6119b1..fdf6a4c 100644 (file)
@@ -171,6 +171,7 @@ private:
     void destroySocketStream(uint64_t);
     
     void ensureLegacyPrivateBrowsingSession();
+    void destroyLegacyPrivateBrowsingSession();
 
 #if ENABLE(INDEXED_DATABASE)
     // Messages handlers (Modern IDB).
index 932b934..082685c 100644 (file)
@@ -55,6 +55,7 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     CreateSocketStream(URL url, PAL::SessionID sessionID, String cachePartition, uint64_t identifier)
 
     EnsureLegacyPrivateBrowsingSession()
+    DestroyLegacyPrivateBrowsingSession()
 
     RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
     RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
index 16f9f7d..36471de 100644 (file)
@@ -49,7 +49,6 @@
 #include "NetworkSessionCreationParameters.h"
 #include "PreconnectTask.h"
 #include "RemoteNetworkingContext.h"
-#include "SessionTracker.h"
 #include "StatisticsData.h"
 #include "WebCookieManager.h"
 #include "WebPageProxyMessages.h"
@@ -302,7 +301,7 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
         NetworkStorageSession::switchToNewTestingSession();
 
     auto sessionID = parameters.defaultDataStoreParameters.networkSessionParameters.sessionID;
-    SessionTracker::setSession(sessionID, NetworkSession::create(*this, WTFMove(parameters.defaultDataStoreParameters.networkSessionParameters)));
+    setSession(sessionID, NetworkSession::create(*this, WTFMove(parameters.defaultDataStoreParameters.networkSessionParameters)));
 
 #if ENABLE(INDEXED_DATABASE)
     addIndexedDatabaseSession(sessionID, parameters.defaultDataStoreParameters.indexedDatabaseDirectory, parameters.defaultDataStoreParameters.indexedDatabaseDirectoryExtensionHandle);
@@ -319,7 +318,7 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
     }
 #endif
 
-    auto* defaultSession = SessionTracker::networkSession(PAL::SessionID::defaultSessionID());
+    auto* defaultSession = networkSession(PAL::SessionID::defaultSessionID());
     for (const auto& cookie : parameters.defaultDataStoreParameters.pendingCookies)
         defaultSession->networkStorageSession().setCookie(cookie);
 
@@ -432,7 +431,7 @@ void NetworkProcess::createNetworkConnectionToWebProcess(bool isServiceWorkerPro
 void NetworkProcess::clearCachedCredentials()
 {
     NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
-    if (auto* networkSession = SessionTracker::networkSession(PAL::SessionID::defaultSessionID()))
+    if (auto* networkSession = this->networkSession(PAL::SessionID::defaultSessionID()))
         networkSession->clearCredentials();
     else
         ASSERT_NOT_REACHED();
@@ -452,9 +451,21 @@ void NetworkProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters
     RemoteNetworkingContext::ensureWebsiteDataStoreSession(*this, WTFMove(parameters));
 }
 
-void NetworkProcess::destroySession(PAL::SessionID sessionID)
+NetworkSession* NetworkProcess::networkSession(const PAL::SessionID& sessionID) const
 {
-    SessionTracker::destroySession(sessionID);
+    return m_networkSessions.get(sessionID);
+}
+
+void NetworkProcess::setSession(const PAL::SessionID& sessionID, Ref<NetworkSession>&& session)
+{
+    m_networkSessions.set(sessionID, WTFMove(session));
+}
+
+void NetworkProcess::destroySession(const PAL::SessionID& sessionID)
+{
+    if (auto session = m_networkSessions.take(sessionID))
+        session->get().invalidateAndCancel();
+    NetworkStorageSession::destroySession(sessionID);
     m_sessionsControlledByAutomation.remove(sessionID);
     CacheStorage::Engine::destroyEngine(*this, sessionID);
 
@@ -1033,7 +1044,7 @@ void NetworkProcess::preconnectTo(const URL& url, WebCore::StoredCredentialsPoli
     parameters.storedCredentialsPolicy = storedCredentialsPolicy;
     parameters.shouldPreconnectOnly = PreconnectOnly::Yes;
 
-    new PreconnectTask(WTFMove(parameters));
+    new PreconnectTask(*this, WTFMove(parameters));
 #else
     UNUSED_PARAM(url);
     UNUSED_PARAM(storedCredentialsPolicy);
index cec88ee..8627d91 100644 (file)
@@ -125,6 +125,10 @@ public:
 
     NetworkCache::Cache* cache() { return m_cache.get(); }
 
+    void setSession(const PAL::SessionID&, Ref<NetworkSession>&&);
+    NetworkSession* networkSession(const PAL::SessionID&) const override;
+    void destroySession(const PAL::SessionID&);
+    
     bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; }
 
     void processWillSuspendImminently(bool& handled);
@@ -265,7 +269,6 @@ private:
     void didReceiveSyncNetworkProcessMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
     void initializeNetworkProcess(NetworkProcessCreationParameters&&);
     void createNetworkConnectionToWebProcess(bool isServiceWorkerProcess, WebCore::SecurityOriginData&&);
-    void destroySession(PAL::SessionID);
 
     void fetchWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, uint64_t callbackID);
     void deleteWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, WallTime modifiedSince, uint64_t callbackID);
@@ -375,8 +378,8 @@ private:
     NetworkProcessSupplementMap m_supplements;
 
     HashSet<PAL::SessionID> m_sessionsControlledByAutomation;
-
     HashMap<PAL::SessionID, Vector<CacheStorageParametersCallback>> m_cacheStorageParametersCallbacks;
+    HashMap<PAL::SessionID, Ref<NetworkSession>> m_networkSessions;
 
 #if PLATFORM(COCOA)
     void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&);
index 7f8bda3..ba14093 100644 (file)
@@ -36,7 +36,6 @@
 #include "NetworkLoadChecker.h"
 #include "NetworkProcess.h"
 #include "NetworkProcessConnectionMessages.h"
-#include "SessionTracker.h"
 #include "SharedBufferDataReference.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
@@ -284,10 +283,10 @@ void NetworkResourceLoader::startNetworkLoad(ResourceRequest&& request, FirstLoa
     if (request.url().protocolIsBlob())
         parameters.blobFileReferences = NetworkBlobRegistry::singleton().filesInBlob(m_connection, originalRequest().url());
 
-    auto* networkSession = SessionTracker::networkSession(parameters.sessionID);
+    auto* networkSession = m_connection->networkProcess().networkSession(parameters.sessionID);
     if (!networkSession && parameters.sessionID.isEphemeral()) {
         m_connection->networkProcess().addWebsiteDataStore(WebsiteDataStoreParameters::privateSessionParameters(parameters.sessionID));
-        networkSession = SessionTracker::networkSession(parameters.sessionID);
+        networkSession = m_connection->networkProcess().networkSession(parameters.sessionID);
     }
     if (!networkSession) {
         WTFLogAlways("Attempted to create a NetworkLoad with a session (id=%" PRIu64 ") that does not exist.", parameters.sessionID.sessionID());
@@ -550,7 +549,7 @@ void NetworkResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLo
     }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
-    if (shouldLogCookieInformation(sessionID()))
+    if (shouldLogCookieInformation(m_connection, sessionID()))
         logCookieInformation();
 #endif
 
@@ -850,7 +849,7 @@ void NetworkResourceLoader::sendResultForCacheEntry(std::unique_ptr<NetworkCache
 #endif
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
-    if (shouldLogCookieInformation(sessionID()))
+    if (shouldLogCookieInformation(m_connection, sessionID()))
         logCookieInformation();
 #endif
 
@@ -949,9 +948,9 @@ bool NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics() const
 }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
-bool NetworkResourceLoader::shouldLogCookieInformation(const PAL::SessionID& sessionID)
+bool NetworkResourceLoader::shouldLogCookieInformation(NetworkConnectionToWebProcess& connection, const PAL::SessionID& sessionID)
 {
-    if (auto session = SessionTracker::networkSession(sessionID))
+    if (auto session = connection.networkProcess().networkSession(sessionID))
         return session->shouldLogCookieInformation();
     return false;
 }
@@ -968,17 +967,17 @@ static String escapeIDForJSON(const Optional<uint64_t>& value)
 
 void NetworkResourceLoader::logCookieInformation() const
 {
-    ASSERT(shouldLogCookieInformation(sessionID()));
+    ASSERT(shouldLogCookieInformation(m_connection, sessionID()));
 
     auto networkStorageSession = WebCore::NetworkStorageSession::storageSession(sessionID());
     ASSERT(networkStorageSession);
 
-    logCookieInformation("NetworkResourceLoader", reinterpret_cast<const void*>(this), *networkStorageSession, originalRequest().firstPartyForCookies(), SameSiteInfo::create(originalRequest()), originalRequest().url(), originalRequest().httpReferrer(), frameID(), pageID(), identifier());
+    logCookieInformation(m_connection, "NetworkResourceLoader", reinterpret_cast<const void*>(this), *networkStorageSession, originalRequest().firstPartyForCookies(), SameSiteInfo::create(originalRequest()), originalRequest().url(), originalRequest().httpReferrer(), frameID(), pageID(), identifier());
 }
 
-static void logBlockedCookieInformation(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier)
+static void logBlockedCookieInformation(NetworkConnectionToWebProcess& connection, const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier)
 {
-    ASSERT(NetworkResourceLoader::shouldLogCookieInformation(networkStorageSession.sessionID()));
+    ASSERT(NetworkResourceLoader::shouldLogCookieInformation(connection, networkStorageSession.sessionID()));
 
     auto escapedURL = escapeForJSON(url.string());
     auto escapedFirstParty = escapeForJSON(firstParty.string());
@@ -1003,9 +1002,9 @@ static void logBlockedCookieInformation(const String& label, const void* loggedO
 #undef LOCAL_LOG_IF_ALLOWED
 }
 
-static void logCookieInformationInternal(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier)
+static void logCookieInformationInternal(NetworkConnectionToWebProcess& connection, const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier)
 {
-    ASSERT(NetworkResourceLoader::shouldLogCookieInformation(networkStorageSession.sessionID()));
+    ASSERT(NetworkResourceLoader::shouldLogCookieInformation(connection, networkStorageSession.sessionID()));
 
     Vector<WebCore::Cookie> cookies;
     if (!networkStorageSession.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, cookies))
@@ -1064,14 +1063,14 @@ static void logCookieInformationInternal(const String& label, const void* logged
 #undef LOCAL_LOG_IF_ALLOWED
 }
 
-void NetworkResourceLoader::logCookieInformation(const String& label, const void* loggedObject, const NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier)
+void NetworkResourceLoader::logCookieInformation(NetworkConnectionToWebProcess& connection, const String& label, const void* loggedObject, const NetworkStorageSession& networkStorageSession, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier)
 {
-    ASSERT(shouldLogCookieInformation(networkStorageSession.sessionID()));
+    ASSERT(shouldLogCookieInformation(connection, networkStorageSession.sessionID()));
 
     if (networkStorageSession.shouldBlockCookies(firstParty, url, frameID, pageID))
-        logBlockedCookieInformation(label, loggedObject, networkStorageSession, firstParty, sameSiteInfo, url, referrer, frameID, pageID, identifier);
+        logBlockedCookieInformation(connection, label, loggedObject, networkStorageSession, firstParty, sameSiteInfo, url, referrer, frameID, pageID, identifier);
     else
-        logCookieInformationInternal(label, loggedObject, networkStorageSession, firstParty, sameSiteInfo, url, referrer, frameID, pageID, identifier);
+        logCookieInformationInternal(connection, label, loggedObject, networkStorageSession, firstParty, sameSiteInfo, url, referrer, frameID, pageID, identifier);
 }
 #endif
 
index c09ecb7..5598a26 100644 (file)
@@ -109,8 +109,8 @@ public:
     bool isAlwaysOnLoggingAllowed() const;
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
-    static bool shouldLogCookieInformation(const PAL::SessionID&);
-    static void logCookieInformation(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier);
+    static bool shouldLogCookieInformation(NetworkConnectionToWebProcess&, const PAL::SessionID&);
+    static void logCookieInformation(NetworkConnectionToWebProcess&, const String& label, const void* loggedObject, const WebCore::NetworkStorageSession&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, const String& referrer, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Optional<uint64_t> identifier);
 #endif
 
 private:
index ed61bae..f62a587 100644 (file)
@@ -30,7 +30,7 @@
 #include "AuthenticationManager.h"
 #include "Logging.h"
 #include "NetworkLoadChecker.h"
-#include "SessionTracker.h"
+#include "NetworkProcess.h"
 #include "WebErrors.h"
 
 #define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(m_parameters.sessionID.isAlwaysOnLoggingAllowed(), Network, "%p - PingLoad::" fmt, this, ##__VA_ARGS__)
@@ -56,7 +56,7 @@ PingLoad::PingLoad(NetworkProcess& networkProcess, NetworkResourceLoadParameters
     // Set a very generous timeout, just in case.
     m_timeoutTimer.startOneShot(60000_s);
 
-    m_networkLoadChecker->check(ResourceRequest { m_parameters.request }, nullptr, [this] (auto&& result) {
+    m_networkLoadChecker->check(ResourceRequest { m_parameters.request }, nullptr, [this, networkProcess = makeRef(networkProcess)] (auto&& result) {
         WTF::switchOn(result,
             [this] (ResourceError& error) {
                 this->didFinish(error);
@@ -65,8 +65,8 @@ PingLoad::PingLoad(NetworkProcess& networkProcess, NetworkResourceLoadParameters
                 // We should never send a synthetic redirect for PingLoads.
                 ASSERT_NOT_REACHED();
             },
-            [this] (ResourceRequest& request) {
-                this->loadRequest(WTFMove(request));
+            [&] (ResourceRequest& request) {
+                this->loadRequest(networkProcess, WTFMove(request));
             }
         );
     });
@@ -87,10 +87,10 @@ void PingLoad::didFinish(const ResourceError& error, const ResourceResponse& res
     delete this;
 }
 
-void PingLoad::loadRequest(ResourceRequest&& request)
+void PingLoad::loadRequest(NetworkProcess& networkProcess, ResourceRequest&& request)
 {
     RELEASE_LOG_IF_ALLOWED("startNetworkLoad");
-    if (auto* networkSession = SessionTracker::networkSession(m_parameters.sessionID)) {
+    if (auto* networkSession = networkProcess.networkSession(m_parameters.sessionID)) {
         auto loadParameters = m_parameters;
         loadParameters.request = WTFMove(request);
         m_task = NetworkDataTask::create(*networkSession, *this, WTFMove(loadParameters));
index b3f9bf2..c375d5e 100644 (file)
@@ -57,7 +57,7 @@ private:
     void cannotShowURL() final;
     void timeoutTimerFired();
 
-    void loadRequest(WebCore::ResourceRequest&&);
+    void loadRequest(NetworkProcess&, WebCore::ResourceRequest&&);
 
     void didFinish(const WebCore::ResourceError& = { }, const WebCore::ResourceResponse& response = { });
     
index 72b1758..a6e2993 100644 (file)
@@ -32,7 +32,6 @@
 #include "NetworkLoad.h"
 #include "NetworkLoadParameters.h"
 #include "NetworkProcess.h"
-#include "SessionTracker.h"
 #include "WebErrors.h"
 #include <WebCore/ResourceError.h>
 
@@ -40,13 +39,13 @@ namespace WebKit {
 
 using namespace WebCore;
 
-PreconnectTask::PreconnectTask(NetworkLoadParameters&& parameters, CompletionHandler<void(const ResourceError&)>&& completionHandler)
+PreconnectTask::PreconnectTask(NetworkProcess& networkProcess, NetworkLoadParameters&& parameters, CompletionHandler<void(const ResourceError&)>&& completionHandler)
     : m_completionHandler(WTFMove(completionHandler))
     , m_timeoutTimer([this] { didFinish(ResourceError { String(), 0, m_networkLoad->parameters().request.url(), "Preconnection timed out"_s, ResourceError::Type::Timeout }); })
 {
     RELEASE_LOG(Network, "%p - PreconnectTask::PreconnectTask()", this);
 
-    auto* networkSession = SessionTracker::networkSession(parameters.sessionID);
+    auto* networkSession = networkProcess.networkSession(parameters.sessionID);
     if (!networkSession) {
         ASSERT_NOT_REACHED();
         m_completionHandler(internalError(parameters.request.url()));
index e8d9242..5658a6e 100644 (file)
@@ -36,10 +36,11 @@ namespace WebKit {
 
 class NetworkLoad;
 class NetworkLoadParameters;
+class NetworkProcess;
 
 class PreconnectTask final : public NetworkLoadClient {
 public:
-    explicit PreconnectTask(NetworkLoadParameters&&, CompletionHandler<void(const WebCore::ResourceError&)>&& completionHandler = { });
+    explicit PreconnectTask(NetworkProcess&, NetworkLoadParameters&&, CompletionHandler<void(const WebCore::ResourceError&)>&& completionHandler = { });
     ~PreconnectTask();
 
 private:
index 61d1871..b455643 100644 (file)
@@ -35,7 +35,7 @@ struct WebsiteDataStoreParameters;
 
 class RemoteNetworkingContext {
 public:
-    // FIXME: Remove platform-specific code and use SessionTracker.
+    // FIXME: Remove platform-specific code.
     static void ensureWebsiteDataStoreSession(NetworkProcess&, WebsiteDataStoreParameters&&);
 };
 
index 7e7baf5..7afaf20 100644 (file)
@@ -31,8 +31,8 @@
 #include "Logging.h"
 #include "NetworkCache.h"
 #include "NetworkLoad.h"
+#include "NetworkProcess.h"
 #include "NetworkSession.h"
-#include "SessionTracker.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <pal/SessionID.h>
 #include <wtf/RunLoop.h>
@@ -60,7 +60,7 @@ SpeculativeLoad::SpeculativeLoad(Cache& cache, const GlobalFrameID& globalFrameI
     parameters.contentSniffingPolicy = ContentSniffingPolicy::DoNotSniffContent;
     parameters.contentEncodingSniffingPolicy = ContentEncodingSniffingPolicy::Sniff;
     parameters.request = m_originalRequest;
-    m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), *SessionTracker::networkSession(PAL::SessionID::defaultSessionID()));
+    m_networkLoad = std::make_unique<NetworkLoad>(*this, WTFMove(parameters), *cache.networkProcess().networkSession(PAL::SessionID::defaultSessionID()));
 }
 
 SpeculativeLoad::~SpeculativeLoad()
index a8b113b..f8ac20a 100644 (file)
@@ -34,7 +34,6 @@
 #import "NetworkProcess.h"
 #import "NetworkProximityManager.h"
 #import "NetworkSessionCocoa.h"
-#import "SessionTracker.h"
 #import "WebCoreArgumentCoders.h"
 #import <WebCore/AuthenticationChallenge.h>
 #import <WebCore/FileSystem.h>
index 12d4547..7f5928b 100644 (file)
@@ -34,7 +34,6 @@
 #import "NetworkResourceLoader.h"
 #import "NetworkSessionCocoa.h"
 #import "SandboxExtension.h"
-#import "SessionTracker.h"
 #import <WebCore/NetworkStorageSession.h>
 #import <WebCore/PublicSuffix.h>
 #import <WebCore/ResourceRequestCFNet.h>
index 36554d3..25a6451 100644 (file)
@@ -35,7 +35,6 @@
 #import "NetworkLoad.h"
 #import "NetworkProcess.h"
 #import "NetworkSessionCreationParameters.h"
-#import "SessionTracker.h"
 #import <Foundation/NSURLSession.h>
 #import <WebCore/Credential.h>
 #import <WebCore/FormDataStreamMac.h>
index c57f646..32c2d3e 100644 (file)
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "RemoteNetworkingContext.h"
 
+#include "NetworkProcess.h"
 #include "NetworkSession.h"
-#include "SessionTracker.h"
 #include "WebsiteDataStoreParameters.h"
 #include <WebCore/NetworkStorageSession.h>
 
@@ -42,7 +42,7 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& netw
         return;
 
     NetworkStorageSession::ensureSession(sessionID, String::number(sessionID.sessionID()));
-    SessionTracker::setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters)));
+    networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters)));
 }
 
 }
index 36cdfda..55aebec 100644 (file)
@@ -31,7 +31,6 @@
 #import "NetworkProcess.h"
 #import "NetworkSession.h"
 #import "NetworkSessionCreationParameters.h"
-#import "SessionTracker.h"
 #import "WebErrors.h"
 #import "WebsiteDataStoreParameters.h"
 #import <WebCore/NetworkStorageSession.h>
@@ -65,7 +64,7 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& netw
     for (const auto& cookie : parameters.pendingCookies)
         session->setCookie(cookie);
 
-    SessionTracker::setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters)));
+    networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters)));
 }
 
 }
index 25869c6..59ef32a 100644 (file)
@@ -29,7 +29,6 @@
 #include "RemoteNetworkingContext.h"
 
 #include "NetworkSession.h"
-#include "SessionTracker.h"
 #include "WebsiteDataStoreParameters.h"
 #include <WebCore/NetworkStorageSession.h>
 
@@ -43,7 +42,7 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& netw
         return;
 
     NetworkStorageSession::ensureSession(sessionID, String::number(sessionID.sessionID()));
-    SessionTracker::setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters)));
+    networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, WTFMove(parameters.networkSessionParameters)));
 }
 
 }
diff --git a/Source/WebKit/Shared/SessionTracker.cpp b/Source/WebKit/Shared/SessionTracker.cpp
deleted file mode 100644 (file)
index e2e84b7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 "config.h"
-#include "SessionTracker.h"
-
-#include "NetworkSession.h"
-#include <WebCore/NetworkStorageSession.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/RunLoop.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-static HashMap<PAL::SessionID, RefPtr<NetworkSession>>& staticSessionMap()
-{
-    ASSERT(RunLoop::isMain());
-
-    static NeverDestroyed<HashMap<PAL::SessionID, RefPtr<NetworkSession>>> map;
-    return map;
-}
-
-NetworkSession* SessionTracker::networkSession(PAL::SessionID sessionID)
-{
-    return staticSessionMap().get(sessionID);
-}
-
-void SessionTracker::setSession(PAL::SessionID sessionID, Ref<NetworkSession>&& session)
-{
-    staticSessionMap().set(sessionID, WTFMove(session));
-}
-
-void SessionTracker::destroySession(PAL::SessionID sessionID)
-{
-    ASSERT(RunLoop::isMain());
-    auto session = staticSessionMap().take(sessionID);
-    if (session)
-        session->invalidateAndCancel();
-    NetworkStorageSession::destroySession(sessionID);
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit/Shared/SessionTracker.h b/Source/WebKit/Shared/SessionTracker.h
deleted file mode 100644 (file)
index db1ba15..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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
-
-namespace WebCore {
-class NetworkStorageSession;
-}
-
-#include <pal/SessionID.h>
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-class NetworkSession;
-
-class SessionTracker {
-    WTF_MAKE_NONCOPYABLE(SessionTracker);
-public:
-    static void setSession(PAL::SessionID, Ref<NetworkSession>&&);
-    static NetworkSession* networkSession(PAL::SessionID);
-    static void destroySession(PAL::SessionID);
-};
-
-} // namespace WebKit
-
-#endif // SessionTracker_h
index f58001e..a0b6f72 100644 (file)
@@ -116,7 +116,6 @@ Shared/PrintInfo.cpp
 Shared/RTCNetwork.cpp
 Shared/RTCPacketOptions.cpp
 Shared/SessionState.cpp
-Shared/SessionTracker.cpp
 Shared/ShareableBitmap.cpp @no-unify
 Shared/ShareableResource.cpp
 Shared/SharedStringHashStore.cpp
index bfd11a5..e6ce243 100644 (file)
                6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h */; };
                6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; };
-               753E3E0E1887398900188496 /* SessionTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 753E3E091887394B00188496 /* SessionTracker.h */; };
                75A8D2C8187CCFAB00C39C9E /* WKWebsiteDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A8D2C4187CCF9F00C39C9E /* WKWebsiteDataStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
                75A8D2D6187D1C0E00C39C9E /* WKWebsiteDataStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A8D2D4187D1C0100C39C9E /* WKWebsiteDataStoreInternal.h */; };
                762B748D120BC75C00819339 /* WKPreferencesRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 762B7484120BBA2D00819339 /* WKPreferencesRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; };
                728E86EF1795188C0087879E /* WebColorPickerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPickerMac.h; sourceTree = "<group>"; };
                728E86F01795188C0087879E /* WebColorPickerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebColorPickerMac.mm; sourceTree = "<group>"; };
-               753E3E091887394B00188496 /* SessionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionTracker.h; sourceTree = "<group>"; };
-               753E3E0B1887397300188496 /* SessionTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionTracker.cpp; sourceTree = "<group>"; };
                75A8D2C4187CCF9F00C39C9E /* WKWebsiteDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStore.h; sourceTree = "<group>"; };
                75A8D2C5187CCF9F00C39C9E /* WKWebsiteDataStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebsiteDataStore.mm; sourceTree = "<group>"; };
                75A8D2D4187D1C0100C39C9E /* WKWebsiteDataStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStoreInternal.h; sourceTree = "<group>"; };
                                E1E552C316AE065E004ED653 /* SandboxInitializationParameters.h */,
                                1AFDE6571954A42B00C48FFA /* SessionState.cpp */,
                                1AFDE6581954A42B00C48FFA /* SessionState.h */,
-                               753E3E0B1887397300188496 /* SessionTracker.cpp */,
-                               753E3E091887394B00188496 /* SessionTracker.h */,
                                1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */,
                                1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */,
                                5121745E164C20E30037A5C1 /* ShareableResource.cpp */,
                                414DEDD71F9EDDE50047C40D /* ServiceWorkerProcessProxy.h in Headers */,
                                1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
                                1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
-                               753E3E0E1887398900188496 /* SessionTracker.h in Headers */,
                                1A6420E512DCE2FF00CAAE2C /* ShareableBitmap.h in Headers */,
                                51217461164C20E30037A5C1 /* ShareableResource.h in Headers */,
                                1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */,
index da8e339..44d82fa 100644 (file)
@@ -33,7 +33,6 @@
 #include "NetworkProcessConnection.h"
 #include "NetworkSessionCreationParameters.h"
 #include "NotificationPermissionRequestManager.h"
-#include "SessionTracker.h"
 #include "UserData.h"
 #include "WebConnectionToUIProcess.h"
 #include "WebCoreArgumentCoders.h"
@@ -355,10 +354,10 @@ void InjectedBundle::setJavaScriptCanAccessClipboard(WebPageGroupProxy* pageGrou
 void InjectedBundle::setPrivateBrowsingEnabled(WebPageGroupProxy* pageGroup, bool enabled)
 {
     ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
-    if (enabled) {
+    if (enabled)
         WebProcess::singleton().ensureLegacyPrivateBrowsingSessionInNetworkProcess();
-    else
-        SessionTracker::destroySession(PAL::SessionID::legacyPrivateSessionID());
+    else
+        WebProcess::singleton().destroyLegacyPrivateBrowsingSessionInNetworkProcess();
 
     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
     for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
index e0d0bfe..506d166 100644 (file)
@@ -32,7 +32,6 @@
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcessConnection.h"
 #include "NetworkResourceLoadParameters.h"
-#include "SessionTracker.h"
 #include "SharedBufferDataReference.h"
 #include "WebCompiledContentRuleList.h"
 #include "WebCoreArgumentCoders.h"
index db35b97..22d7641 100644 (file)
@@ -34,7 +34,6 @@
 #include "NetworkProcessConnection.h"
 #include "NetworkResourceLoadParameters.h"
 #include "PluginInfoStore.h"
-#include "SessionTracker.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
 #include "WebFrame.h"
index 735bdf3..2dbe46f 100644 (file)
@@ -27,7 +27,6 @@
 #include "WebFrameNetworkingContext.h"
 
 #include "NetworkSession.h"
-#include "SessionTracker.h"
 #include "WebFrame.h"
 #include "WebPage.h"
 #include "WebsiteDataStoreParameters.h"
index f1347ae..d3af838 100644 (file)
@@ -40,7 +40,7 @@ public:
         return adoptRef(*new WebFrameNetworkingContext(frame));
     }
 
-    // FIXME: remove platform-specific code and use SessionTracker
+    // FIXME: remove platform-specific code.
     static void ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&);
 
     WebFrameLoaderClient* webFrameLoaderClient() const;
index 7e3bd40..a35cc2e 100644 (file)
@@ -27,7 +27,6 @@
 #include "WebFrameNetworkingContext.h"
 
 #include "NetworkSession.h"
-#include "SessionTracker.h"
 #include "WebPage.h"
 #include "WebProcess.h"
 #include "WebsiteDataStoreParameters.h"
index 96a414e..94b6bb7 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "NetworkSession.h"
 #include "NetworkSessionCreationParameters.h"
-#include "SessionTracker.h"
 #include "WebFrame.h"
 #include "WebPage.h"
 #include "WebsiteDataStoreParameters.h"
index 6a8bfdd..25d6dfb 100644 (file)
@@ -58,7 +58,6 @@
 #include "RemoteWebInspectorUIMessages.h"
 #include "SessionState.h"
 #include "SessionStateConversion.h"
-#include "SessionTracker.h"
 #include "ShareSheetCallbackID.h"
 #include "ShareableBitmap.h"
 #include "SharedBufferDataReference.h"
index 714d09a..57bf9b0 100644 (file)
@@ -41,7 +41,6 @@
 #include "NetworkSession.h"
 #include "NetworkSessionCreationParameters.h"
 #include "PluginProcessConnectionManager.h"
-#include "SessionTracker.h"
 #include "StatisticsData.h"
 #include "UserData.h"
 #include "WebAutomationSessionProxy.h"
@@ -541,6 +540,11 @@ void WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess()
     ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::EnsureLegacyPrivateBrowsingSession(), 0);
 }
 
+void WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess()
+{
+    ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::DestroyLegacyPrivateBrowsingSession(), 0);
+}
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 PluginProcessConnectionManager& WebProcess::pluginProcessConnectionManager()
 {
index 8a85cdb..03e2f4a 100644 (file)
@@ -178,6 +178,7 @@ public:
     void setCacheModel(CacheModel);
 
     void ensureLegacyPrivateBrowsingSessionInNetworkProcess();
+    void destroyLegacyPrivateBrowsingSessionInNetworkProcess();
 
     void pageDidEnterWindow(uint64_t pageID);
     void pageWillLeaveWindow(uint64_t pageID);
index 58a54e0..a44681c 100644 (file)
@@ -33,7 +33,6 @@
 #import "ObjCObjectGraph.h"
 #import "SandboxExtension.h"
 #import "SandboxInitializationParameters.h"
-#import "SessionTracker.h"
 #import "WKAPICast.h"
 #import "WKBrowsingContextHandleInternal.h"
 #import "WKCrashReporter.h"