Diff
Modified: trunk/Source/WebKit2/ChangeLog (212765 => 212766)
--- trunk/Source/WebKit2/ChangeLog 2017-02-21 22:54:17 UTC (rev 212765)
+++ trunk/Source/WebKit2/ChangeLog 2017-02-21 22:55:27 UTC (rev 212766)
@@ -1,5 +1,29 @@
2017-02-21 John Wilander <[email protected]>
+ Resource Load Statistics: Only scan website data store once per session ID + reinstate removal counting
+ https://bugs.webkit.org/show_bug.cgi?id=168541
+
+ Reviewed by Alex Christensen.
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores):
+ The CallbackAggregator now merges a list of domains for which we
+ have removed data records and eventually reports this back to the
+ caller.
+ * UIProcess/WebProcessProxy.h:
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
+ Now reports back to its WebCore::ResourceLoadStatisticsStore
+ which domains have had data records removed.
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyOwnedDomains):
+ The completion handler now handles data record removal counting.
+ (WebKit::WebsiteDataStore::removeDataForTopPrivatelyOwnedDomains):
+ The completion handler now handles data record removal counting.
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
+2017-02-21 John Wilander <[email protected]>
+
Resource Load Statistics: Add alternate classification method
https://bugs.webkit.org/show_bug.cgi?id=168347
<rdar://problem/30352793>
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (212765 => 212766)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2017-02-21 22:54:17 UTC (rev 212765)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2017-02-21 22:55:27 UTC (rev 212766)
@@ -203,13 +203,17 @@
return globalPageMap().get(pageID);
}
-void WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>& topPrivatelyOwnedDomains, bool shouldNotifyPage, std::function<void()> completionHandler)
+void WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>& topPrivatelyOwnedDomains, bool shouldNotifyPage, std::function<void(Vector<String>)> completionHandler)
{
struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
- explicit CallbackAggregator(std::function<void()> completionHandler)
+ explicit CallbackAggregator(std::function<void(Vector<String>)> completionHandler)
: completionHandler(WTFMove(completionHandler))
{
}
+ void addDomainsWithDeletedWebsiteData(const Vector<String>& domains)
+ {
+ domainsWithDeletedWebsiteData.appendVector(domains);
+ }
void addPendingCallback()
{
@@ -227,23 +231,28 @@
void callIfNeeded()
{
if (!pendingCallbacks)
- completionHandler();
+ completionHandler(domainsWithDeletedWebsiteData);
}
unsigned pendingCallbacks = 0;
- std::function<void()> completionHandler;
+ std::function<void(Vector<String>)> completionHandler;
+ Vector<String> domainsWithDeletedWebsiteData;
};
RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));
+ HashSet<WebCore::SessionID> visitedSessionIDs;
for (auto& page : globalPageMap()) {
- if (!page.value->websiteDataStore().isPersistent())
+ auto& dataStore = page.value->websiteDataStore();
+ if (!dataStore.isPersistent() || visitedSessionIDs.contains(dataStore.sessionID()))
continue;
+ visitedSessionIDs.add(dataStore.sessionID());
callbackAggregator->addPendingCallback();
- page.value->websiteDataStore().removeDataForTopPrivatelyOwnedDomains(dataTypes, { }, topPrivatelyOwnedDomains, [callbackAggregator, shouldNotifyPage, page]() {
+ dataStore.removeDataForTopPrivatelyOwnedDomains(dataTypes, { }, topPrivatelyOwnedDomains, [callbackAggregator, shouldNotifyPage, page](auto domainsWithDeletedWebsiteData) {
if (shouldNotifyPage)
page.value->postMessageToInjectedBundle("WebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished", nullptr);
- WTF::RunLoop::main().dispatch([callbackAggregator] {
+ WTF::RunLoop::main().dispatch([callbackAggregator, domainsWithDeletedWebsiteData] {
+ callbackAggregator->addDomainsWithDeletedWebsiteData(domainsWithDeletedWebsiteData);
callbackAggregator->removePendingCallback();
});
});
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (212765 => 212766)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2017-02-21 22:54:17 UTC (rev 212765)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2017-02-21 22:55:27 UTC (rev 212766)
@@ -124,7 +124,7 @@
void fetchWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, Function<void(WebsiteData)> completionHandler);
void deleteWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()> completionHandler);
void deleteWebsiteDataForOrigins(WebCore::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, Function<void()> completionHandler);
- static void deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>& topPrivatelyOwnedDomains, bool shouldNotifyPages, std::function<void()> completionHandler);
+ static void deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>& topPrivatelyOwnedDomains, bool shouldNotifyPages, std::function<void(Vector<String>)> completionHandler);
void enableSuddenTermination();
void disableSuddenTermination();
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (212765 => 212766)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-02-21 22:54:17 UTC (rev 212765)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-02-21 22:55:27 UTC (rev 212766)
@@ -128,7 +128,8 @@
// Switch to the main thread to get the default website data store
RunLoop::main().dispatch([prevalentResourceDomains = WTFMove(prevalentResourceDomains), this] () mutable {
- WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(dataTypesToRemove, prevalentResourceDomains, notifyPages, [this]() mutable {
+ WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores(dataTypesToRemove, prevalentResourceDomains, notifyPages, [this](Vector<String> domainsWithDeletedWebsiteData) mutable {
+ this->coreStore().updateStatisticsForRemovedDataRecords(domainsWithDeletedWebsiteData);
m_dataRecordsRemovalPending = false;
});
});
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (212765 => 212766)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-02-21 22:54:17 UTC (rev 212765)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-02-21 22:55:27 UTC (rev 212766)
@@ -473,7 +473,7 @@
callbackAggregator->callIfNeeded();
}
-void WebsiteDataStore::fetchDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<WebsiteDataRecord>)> completionHandler)
+void WebsiteDataStore::fetchDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)> completionHandler)
{
fetchData(dataTypes, fetchOptions, [topPrivatelyOwnedDomains, completionHandler, this](auto existingDataRecords) {
Vector<WebsiteDataRecord> matchingDataRecords;
@@ -498,7 +498,7 @@
break;
}
}
- completionHandler(matchingDataRecords);
+ completionHandler(WTFMove(matchingDataRecords), WTFMove(domainsWithDataRecords));
});
}
@@ -1027,11 +1027,11 @@
callbackAggregator->callIfNeeded();
}
-void WebsiteDataStore::removeDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyOwnedDomains, std::function<void()> completionHandler)
+void WebsiteDataStore::removeDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<String>)> completionHandler)
{
- fetchDataForTopPrivatelyOwnedDomains(dataTypes, fetchOptions, topPrivatelyOwnedDomains, [dataTypes, completionHandler, this](auto websiteDataRecords) {
- this->removeData(dataTypes, websiteDataRecords, [completionHandler]() {
- completionHandler();
+ fetchDataForTopPrivatelyOwnedDomains(dataTypes, fetchOptions, topPrivatelyOwnedDomains, [dataTypes, completionHandler, this](auto websiteDataRecords, auto domainsWithDataRecords) {
+ this->removeData(dataTypes, websiteDataRecords, [domainsWithDataRecords, completionHandler]() {
+ completionHandler(domainsWithDataRecords);
});
});
}
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (212765 => 212766)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2017-02-21 22:54:17 UTC (rev 212765)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2017-02-21 22:55:27 UTC (rev 212766)
@@ -84,10 +84,10 @@
static void cloneSessionData(WebPageProxy& sourcePage, WebPageProxy& newPage);
void fetchData(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, std::function<void (Vector<WebsiteDataRecord>)> completionHandler);
- void fetchDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<WebsiteDataRecord>)> completionHandler);
+ void fetchDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)> completionHandler);
void removeData(OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler);
void removeData(OptionSet<WebsiteDataType>, const Vector<WebsiteDataRecord>&, std::function<void ()> completionHandler);
- void removeDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyOwnedDomains, std::function<void()> completionHandler);
+ void removeDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<String>)> completionHandler);
StorageManager* storageManager() { return m_storageManager.get(); }