Changeset 242889 in webkit
- Timestamp:
- Mar 13, 2019, 10:48:47 AM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 11 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/SuspendedPageProxy.cpp (modified) (1 diff)
-
UIProcess/SuspendedPageProxy.h (modified) (3 diffs)
-
UIProcess/WebProcessCache.cpp (modified) (4 diffs)
-
UIProcess/WebProcessCache.h (modified) (3 diffs)
-
UIProcess/WebProcessPool.cpp (modified) (7 diffs)
-
UIProcess/WebProcessPool.h (modified) (3 diffs)
-
UIProcess/WebProcessProxy.cpp (modified) (4 diffs)
-
UIProcess/WebProcessProxy.h (modified) (4 diffs)
-
UIProcess/WebProcessProxy.messages.in (modified) (1 diff)
-
WebProcess/WebProcess.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r242847 r242889 1 2019-03-13 Chris Dumez <cdumez@apple.com> 2 3 Use new RegistrableDomain type in PSON code 4 https://bugs.webkit.org/show_bug.cgi?id=195634 5 6 Reviewed by Youenn Fablet. 7 8 Use new RegistrableDomain type in PSON code instead of more error-prone String type. 9 10 * UIProcess/SuspendedPageProxy.cpp: 11 (WebKit::SuspendedPageProxy::SuspendedPageProxy): 12 * UIProcess/SuspendedPageProxy.h: 13 * UIProcess/WebProcessCache.cpp: 14 (WebKit::WebProcessCache::canCacheProcess const): 15 (WebKit::WebProcessCache::addProcessIfPossible): 16 (WebKit::WebProcessCache::takeProcess): 17 (WebKit::WebProcessCache::clearAllProcessesForSession): 18 * UIProcess/WebProcessCache.h: 19 * UIProcess/WebProcessPool.cpp: 20 (WebKit::WebProcessPool::addProcessToOriginCacheSet): 21 (WebKit::WebProcessPool::removeProcessFromOriginCacheSet): 22 (WebKit::WebProcessPool::processForNavigationInternal): 23 (WebKit::WebProcessPool::findReusableSuspendedPageProcess): 24 (WebKit::WebProcessPool::didCollectPrewarmInformation): 25 (WebKit::WebProcessPool::tryPrewarmWithDomainInformation): 26 * UIProcess/WebProcessPool.h: 27 * UIProcess/WebProcessProxy.cpp: 28 (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const): 29 (WebKit::WebProcessProxy::maybeShutDown): 30 (WebKit::WebProcessProxy::didCollectPrewarmInformation): 31 (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): 32 * UIProcess/WebProcessProxy.h: 33 (WebKit::WebProcessProxy::registrableDomain const): 34 * UIProcess/WebProcessProxy.messages.in: 35 * WebProcess/WebProcess.cpp: 36 (WebKit::WebProcess::sendPrewarmInformation): 37 1 38 2019-03-13 Fujii Hironori <Hironori.Fujii@sony.com> 2 39 -
trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp
r242099 r242889 83 83 , m_process(WTFMove(process)) 84 84 , m_mainFrameID(mainFrameID) 85 , m_registrableDomain( toRegistrableDomain(URL(URL(), item.url())))85 , m_registrableDomain(URL(URL(), item.url())) 86 86 , m_suspensionTimeoutTimer(RunLoop::main(), this, &SuspendedPageProxy::suspensionTimedOut) 87 87 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h
r241855 r242889 30 30 #include "WebBackForwardListItem.h" 31 31 #include "WebPageProxyMessages.h" 32 #include <WebCore/ SecurityOriginData.h>32 #include <WebCore/RegistrableDomain.h> 33 33 #include <wtf/RefCounted.h> 34 34 #include <wtf/WeakPtr.h> … … 48 48 WebProcessProxy& process() { return m_process.get(); } 49 49 uint64_t mainFrameID() const { return m_mainFrameID; } 50 const String& registrableDomain() const { return m_registrableDomain; }50 const WebCore::RegistrableDomain& registrableDomain() const { return m_registrableDomain; } 51 51 52 52 bool failedToSuspend() const { return m_suspensionState == SuspensionState::FailedToSuspend; } … … 72 72 Ref<WebProcessProxy> m_process; 73 73 uint64_t m_mainFrameID; 74 Stringm_registrableDomain;74 WebCore::RegistrableDomain m_registrableDomain; 75 75 bool m_isClosed { false }; 76 76 -
trunk/Source/WebKit/UIProcess/WebProcessCache.cpp
r242726 r242889 56 56 return false; 57 57 58 if (process.registrableDomain().isEmpty()) { 59 RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::canCacheProcess(): Not caching process %i because it does not have an associated registrable domain", this, process.processIdentifier()); 60 return false; 61 } 62 58 63 if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) { 59 64 RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::canCacheProcess(): Not caching process %i because we are under memory pressure", this, process.processIdentifier()); … … 70 75 } 71 76 72 bool WebProcessCache::addProcessIfPossible(const String& registrableDomain, Ref<WebProcessProxy>&& process) 73 { 74 ASSERT(!registrableDomain.isEmpty()); 77 bool WebProcessCache::addProcessIfPossible(Ref<WebProcessProxy>&& process) 78 { 75 79 ASSERT(!process->pageCount()); 76 80 ASSERT(!process->provisionalPageCount()); … … 125 129 } 126 130 127 RefPtr<WebProcessProxy> WebProcessCache::takeProcess(const String& registrableDomain, WebsiteDataStore& dataStore)131 RefPtr<WebProcessProxy> WebProcessCache::takeProcess(const WebCore::RegistrableDomain& registrableDomain, WebsiteDataStore& dataStore) 128 132 { 129 133 auto it = m_processesPerRegistrableDomain.find(registrableDomain); … … 181 185 void WebProcessCache::clearAllProcessesForSession(PAL::SessionID sessionID) 182 186 { 183 Vector< String> keysToRemove;187 Vector<WebCore::RegistrableDomain> keysToRemove; 184 188 for (auto& pair : m_processesPerRegistrableDomain) { 185 189 if (pair.value->process().websiteDataStore().sessionID() == sessionID) { -
trunk/Source/WebKit/UIProcess/WebProcessCache.h
r242726 r242889 27 27 #pragma once 28 28 29 #include <WebCore/RegistrableDomain.h> 29 30 #include <pal/SessionID.h> 30 31 #include <wtf/HashMap.h> … … 43 44 explicit WebProcessCache(WebProcessPool&); 44 45 45 bool addProcessIfPossible( const String& registrableDomain,Ref<WebProcessProxy>&&);46 RefPtr<WebProcessProxy> takeProcess(const String& registrableDomain, WebsiteDataStore&);46 bool addProcessIfPossible(Ref<WebProcessProxy>&&); 47 RefPtr<WebProcessProxy> takeProcess(const WebCore::RegistrableDomain&, WebsiteDataStore&); 47 48 48 49 void updateCapacity(WebProcessPool&); … … 86 87 87 88 HashMap<uint64_t, std::unique_ptr<CachedProcess>> m_pendingAddRequests; 88 HashMap< String, std::unique_ptr<CachedProcess>> m_processesPerRegistrableDomain;89 HashMap<WebCore::RegistrableDomain, std::unique_ptr<CachedProcess>> m_processesPerRegistrableDomain; 89 90 RunLoop::Timer<WebProcessCache> m_evictionTimer; 90 91 }; -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r242807 r242889 2160 2160 void WebProcessPool::addProcessToOriginCacheSet(WebProcessProxy& process, const URL& url) 2161 2161 { 2162 auto registrableDomain = toRegistrableDomain(url);2162 auto registrableDomain = WebCore::RegistrableDomain { url }; 2163 2163 auto result = m_swappedProcessesPerRegistrableDomain.add(registrableDomain, &process); 2164 2164 if (!result.isNewEntry) 2165 2165 result.iterator->value = &process; 2166 2166 2167 LOG(ProcessSwapping, "(ProcessSwapping) Registrable domain %s just saved a cached process with pid %i", registrableDomain. utf8().data(), process.processIdentifier());2167 LOG(ProcessSwapping, "(ProcessSwapping) Registrable domain %s just saved a cached process with pid %i", registrableDomain.string().utf8().data(), process.processIdentifier()); 2168 2168 if (!result.isNewEntry) 2169 2169 LOG(ProcessSwapping, "(ProcessSwapping) Note: It already had one saved"); … … 2175 2175 2176 2176 // FIXME: This can be very inefficient as the number of remembered origins and processes grows 2177 Vector< String> registrableDomainsToRemove;2177 Vector<WebCore::RegistrableDomain> registrableDomainsToRemove; 2178 2178 for (auto entry : m_swappedProcessesPerRegistrableDomain) { 2179 2179 if (entry.value == &process) … … 2213 2213 { 2214 2214 auto& targetURL = navigation.currentRequest().url(); 2215 auto registrableDomain = toRegistrableDomain(targetURL);2215 auto registrableDomain = WebCore::RegistrableDomain { targetURL }; 2216 2216 2217 2217 auto createNewProcess = [this, protectedThis = makeRef(*this), page = makeRef(page), targetURL, registrableDomain, dataStore = dataStore.copyRef()] () -> Ref<WebProcessProxy> { … … 2307 2307 2308 2308 if (m_configuration->alwaysKeepAndReuseSwappedProcesses()) { 2309 LOG(ProcessSwapping, "(ProcessSwapping) Considering re-use of a previously cached process for domain %s", registrableDomain. utf8().data());2309 LOG(ProcessSwapping, "(ProcessSwapping) Considering re-use of a previously cached process for domain %s", registrableDomain.string().utf8().data()); 2310 2310 2311 2311 if (auto* process = m_swappedProcessesPerRegistrableDomain.get(registrableDomain)) { … … 2327 2327 } 2328 2328 2329 RefPtr<WebProcessProxy> WebProcessPool::findReusableSuspendedPageProcess(const String& registrableDomain, WebPageProxy& page, WebsiteDataStore& dataStore)2329 RefPtr<WebProcessProxy> WebProcessPool::findReusableSuspendedPageProcess(const WebCore::RegistrableDomain& registrableDomain, WebPageProxy& page, WebsiteDataStore& dataStore) 2330 2330 { 2331 2331 auto it = m_suspendedPages.findIf([&](auto& suspendedPage) { … … 2451 2451 } 2452 2452 2453 void WebProcessPool::didCollectPrewarmInformation(const String& registrableDomain, const WebCore::PrewarmInformation& prewarmInformation)2453 void WebProcessPool::didCollectPrewarmInformation(const WebCore::RegistrableDomain& registrableDomain, const WebCore::PrewarmInformation& prewarmInformation) 2454 2454 { 2455 2455 static const size_t maximumSizeToPreventUnlimitedGrowth = 100; … … 2466 2466 void WebProcessPool::tryPrewarmWithDomainInformation(WebProcessProxy& process, const URL& url) 2467 2467 { 2468 auto* prewarmInformation = m_prewarmInformationPerRegistrableDomain.get( toRegistrableDomain(url));2468 auto* prewarmInformation = m_prewarmInformationPerRegistrableDomain.get(RegistrableDomain { url }); 2469 2469 if (!prewarmInformation) 2470 2470 return; -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r242807 r242889 468 468 bool hasSuspendedPageFor(WebProcessProxy&, WebPageProxy&) const; 469 469 unsigned maxSuspendedPageCount() const { return m_maxSuspendedPageCount; } 470 RefPtr<WebProcessProxy> findReusableSuspendedPageProcess(const String&, WebPageProxy&, WebsiteDataStore&);470 RefPtr<WebProcessProxy> findReusableSuspendedPageProcess(const WebCore::RegistrableDomain&, WebPageProxy&, WebsiteDataStore&); 471 471 472 472 void clearSuspendedPages(AllowProcessCaching); … … 474 474 void didReachGoodTimeToPrewarm(WebsiteDataStore&); 475 475 476 void didCollectPrewarmInformation(const String& registrableDomain, const WebCore::PrewarmInformation&);476 void didCollectPrewarmInformation(const WebCore::RegistrableDomain&, const WebCore::PrewarmInformation&); 477 477 478 478 void screenPropertiesStateChanged(); … … 757 757 758 758 UniqueRef<WebProcessCache> m_webProcessCache; 759 HashMap< String, RefPtr<WebProcessProxy>> m_swappedProcessesPerRegistrableDomain;760 761 HashMap< String, std::unique_ptr<WebCore::PrewarmInformation>> m_prewarmInformationPerRegistrableDomain;759 HashMap<WebCore::RegistrableDomain, RefPtr<WebProcessProxy>> m_swappedProcessesPerRegistrableDomain; 760 761 HashMap<WebCore::RegistrableDomain, std::unique_ptr<WebCore::PrewarmInformation>> m_prewarmInformationPerRegistrableDomain; 762 762 763 763 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r242726 r242889 835 835 bool WebProcessProxy::canBeAddedToWebProcessCache() const 836 836 { 837 if (registrableDomain().isEmpty())838 return false;839 840 837 if (isServiceWorkerProcess()) 841 838 return false; … … 852 849 return; 853 850 854 if (allowProcessCaching == AllowProcessCaching::Yes && canBeAddedToWebProcessCache() && processPool().webProcessCache().addProcessIfPossible( registrableDomain(),*this))851 if (allowProcessCaching == AllowProcessCaching::Yes && canBeAddedToWebProcessCache() && processPool().webProcessCache().addProcessIfPossible(*this)) 855 852 return; 856 853 … … 1416 1413 } 1417 1414 1418 void WebProcessProxy::didCollectPrewarmInformation(const String& domain, const WebCore::PrewarmInformation& prewarmInformation)1415 void WebProcessProxy::didCollectPrewarmInformation(const WebCore::RegistrableDomain& domain, const WebCore::PrewarmInformation& prewarmInformation) 1419 1416 { 1420 1417 processPool().didCollectPrewarmInformation(domain, prewarmInformation); … … 1431 1428 1432 1429 // This process has been used for several registrable domains already. 1433 if (m_registrableDomain && m_registrableDomain->is Null())1434 return; 1435 1436 auto registrableDomain = toRegistrableDomain(url);1430 if (m_registrableDomain && m_registrableDomain->isEmpty()) 1431 return; 1432 1433 auto registrableDomain = WebCore::RegistrableDomain { url }; 1437 1434 if (m_registrableDomain && *m_registrableDomain != registrableDomain) { 1438 1435 // Null out registrable domain since this process has now been used for several domains. 1439 m_registrableDomain = String();1436 m_registrableDomain = WebCore::RegistrableDomain { }; 1440 1437 return; 1441 1438 } -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r242400 r242889 42 42 #include <WebCore/MessagePortIdentifier.h> 43 43 #include <WebCore/ProcessIdentifier.h> 44 #include <WebCore/RegistrableDomain.h> 44 45 #include <WebCore/SharedStringHash.h> 45 46 #include <memory> … … 115 116 WebProcessPool& processPool() const { ASSERT(m_processPool); return *m_processPool.get(); } 116 117 117 String registrableDomain() const { return m_registrableDomain.valueOr(String()); }118 WebCore::RegistrableDomain registrableDomain() const { return m_registrableDomain.valueOr(WebCore::RegistrableDomain { }); } 118 119 void setIsInProcessCache(bool); 119 120 bool isInProcessCache() const { return m_isInProcessCache; } … … 372 373 bool canTerminateAuxiliaryProcess(); 373 374 374 void didCollectPrewarmInformation(const String& domain, const WebCore::PrewarmInformation&);375 void didCollectPrewarmInformation(const WebCore::RegistrableDomain&, const WebCore::PrewarmInformation&); 375 376 376 377 void logDiagnosticMessageForResourceLimitTermination(const String& limitKey); … … 435 436 HashMap<String, uint64_t> m_pageURLRetainCountMap; 436 437 437 Optional< String> m_registrableDomain;438 Optional<WebCore::RegistrableDomain> m_registrableDomain; 438 439 bool m_isInProcessCache { false }; 439 440 -
trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in
r241778 r242889 65 65 DidCheckProcessLocalPortForActivity(uint64_t callbackIdentifier, bool isLocallyReachable) 66 66 67 DidCollectPrewarmInformation( Stringdomain, struct WebCore::PrewarmInformation prewarmInformation)67 DidCollectPrewarmInformation(WebCore::RegistrableDomain domain, struct WebCore::PrewarmInformation prewarmInformation) 68 68 69 69 #if PLATFORM(COCOA) -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r242748 r242889 1576 1576 void WebProcess::sendPrewarmInformation(const URL& url) 1577 1577 { 1578 auto registrableDomain = toRegistrableDomain(url);1578 auto registrableDomain = WebCore::RegistrableDomain { url }; 1579 1579 if (registrableDomain.isEmpty()) 1580 1580 return;
Note:
See TracChangeset
for help on using the changeset viewer.