WebKit Bugzilla
Attachment 360025 Details for
Bug 193297
: Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193297-20190124122216.patch (text/plain), 37.85 KB, created by
Brent Fulgham
on 2019-01-24 12:22:16 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2019-01-24 12:22:16 PST
Size:
37.85 KB
patch
obsolete
>Subversion Revision: 240360 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 31aadd832dcae95fcbcbfea27fe4a7c474c2d45b..a779ea3f6870840fa89dc9fb7289dfbae158d2a3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-23 Brent Fulgham <bfulgham@apple.com> >+ >+ Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess. >+ https://bugs.webkit.org/show_bug.cgi?id=193297 >+ <rdar://problem/47158841> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Trigger logging to the UIProcess when the ResourceLoadObserver is used in the NetworkProcess. >+ >+ * Modules/websockets/WebSocket.cpp: >+ (WebCore::WebSocket::connect): Notify NetworkProcess a connection was made to a resource. >+ * loader/ResourceLoadObserver.cpp: >+ (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback): Added. >+ (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback): Added. >+ (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback): Added. >+ (WebCore::ResourceLoadObserver::logSubresourceLoading): Notify NetworkProcess of the load. >+ (WebCore::ResourceLoadObserver::logWebSocketLoading): Ditto. >+ (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): Ditto. >+ > 2019-01-23 Sihui Liu <sihui_liu@apple.com> > > Clean up IndexedDB files between tests >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 2c5357da86c6d2566edb2fdec5ad3986c30d4d13..1d3e05d748c897b8622e355481b2c25a3bc3a53e 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,45 @@ >+2019-01-23 Brent Fulgham <bfulgham@apple.com> >+ >+ Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess. >+ https://bugs.webkit.org/show_bug.cgi?id=193297 >+ <rdar://problem/47158841> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns >+ it off in the UIProcess. It also updates test infrastructure to work with this change >+ in architecture. >+ >+ * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: >+ (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added. >+ (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added. >+ (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added. >+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added. >+ (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added. >+ (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added. >+ (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess): >+ (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap): >+ (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted. >+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: >+ * NetworkProcess/NetworkConnectionToWebProcess.cpp: >+ (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added. >+ (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added. >+ (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added. >+ * NetworkProcess/NetworkConnectionToWebProcess.messages.in: >+ * NetworkProcess/NetworkSession.cpp: >+ (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::ensureNetworkProcess): >+ * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: >+ (WebKit::WebsiteDataStore::parameters): >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::removeData): >+ (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): >+ (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): >+ * Webprocess/WebProcess.cpp: >+ (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks. >+ > 2019-01-23 Brent Fulgham <bfulgham@apple.com> > > Switch NetworkStorageSession portions of ResourceLoadStatistics to Async message passing style >diff --git a/Source/WebCore/Modules/websockets/WebSocket.cpp b/Source/WebCore/Modules/websockets/WebSocket.cpp >index 5027db6f3530f71abc6386913779e18826cbc1c8..ac9cf79952313207dba0872ab22d1bbc0a430965 100644 >--- a/Source/WebCore/Modules/websockets/WebSocket.cpp >+++ b/Source/WebCore/Modules/websockets/WebSocket.cpp >@@ -279,8 +279,8 @@ ExceptionOr<void> WebSocket::connect(const String& url, const Vector<String>& pr > } > } > >- RunLoop::main().dispatch([targetURL = m_url.isolatedCopy(), mainFrameURL = context.url().isolatedCopy(), usesEphemeralSession = context.sessionID().isEphemeral()]() { >- ResourceLoadObserver::shared().logWebSocketLoading(targetURL, mainFrameURL, usesEphemeralSession); >+ RunLoop::main().dispatch([targetURL = m_url.isolatedCopy(), mainFrameURL = context.url().isolatedCopy(), sessionID = context.sessionID()]() { >+ ResourceLoadObserver::shared().logWebSocketLoading(targetURL, mainFrameURL, sessionID); > }); > > if (is<Document>(context)) { >diff --git a/Source/WebCore/loader/ResourceLoadObserver.cpp b/Source/WebCore/loader/ResourceLoadObserver.cpp >index c3ad1b0d667917b89f4e62a4bf437b9913ab399a..7676151b9e7853fdf22c0755eb6cf21bf3f916e9 100644 >--- a/Source/WebCore/loader/ResourceLoadObserver.cpp >+++ b/Source/WebCore/loader/ResourceLoadObserver.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016-2018 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -75,6 +75,24 @@ void ResourceLoadObserver::setLogUserInteractionNotificationCallback(Function<vo > m_logUserInteractionNotificationCallback = WTFMove(callback); > } > >+void ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback(WTF::Function<void(PAL::SessionID, const String&, const String&, WallTime)>&& callback) >+{ >+ ASSERT(!m_logWebSocketLoadingNotificationCallback); >+ m_logWebSocketLoadingNotificationCallback = WTFMove(callback); >+} >+ >+void ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback(WTF::Function<void(PAL::SessionID, const String&, const String&, WallTime)>&& callback) >+{ >+ ASSERT(!m_logSubresourceLoadingNotificationCallback); >+ m_logSubresourceLoadingNotificationCallback = WTFMove(callback); >+} >+ >+void ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback(WTF::Function<void(PAL::SessionID, const String&, const String&)>&& callback) >+{ >+ ASSERT(!m_logSubresourceRedirectNotificationCallback); >+ m_logSubresourceRedirectNotificationCallback = WTFMove(callback); >+} >+ > ResourceLoadObserver::ResourceLoadObserver() > : m_notificationTimer(*this, &ResourceLoadObserver::notifyObserver) > { >@@ -122,9 +140,12 @@ void ResourceLoadObserver::logSubresourceLoading(const Frame* frame, const Resou > bool shouldCallNotificationCallback = false; > { > auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); >- targetStatistics.lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now()); >+ auto lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now()); >+ targetStatistics.lastSeen = lastSeen; > if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) > shouldCallNotificationCallback = true; >+ >+ m_logSubresourceLoadingNotificationCallback(page->sessionID(), targetPrimaryDomain, mainFramePrimaryDomain, lastSeen); > } > > if (isRedirect) { >@@ -135,15 +156,17 @@ void ResourceLoadObserver::logSubresourceLoading(const Frame* frame, const Resou > > if (isNewRedirectToEntry || isNewRedirectFromEntry) > shouldCallNotificationCallback = true; >+ >+ m_logSubresourceRedirectNotificationCallback(page->sessionID(), sourcePrimaryDomain, targetPrimaryDomain); > } > > if (shouldCallNotificationCallback) > scheduleNotificationIfNeeded(); > } > >-void ResourceLoadObserver::logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL, bool usesEphemeralSession) >+void ResourceLoadObserver::logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL, PAL::SessionID sessionID) > { >- if (!shouldLog(usesEphemeralSession)) >+ if (!shouldLog(sessionID.isEphemeral())) > return; > > auto targetHost = targetURL.host(); >@@ -158,10 +181,14 @@ void ResourceLoadObserver::logWebSocketLoading(const URL& targetURL, const URL& > if (targetPrimaryDomain == mainFramePrimaryDomain) > return; > >+ auto lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now()); >+ > auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); >- targetStatistics.lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now()); >+ targetStatistics.lastSeen = lastSeen; > if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) > scheduleNotificationIfNeeded(); >+ >+ m_logWebSocketLoadingNotificationCallback(sessionID, targetPrimaryDomain, mainFramePrimaryDomain, lastSeen); > } > > void ResourceLoadObserver::logUserInteractionWithReducedTimeResolution(const Document& document) >@@ -197,8 +224,7 @@ void ResourceLoadObserver::logUserInteractionWithReducedTimeResolution(const Doc > } > } > >- // FIXME(193297): Uncomment this line when ResourceLoadStatistics are no longer gathered in the UI Process. >- // m_logUserInteractionNotificationCallback(document.sessionID(), domain); >+ m_logUserInteractionNotificationCallback(document.sessionID(), domain); > #endif > > m_notificationTimer.stop(); >diff --git a/Source/WebCore/loader/ResourceLoadObserver.h b/Source/WebCore/loader/ResourceLoadObserver.h >index a44f28c4f9fd7973b5b0fe204879b2a17931926b..432372cdff91100ea2d0787e3d5572b3f0c16803 100644 >--- a/Source/WebCore/loader/ResourceLoadObserver.h >+++ b/Source/WebCore/loader/ResourceLoadObserver.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -60,7 +60,7 @@ public: > WEBCORE_EXPORT static ResourceLoadObserver& shared(); > > void logSubresourceLoading(const Frame*, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse); >- void logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL, bool usesEphemeralSession); >+ void logWebSocketLoading(const URL& targetURL, const URL& mainFrameURL, PAL::SessionID); > void logUserInteractionWithReducedTimeResolution(const Document&); > > void logFontLoad(const Document&, const String& familyName, bool loadStatus); >@@ -74,6 +74,9 @@ public: > WEBCORE_EXPORT void setNotificationCallback(WTF::Function<void (Vector<ResourceLoadStatistics>&&)>&&); > WEBCORE_EXPORT void setRequestStorageAccessUnderOpenerCallback(WTF::Function<void(const String&, uint64_t, const String&)>&&); > WEBCORE_EXPORT void setLogUserInteractionNotificationCallback(WTF::Function<void(PAL::SessionID, const String&)>&&); >+ WEBCORE_EXPORT void setLogWebSocketLoadingNotificationCallback(WTF::Function<void(PAL::SessionID, const String&, const String&, WallTime)>&&); >+ WEBCORE_EXPORT void setLogSubresourceLoadingNotificationCallback(WTF::Function<void(PAL::SessionID, const String&, const String&, WallTime)>&&); >+ WEBCORE_EXPORT void setLogSubresourceRedirectNotificationCallback(WTF::Function<void(PAL::SessionID, const String&, const String&)>&&); > > WEBCORE_EXPORT void notifyObserver(); > WEBCORE_EXPORT void clearState(); >@@ -98,9 +101,13 @@ private: > > HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap; > HashMap<String, WTF::WallTime> m_lastReportedUserInteractionMap; >- WTF::Function<void (Vector<ResourceLoadStatistics>&&)> m_notificationCallback; >+ WTF::Function<void(Vector<ResourceLoadStatistics>&&)> m_notificationCallback; > WTF::Function<void(const String&, uint64_t, const String&)> m_requestStorageAccessUnderOpenerCallback; > WTF::Function<void(PAL::SessionID, const String&)> m_logUserInteractionNotificationCallback; >+ WTF::Function<void(PAL::SessionID, const String&, const String&, WallTime)> m_logWebSocketLoadingNotificationCallback; >+ WTF::Function<void(PAL::SessionID, const String&, const String&, WallTime)> m_logSubresourceLoadingNotificationCallback; >+ WTF::Function<void(PAL::SessionID, const String&, const String&)> m_logSubresourceRedirectNotificationCallback; >+ > Timer m_notificationTimer; > #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED > uint64_t m_loggingCounter { 0 }; >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp >index 9744d48345c1853f8ac605371814c7abe352ea47..92d92e25fc7af9dbfc6be136410830bff5e71483 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp >@@ -638,6 +638,33 @@ void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const String& targetP > scheduleStatisticsProcessingRequestIfNecessary(); > } > >+void ResourceLoadStatisticsMemoryStore::logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) >+{ >+ auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); >+ targetStatistics.lastSeen = lastSeen; >+ if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) >+ scheduleStatisticsProcessingRequestIfNecessary(); >+} >+ >+void ResourceLoadStatisticsMemoryStore::logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) >+{ >+ auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); >+ targetStatistics.lastSeen = lastSeen; >+ if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry) >+ scheduleStatisticsProcessingRequestIfNecessary(); >+} >+ >+void ResourceLoadStatisticsMemoryStore::logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain) >+{ >+ auto& redirectingOriginStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain); >+ bool isNewRedirectToEntry = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetPrimaryDomain).isNewEntry; >+ auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain); >+ bool isNewRedirectFromEntry = targetStatistics.subresourceUniqueRedirectsFrom.add(sourcePrimaryDomain).isNewEntry; >+ >+ if (isNewRedirectToEntry || isNewRedirectFromEntry) >+ scheduleStatisticsProcessingRequestIfNecessary(); >+} >+ > void ResourceLoadStatisticsMemoryStore::logUserInteraction(const String& primaryDomain) > { > ASSERT(!RunLoop::isMain()); >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h >index 2cf7a153561482d8b49b2a37f08d93eacc2084fa..e771e0e157f9b98b1f0af32261305cde36f68249 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h >@@ -124,6 +124,9 @@ public: > > void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame); > void logUserInteraction(const String& primaryDomain); >+ void logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen); >+ void logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen); >+ void logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain); > > void clearUserInteraction(const String& primaryDomain); > bool hasHadUserInteraction(const String& primaryDomain); >diff --git a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp >index e2c97540cc8d24d35d844902f28abba250a78066..78b379a14ef33e809fdb32c5fe215fb4a2bac777 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp >@@ -417,12 +417,6 @@ void WebResourceLoadStatisticsStore::didCreateNetworkProcess() > }); > } > >-void WebResourceLoadStatisticsStore::removeAllStorageAccess() >-{ >- if (m_networkSession) >- m_networkSession->networkStorageSession().removeAllStorageAccess(); >-} >- > void WebResourceLoadStatisticsStore::removeAllStorageAccess(CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >@@ -431,7 +425,10 @@ void WebResourceLoadStatisticsStore::removeAllStorageAccess(CompletionHandler<vo > m_websiteDataStore->removeAllStorageAccessHandler(WTFMove(completionHandler)); > return; > } >- removeAllStorageAccess(); >+ >+ if (m_networkSession) >+ m_networkSession->networkStorageSession().removeAllStorageAccess(); >+ > completionHandler(); > } > >@@ -504,6 +501,36 @@ void WebResourceLoadStatisticsStore::logFrameNavigation(const String& targetPrim > }); > } > >+void WebResourceLoadStatisticsStore::logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler) >+{ >+ postTask([this, targetPrimaryDomain = targetPrimaryDomain.isolatedCopy(), mainFramePrimaryDomain = mainFramePrimaryDomain.isolatedCopy(), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable { >+ if (m_memoryStore) >+ m_memoryStore->logWebSocketLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen); >+ >+ postTaskReply(WTFMove(completionHandler)); >+ }); >+} >+ >+void WebResourceLoadStatisticsStore::logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler) >+{ >+ postTask([this, targetPrimaryDomain = targetPrimaryDomain.isolatedCopy(), mainFramePrimaryDomain = mainFramePrimaryDomain.isolatedCopy(), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable { >+ if (m_memoryStore) >+ m_memoryStore->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen); >+ >+ postTaskReply(WTFMove(completionHandler)); >+ }); >+} >+ >+void WebResourceLoadStatisticsStore::logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler) >+{ >+ postTask([this, sourcePrimaryDomain = sourcePrimaryDomain.isolatedCopy(), targetPrimaryDomain = targetPrimaryDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { >+ if (m_memoryStore) >+ m_memoryStore->logSubresourceRedirect(sourcePrimaryDomain, targetPrimaryDomain); >+ >+ postTaskReply(WTFMove(completionHandler)); >+ }); >+} >+ > void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >@@ -1080,12 +1107,6 @@ void WebResourceLoadStatisticsStore::setGrandfatheringTime(Seconds seconds, Comp > }); > } > >-void WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources(Seconds seconds) >-{ >- if (m_networkSession) >- m_networkSession->networkStorageSession().setCacheMaxAgeCapForPrevalentResources(seconds); >-} >- > void WebResourceLoadStatisticsStore::setCacheMaxAgeCap(Seconds seconds, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >@@ -1095,7 +1116,10 @@ void WebResourceLoadStatisticsStore::setCacheMaxAgeCap(Seconds seconds, Completi > m_websiteDataStore->setCacheMaxAgeCapForPrevalentResources(seconds, WTFMove(completionHandler)); > return; > } >- setCacheMaxAgeCapForPrevalentResources(seconds); >+ >+ if (m_networkSession) >+ m_networkSession->networkStorageSession().setCacheMaxAgeCapForPrevalentResources(seconds); >+ > completionHandler(); > } > >diff --git a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h >index b60aaac890ef3037e2fac7f16b87ebd804dd84e4..a3fa4b4cb903f6fc1957d2e1fcb283d0b2c71b48 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h >@@ -91,6 +91,9 @@ public: > void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame); > void logUserInteraction(const URL&, CompletionHandler<void()>&&); > void logUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&&); >+ void logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&&); >+ void logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&&); >+ void logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain, CompletionHandler<void()>&&); > void clearUserInteraction(const URL&, CompletionHandler<void()>&&); > void clearUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&&); > void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&); >@@ -124,9 +127,7 @@ public: > void setGrandfathered(const String&, bool, CompletionHandler<void()>&&); > void isGrandfathered(const URL&, CompletionHandler<void(bool)>&&); > void isGrandfathered(const String&, CompletionHandler<void(bool)>&&); >- void removeAllStorageAccess(); > void removePrevalentDomains(const Vector<String>& domainsToBlock); >- void setCacheMaxAgeCapForPrevalentResources(Seconds); > void setNotifyPagesWhenDataRecordsWereScanned(bool, CompletionHandler<void()>&&); > void setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame, CompletionHandler<void()>&&); > void setSubframeUnderTopFrameOrigin(const String& subframe, const String& topFrame, CompletionHandler<void()>&&); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >index e634147debae13177721d71561db20658275aa0c..4924ce9ceeeaaea632a613338c01e8daa458d0fb 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >@@ -595,6 +595,50 @@ void NetworkConnectionToWebProcess::logUserInteraction(PAL::SessionID sessionID, > #endif > } > >+void NetworkConnectionToWebProcess::logWebSocketLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) >+{ >+#if ENABLE(RESOURCE_LOAD_STATISTICS) >+ if (auto networkSession = networkProcess().networkSession(sessionID)) { >+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >+ resourceLoadStatistics->logWebSocketLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { }); >+ } >+#else >+ UNUSED_PARAM(sessionID); >+ UNUSED_PARAM(targetPrimaryDomain); >+ UNUSED_PARAM(mainFramePrimaryDomain); >+ UNUSED_PARAM(lastSeen); >+#endif >+} >+ >+void NetworkConnectionToWebProcess::logSubresourceLoading(PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) >+{ >+#if ENABLE(RESOURCE_LOAD_STATISTICS) >+ if (auto networkSession = networkProcess().networkSession(sessionID)) { >+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >+ resourceLoadStatistics->logSubresourceLoading(targetPrimaryDomain, mainFramePrimaryDomain, lastSeen, [] { }); >+ } >+#else >+ UNUSED_PARAM(sessionID); >+ UNUSED_PARAM(targetPrimaryDomain); >+ UNUSED_PARAM(mainFramePrimaryDomain); >+ UNUSED_PARAM(lastSeen); >+#endif >+} >+ >+void NetworkConnectionToWebProcess::logSubresourceRedirect(PAL::SessionID sessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain) >+{ >+#if ENABLE(RESOURCE_LOAD_STATISTICS) >+ if (auto networkSession = networkProcess().networkSession(sessionID)) { >+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >+ resourceLoadStatistics->logSubresourceRedirect(sourcePrimaryDomain, targetPrimaryDomain, [] { }); >+ } >+#else >+ UNUSED_PARAM(sessionID); >+ UNUSED_PARAM(sourcePrimaryDomain); >+ UNUSED_PARAM(targetPrimaryDomain); >+#endif >+} >+ > void NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains) > { > SecurityPolicy::addOriginAccessWhitelistEntry(SecurityOrigin::createFromString(sourceOrigin).get(), destinationProtocol, destinationHost, allowDestinationSubdomains); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >index 088de8fded14754838dfaa9d827f7e57e9291a88..a7347504a009155c08d1b1d0f4d298cec3a68fa0 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >@@ -195,6 +195,9 @@ private: > void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID); > void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID); > void logUserInteraction(PAL::SessionID, const String& topLevelOrigin); >+ void logWebSocketLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen); >+ void logSubresourceLoading(PAL::SessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen); >+ void logSubresourceRedirect(PAL::SessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain); > > void addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains); > void removeOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >index f245bca7dc6b2c71a79cc8a39059e9d14435df60..4b915de7e86b16bdd4f17173da7d17a18e6ff16b 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >@@ -60,6 +60,9 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver { > RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID); > #if ENABLE(RESOURCE_LOAD_STATISTICS) > LogUserInteraction(PAL::SessionID sessionID, String topLevelOrigin) >+ LogWebSocketLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen) >+ LogSubresourceLoading(PAL::SessionID sessionID, String targetPrimaryDomain, String mainFramePrimaryDomain, WallTime lastSeen) >+ LogSubresourceRedirect(PAL::SessionID sessionID, String sourcePrimaryDomain, String targetPrimaryDomain) > #endif > > AddOriginAccessWhitelistEntry(String sourceOrigin, String destinationProtocol, String destinationHost, bool allowDestinationSubdomains); >diff --git a/Source/WebKit/NetworkProcess/NetworkSession.cpp b/Source/WebKit/NetworkProcess/NetworkSession.cpp >index ad51538e9e3e4db4931a100fbb508984d7bb339c..20d09ba75932cc244f0099d58c852f0e1a73b707 100644 >--- a/Source/WebKit/NetworkProcess/NetworkSession.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkSession.cpp >@@ -92,6 +92,10 @@ void NetworkSession::setResourceLoadStatisticsEnabled(bool enable) > if (m_resourceLoadStatistics) > return; > >+ // FIXME(193728): Support ResourceLoadStatistics for ephemeral sessions, too. >+ if (m_sessionID.isEphemeral()) >+ return; >+ > m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this, m_resourceLoadStatisticsDirectory); > } > >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index a4ca7d9232cceaa370c30fa45eb24f05938c534f..e95ce948bf67ae0fdc6c8adde8677e44bd9019c9 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -560,7 +560,7 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with > > SandboxExtension::createHandleForReadWriteDirectory(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory, parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle); > >- parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatistics = false; // FIXME(193297): Turn on when the feature is on. (m_configuration->resourceLoadStatisticsEnabled()?) >+ parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatistics = true; // FIXME(193705): m_configuration->resourceLoadStatisticsEnabled(); > > // Add any platform specific parameters > platformInitializeNetworkProcess(parameters); >diff --git a/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm b/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm >index 427a9c85a3b9845ae4f754fb4c7a39263c8c17c9..8d982422e0dcaca9d5c540d46bd810d54bf79d25 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm >+++ b/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm >@@ -102,7 +102,7 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters() > WTFMove(httpsProxy), > WTFMove(resourceLoadStatisticsDirectory), > WTFMove(resourceLoadStatisticsDirectoryHandle), >- false // FIXME(193297): Switch to m_configuration->resourceLoadStatisticsEnabled() >+ true // FIXME(193705): m_configuration->resourceLoadStatisticsEnabled() > }; > > auto cookieFile = resolvedCookieStorageFile(); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index b7c818233ec4804b84cb9ae8022aff4fce2f8d20..0088d5b0c1ddc4e323b8d1a1ee995422f4da5235 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1252,15 +1252,12 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, const Ve > > // If we are deleting all of the data types that the resource load statistics store monitors > // we do not need to re-grandfather old data. >+ auto shouldGrandfather = ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw) ? ShouldGrandfatherStatistics::No : ShouldGrandfatherStatistics::Yes; >+ > callbackAggregator->addPendingCallback(); >- if ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw) >- m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(ShouldGrandfatherStatistics::No, [callbackAggregator] { >- callbackAggregator->removePendingCallback(); >- }); >- else >- m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(ShouldGrandfatherStatistics::Yes, [callbackAggregator] { >- callbackAggregator->removePendingCallback(); >- }); >+ m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(shouldGrandfather, [callbackAggregator] { >+ callbackAggregator->removePendingCallback(); >+ }); > > callbackAggregator->addPendingCallback(); > clearResourceLoadStatisticsInWebProcesses([callbackAggregator] { >@@ -2325,16 +2322,10 @@ void WebsiteDataStore::setResourceLoadStatisticsEnabled(bool enabled) > return; > > if (enabled) { >- // FIXME(193297): Remove this assert >- ASSERT(!m_resourceLoadStatistics); > enableResourceLoadStatisticsAndSetTestingCallback(nullptr); > return; > } > >- // FIXME(193297): Remove these two lines >- unregisterWebResourceLoadStatisticsStoreAsMessageReceiver(); >- m_resourceLoadStatistics = nullptr; >- > for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false)) { > processPool->setResourceLoadStatisticsEnabled(false); > processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(false)); >@@ -2395,16 +2386,8 @@ void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Functio > m_resourceLoadStatisticsEnabled = true; > setStatisticsTestingCallback(WTFMove(callback)); > >- // FIXME(193297): Remove this check >- if (m_resourceLoadStatistics) >- return; >- > resolveDirectoriesIfNecessary(); > >- // FIXME(193297): Remove these two lines >- m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this); >- registerWebResourceLoadStatisticsStoreAsMessageReceiver(); >- > for (auto& processPool : processPools(std::numeric_limits<size_t>::max(), false)) { > processPool->setResourceLoadStatisticsEnabled(true); > processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetResourceLoadStatisticsEnabled(true)); >diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp >index df947bb1ee8ea80e1cadd697c2e2e0bf62d4abd0..4f62fad00fe9603b098044b1c39ad29aaad55587 100644 >--- a/Source/WebKit/WebProcess/WebProcess.cpp >+++ b/Source/WebKit/WebProcess/WebProcess.cpp >@@ -388,6 +388,18 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters) > ResourceLoadObserver::shared().setLogUserInteractionNotificationCallback([this] (PAL::SessionID sessionID, const String& topLevelOrigin) { > m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogUserInteraction(sessionID, topLevelOrigin), 0); > }); >+ >+ ResourceLoadObserver::shared().setLogWebSocketLoadingNotificationCallback([this] (PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) { >+ m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogWebSocketLoading(sessionID, targetPrimaryDomain, mainFramePrimaryDomain, lastSeen), 0); >+ }); >+ >+ ResourceLoadObserver::shared().setLogSubresourceLoadingNotificationCallback([this] (PAL::SessionID sessionID, const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen) { >+ m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogSubresourceLoading(sessionID, targetPrimaryDomain, mainFramePrimaryDomain, lastSeen), 0); >+ }); >+ >+ ResourceLoadObserver::shared().setLogSubresourceRedirectNotificationCallback([this] (PAL::SessionID sessionID, const String& sourcePrimaryDomain, const String& targetPrimaryDomain) { >+ m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::LogSubresourceRedirect(sessionID, sourcePrimaryDomain, targetPrimaryDomain), 0); >+ }); > #endif > > setTerminationTimeout(parameters.terminationTimeout); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 143a497ef9e46e2df4f22d5b908b09ef28712fa6..64d2d19f40e091b8b94fe0dd41d2d089c2d5816b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,15 @@ >+2019-01-23 Brent Fulgham <bfulgham@apple.com> >+ >+ Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess. >+ https://bugs.webkit.org/show_bug.cgi?id=193297 >+ <rdar://problem/47158841> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp: >+ (WTR::TestRunner::installStatisticsDidScanDataRecordsCallback): Simplify test configuration by >+ activating the message used to trigger the callback when it is set. >+ > 2019-01-23 Aakash Jain <aakash_jain@apple.com> > > [ews-app] Rename ews model steps to step >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index d7a9d24829df8b74ad8bcd91ddd96094b2ce5850..40d4129b1ecd0fd54bc883beabe192a1a373b580 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -1860,6 +1860,13 @@ void TestRunner::statisticsDidModifyDataRecordsCallback() > void TestRunner::installStatisticsDidScanDataRecordsCallback(JSValueRef callback) > { > cacheTestRunnerCallback(StatisticsDidScanDataRecordsCallbackID, callback); >+ >+ bool notifyPagesWhenDataRecordsWereScanned = !!callback; >+ >+ // Setting a callback implies we expect to receive callbacks. So register for them. >+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsNotifyPagesWhenDataRecordsWereScanned")); >+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(notifyPagesWhenDataRecordsWereScanned)); >+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); > } > > void TestRunner::statisticsDidScanDataRecordsCallback()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193297
:
359996
|
359999
|
360001
|
360025
|
360085
|
360127