Changeset 163217 in webkit
- Timestamp:
- Jan 31, 2014 4:24:30 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r163212 r163217 1 2014-01-31 Martin Hock <mhock@apple.com> 2 3 Add session support to WebPlatformStrategies 4 https://bugs.webkit.org/show_bug.cgi?id=127926 5 6 Reviewed by Alexey Proskuryakov. 7 8 * NetworkProcess/mac/RemoteNetworkingContext.mm: 9 (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): 10 * Shared/SessionTracker.cpp: 11 (WebKit::storageSessionToID): 12 (WebKit::SessionTracker::session): 13 (WebKit::SessionTracker::sessionID): 14 (WebKit::SessionTracker::setSession): 15 (WebKit::SessionTracker::destroySession): 16 * Shared/SessionTracker.h: 17 * UIProcess/WebPageProxy.cpp: 18 (WebKit::WebPageProxy::setSession): 19 * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: 20 (WebKit::WebPlatformStrategies::cookiesForDOM): 21 (WebKit::WebPlatformStrategies::setCookiesFromDOM): 22 (WebKit::WebPlatformStrategies::cookiesEnabled): 23 (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): 24 (WebKit::WebPlatformStrategies::getRawCookies): 25 (WebKit::WebPlatformStrategies::deleteCookie): 26 * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: 27 (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession): 28 * WebProcess/WebPage/WebPage.cpp: 29 (WebKit::WebPage::setSessionID): Ensure the storage session exists. 30 * WebProcess/WebPage/WebPage.h: 31 1 32 2014-01-31 Alexey Proskuryakov <ap@apple.com> 2 33 -
trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm
r163150 r163217 80 80 void RemoteNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID) 81 81 { 82 ASSERT(SessionTracker::isEphemeralID(sessionID)); 83 82 84 if (SessionTracker::session(sessionID)) 83 85 return; -
trunk/Source/WebKit2/Shared/SessionTracker.cpp
r163150 r163217 45 45 } 46 46 47 static HashMap<const NetworkStorageSession*, uint64_t>& storageSessionToID() 48 { 49 ASSERT(isMainThread()); 50 51 static NeverDestroyed<HashMap<const NetworkStorageSession*, uint64_t>> map; 52 return map.get(); 53 } 54 47 55 static String& identifierBase() 48 56 { … … 67 75 if (sessionID == defaultSessionID) 68 76 return &NetworkStorageSession::defaultStorageSession(); 69 return staticSessionMap().add(sessionID, nullptr).iterator->value.get(); 77 return staticSessionMap().get(sessionID); 78 } 79 80 uint64_t SessionTracker::sessionID(const NetworkStorageSession& session) 81 { 82 if (&session == &NetworkStorageSession::defaultStorageSession()) 83 return defaultSessionID; 84 return storageSessionToID().get(&session); 70 85 } 71 86 … … 73 88 { 74 89 ASSERT(sessionID != defaultSessionID); 75 staticSessionMap().add(sessionID, nullptr).iterator->value = std::move(session); 90 storageSessionToID().set(session.get(), sessionID); 91 staticSessionMap().set(sessionID, std::move(session)); 76 92 } 77 93 … … 79 95 { 80 96 ASSERT(isMainThread()); 81 82 staticSessionMap().remove(sessionID); 97 if (staticSessionMap().contains(sessionID)) { 98 storageSessionToID().remove(session(sessionID)); 99 staticSessionMap().remove(sessionID); 100 } 83 101 } 84 102 -
trunk/Source/WebKit2/Shared/SessionTracker.h
r163150 r163217 44 44 static const String& getIdentifierBase(); 45 45 static WebCore::NetworkStorageSession* session(uint64_t sessionID); 46 static uint64_t sessionID(const WebCore::NetworkStorageSession&); 46 47 static void setSession(uint64_t sessionID, std::unique_ptr<WebCore::NetworkStorageSession>); 47 48 static void destroySession(uint64_t sessionID); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r163201 r163217 513 513 514 514 #if ENABLE(NETWORK_PROCESS) 515 m_process->context().sendToNetworkingProcess(Messages::NetworkProcess::EnsurePrivateBrowsingSession(session.getID())); 515 if (session.isEphemeral()) 516 m_process->context().sendToNetworkingProcess(Messages::NetworkProcess::EnsurePrivateBrowsingSession(session.getID())); 516 517 #endif 517 518 } -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
r163150 r163217 74 74 namespace WebKit { 75 75 76 #if ENABLE(NETWORK_PROCESS)77 static uint64_t legacySessionID(const NetworkStorageSession &session)78 {79 return session.isPrivateBrowsingSession() ? SessionTracker::legacyPrivateSessionID : SessionTracker::defaultSessionID;80 }81 #endif82 83 76 void WebPlatformStrategies::initialize() 84 77 { … … 142 135 if (WebProcess::shared().usesNetworkProcess()) { 143 136 String result; 144 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM( legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))137 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0)) 145 138 return String(); 146 139 return result; … … 155 148 #if ENABLE(NETWORK_PROCESS) 156 149 if (WebProcess::shared().usesNetworkProcess()) { 157 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM( legacySessionID(session), firstParty, url, cookieString), 0);150 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(SessionTracker::sessionID(session), firstParty, url, cookieString), 0); 158 151 return; 159 152 } … … 168 161 if (WebProcess::shared().usesNetworkProcess()) { 169 162 bool result; 170 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled( legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))163 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0)) 171 164 return false; 172 165 return result; … … 182 175 if (WebProcess::shared().usesNetworkProcess()) { 183 176 String result; 184 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue( legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))177 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0)) 185 178 return String(); 186 179 return result; … … 195 188 #if ENABLE(NETWORK_PROCESS) 196 189 if (WebProcess::shared().usesNetworkProcess()) { 197 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies( legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))190 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) 198 191 return false; 199 192 return true; … … 208 201 #if ENABLE(NETWORK_PROCESS) 209 202 if (WebProcess::shared().usesNetworkProcess()) { 210 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie( legacySessionID(session), url, cookieName), 0);203 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(SessionTracker::sessionID(session), url, cookieName), 0); 211 204 return; 212 205 } -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
r163150 r163217 45 45 void WebFrameNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID) 46 46 { 47 ASSERT(SessionTracker::isEphemeralID(sessionID)); 48 47 49 if (SessionTracker::session(sessionID)) 48 50 return; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r163150 r163217 2136 2136 } 2137 2137 2138 void WebPage::setSessionID(uint64_t sessionID) 2139 { 2140 m_sessionID = sessionID; 2141 if (SessionTracker::isEphemeralID(sessionID)) 2142 WebProcess::shared().ensurePrivateBrowsingSession(sessionID); 2143 } 2144 2138 2145 void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID) 2139 2146 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r163150 r163217 182 182 uint64_t pageID() const { return m_pageID; } 183 183 uint64_t sessionID() const; 184 void setSessionID(uint64_t sessionID) { m_sessionID = sessionID; }184 void setSessionID(uint64_t); 185 185 186 186 void setSize(const WebCore::IntSize&);
Note: See TracChangeset
for help on using the changeset viewer.