Diff
Modified: trunk/Source/WebCore/ChangeLog (213870 => 213871)
--- trunk/Source/WebCore/ChangeLog 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/ChangeLog 2017-03-13 21:50:50 UTC (rev 213871)
@@ -1,3 +1,47 @@
+2017-03-13 John Wilander <[email protected]>
+
+ Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
+ https://bugs.webkit.org/show_bug.cgi?id=169506
+
+ Reviewed by Alex Christensen.
+
+ Covered by previous test which now follows the code path more closely to when reporting
+ happens in the web process.
+
+ * loader/ResourceLoadObserver.cpp:
+ (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
+ No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+ Instead just calls ResourceLoadStatisticsStore::fireDataModificationHandler().
+ (WebCore::ResourceLoadObserver::logUserInteraction):
+ Updated to call the new ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+ (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
+ Now takes two vectors – domainsToRemove and domainsToAdd.
+ * loader/ResourceLoadObserver.h:
+ * loader/ResourceLoadStatistics.cpp:
+ (WebCore::ResourceLoadStatistics::toString):
+ Added boolean field isMarkedForCookiePartitioning.
+ (WebCore::ResourceLoadStatistics::merge):
+ Added boolean field isMarkedForCookiePartitioning.
+ * loader/ResourceLoadStatistics.h:
+ Added boolean field isMarkedForCookiePartitioning.
+ * loader/ResourceLoadStatisticsStore.cpp:
+ (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
+ Now marks statistics with isMarkedForCookiePartitioning before sending them off to
+ ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+ (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
+ Now accepts a handler with two vectors.
+ (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
+ Now the only exported version of this function is the one without arguments.
+ The one internal to WebCore accepts two vectors – domainsToRemove and domainsToAdd.
+ The exported one generates the two vectors and then calls the internal one.
+ (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
+ No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+ * loader/ResourceLoadStatisticsStore.h:
+ * platform/network/NetworkStorageSession.h:
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
+ Now takes two vectors – domainsToRemove and domainsToAdd.
+
2017-03-13 Dean Jackson <[email protected]>
Respect the runtime flag for WebGPU, default feature to off.
Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (213870 => 213871)
--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -326,7 +326,6 @@
statistics.hadUserInteraction = true;
statistics.mostRecentUserInteraction = newTimestamp;
- m_store->fireShouldPartitionCookiesHandler(primaryDomainStr, false);
m_store->fireDataModificationHandler();
}
@@ -341,7 +340,7 @@
statistics.hadUserInteraction = true;
statistics.mostRecentUserInteraction = WTF::currentTime();
- m_store->fireShouldPartitionCookiesHandler(primaryDomainStr, false);
+ m_store->fireShouldPartitionCookiesHandler({primaryDomainStr}, { });
}
void ResourceLoadObserver::clearUserInteraction(const URL& url)
@@ -432,9 +431,9 @@
m_store->fireDataModificationHandler();
}
-void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
+void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
{
- m_store->fireShouldPartitionCookiesHandler(primaryDomain(hostName), value);
+ m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
}
String ResourceLoadObserver::primaryDomain(const URL& url)
Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (213870 => 213871)
--- trunk/Source/WebCore/loader/ResourceLoadObserver.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -66,7 +66,7 @@
WEBCORE_EXPORT void setReducedTimestampResolution(double seconds);
WEBCORE_EXPORT void fireDataModificationHandler();
- WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String& primaryDomain, bool value);
+ WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
WEBCORE_EXPORT RefPtr<ResourceLoadStatisticsStore> statisticsStore();
WEBCORE_EXPORT void setStatisticsStore(Ref<ResourceLoadStatisticsStore>&&);
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (213870 => 213871)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -294,8 +294,12 @@
builder.appendNumber(dataRecordsRemoved);
builder.append('\n');
+ // In-memory only
+ appendBoolean(builder, "isMarkedForCookiePartitioning", isMarkedForCookiePartitioning);
builder.append('\n');
+ builder.append('\n');
+
return builder.toString();
}
@@ -353,6 +357,9 @@
mergeHashCountedSet(redirectedToOtherPrevalentResourceOrigins, other.redirectedToOtherPrevalentResourceOrigins);
isPrevalentResource |= other.isPrevalentResource;
dataRecordsRemoved += other.dataRecordsRemoved;
+
+ // In-memory only
+ isMarkedForCookiePartitioning |= other.isMarkedForCookiePartitioning;
}
}
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.h (213870 => 213871)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -87,6 +87,9 @@
HashCountedSet<String> redirectedToOtherPrevalentResourceOrigins;
bool isPrevalentResource { false };
unsigned dataRecordsRemoved { 0 };
+
+ // In-memory only
+ bool isMarkedForCookiePartitioning { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp (213870 => 213871)
--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -103,12 +103,14 @@
Vector<String> prevalentResourceDomainsWithoutUserInteraction;
prevalentResourceDomainsWithoutUserInteraction.reserveInitialCapacity(loadedStatistics.size());
for (auto& statistics : loadedStatistics) {
+ if (statistics.isPrevalentResource && !statistics.hadUserInteraction) {
+ prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
+ statistics.isMarkedForCookiePartitioning = true;
+ }
m_resourceStatisticsMap.set(statistics.highLevelDomain, statistics);
- if (statistics.isPrevalentResource && !statistics.hadUserInteraction)
- prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
}
-
- fireShouldPartitionCookiesHandler(prevalentResourceDomainsWithoutUserInteraction, true);
+
+ fireShouldPartitionCookiesHandler({ }, prevalentResourceDomainsWithoutUserInteraction);
}
void ResourceLoadStatisticsStore::clearInMemoryAndPersistent()
@@ -155,7 +157,7 @@
m_dataAddedHandler = WTFMove(handler);
}
-void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& primaryDomains, bool value)>&& handler)
+void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& handler)
{
m_shouldPartitionCookiesForDomainsHandler = WTFMove(handler);
}
@@ -171,17 +173,32 @@
m_dataAddedHandler();
}
-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const String& primaryDomain, bool value)
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
{
- Vector<String> domainVector;
- domainVector.append(primaryDomain);
- fireShouldPartitionCookiesHandler(domainVector, value);
+ Vector<String> domainsToRemove;
+ Vector<String> domainsToAdd;
+
+ for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
+ bool recentUserInteraction = hasHadRecentUserInteraction(resourceStatistic);
+ if (resourceStatistic.isMarkedForCookiePartitioning && recentUserInteraction) {
+ resourceStatistic.isMarkedForCookiePartitioning = false;
+ domainsToRemove.append(resourceStatistic.highLevelDomain);
+ } else if (!resourceStatistic.isMarkedForCookiePartitioning && !recentUserInteraction && resourceStatistic.isPrevalentResource) {
+ resourceStatistic.isMarkedForCookiePartitioning = true;
+ domainsToAdd.append(resourceStatistic.highLevelDomain);
+ }
+ }
+
+ fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
}
-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& primaryDomains, bool value)
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
{
+ if (domainsToRemove.isEmpty() && domainsToAdd.isEmpty())
+ return;
+
if (m_shouldPartitionCookiesForDomainsHandler)
- m_shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
+ m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
}
void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(double seconds)
@@ -208,9 +225,6 @@
resourceStatistic.mostRecentUserInteraction = 0;
resourceStatistic.hadUserInteraction = false;
- if (resourceStatistic.isPrevalentResource)
- fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
-
return false;
}
Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h (213870 => 213871)
--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -58,14 +58,13 @@
WEBCORE_EXPORT Vector<ResourceLoadStatistics> takeStatistics();
WEBCORE_EXPORT void setNotificationCallback(std::function<void()>);
- WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& primaryDomains, bool value)>&&);
+ WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&&);
WEBCORE_EXPORT void setWritePersistentStoreCallback(std::function<void()>&&);
-
void fireDataModificationHandler();
void setTimeToLiveUserInteraction(double seconds);
- WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String& primaryDomain, bool value);
- WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& primaryDomain, bool value);
+ WEBCORE_EXPORT void fireShouldPartitionCookiesHandler();
+ void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
WEBCORE_EXPORT void processStatistics(std::function<void(ResourceLoadStatistics&)>&&);
@@ -77,7 +76,7 @@
HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap;
std::function<void()> m_dataAddedHandler;
- std::function<void(const Vector<String>& primaryDomains, bool value)> m_shouldPartitionCookiesForDomainsHandler;
+ std::function<void(const Vector<String>&, const Vector<String>&)> m_shouldPartitionCookiesForDomainsHandler;
std::function<void()> m_writePersistentStoreHandler;
};
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (213870 => 213871)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -80,7 +80,7 @@
WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool);
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
WEBCORE_EXPORT bool shouldPartitionCookiesForHost(const String&);
- WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>&, bool value);
+ WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
#endif
#elif USE(SOUP)
NetworkStorageSession(SessionID, std::unique_ptr<SoupNetworkSession>&&);
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (213870 => 213871)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -154,14 +154,15 @@
return m_topPrivatelyControlledDomainsForCookiePartitioning.contains(domain);
}
-void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector<String>& hosts, bool value)
+void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
{
- if (value)
- m_topPrivatelyControlledDomainsForCookiePartitioning.add(hosts.begin(), hosts.end());
- else {
- for (auto& host : hosts)
- m_topPrivatelyControlledDomainsForCookiePartitioning.remove(host);
+ if (!domainsToRemove.isEmpty()) {
+ for (auto& domain : domainsToRemove)
+ m_topPrivatelyControlledDomainsForCookiePartitioning.remove(domain);
}
+
+ if (!domainsToAdd.isEmpty())
+ m_topPrivatelyControlledDomainsForCookiePartitioning.add(domainsToAdd.begin(), domainsToAdd.end());
}
#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
Modified: trunk/Source/WebKit2/ChangeLog (213870 => 213871)
--- trunk/Source/WebKit2/ChangeLog 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-13 21:50:50 UTC (rev 213871)
@@ -1,3 +1,43 @@
+2017-03-13 John Wilander <[email protected]>
+
+ Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
+ https://bugs.webkit.org/show_bug.cgi?id=169506
+
+ Reviewed by Alex Christensen.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+ Now takes two vectors – domainsToRemove and domainsToAdd.
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ The message now takes two vectors – domainsToRemove and domainsToAdd.
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+ Now takes two vectors – domainsToRemove and domainsToAdd.
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/Network/NetworkProcessProxy.messages.in:
+ The message now takes two vectors – domainsToRemove and domainsToAdd.
+ * UIProcess/WebResourceLoadStatisticsManager.cpp:
+ (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
+ Now converts to the two vectors needed by
+ WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::classifyResource):
+ No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+ (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
+ Changed the order of two blocks to not build a vector if we are to return early.
+ (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
+ Now calls WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
+ (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
+ Now takes a handler with two vectors – domainsToRemove and domainsToAdd.
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+ Now takes two vectors – domainsToRemove and domainsToAdd.
+ (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
+ Now submits a handler that takes two vectors – domainsToRemove and domainsToAdd.
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2017-03-13 Dean Jackson <[email protected]>
Respect the runtime flag for WebGPU, default feature to off, and print a warning
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (213870 => 213871)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -311,9 +311,9 @@
}
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domains, bool value)
+void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
{
- NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domains, value);
+ NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domainsToRemove, domainsToAdd);
}
#endif
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (213870 => 213871)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -117,7 +117,7 @@
void grantSandboxExtensionsToDatabaseProcessForBlobs(const Vector<String>& filenames, Function<void ()>&& completionHandler);
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
+ void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
#endif
std::chrono::milliseconds loadThrottleLatency() const { return m_loadThrottleLatency; }
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (213870 => 213871)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in 2017-03-13 21:50:50 UTC (rev 213871)
@@ -79,6 +79,6 @@
DidGrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID)
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> topPrivatelyOwnedDomains, bool value)
+ ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd)
#endif
}
Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -293,9 +293,9 @@
}
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& topPrivatelyOwnedDomains, bool value)
+void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
{
- connection()->send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value), 0);
+ connection()->send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd), 0);
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -110,7 +110,7 @@
void didDeleteWebsiteDataForOrigins(uint64_t callbackID);
void grantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, const Vector<String>& paths);
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
+ void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
#endif
void logDiagnosticMessage(uint64_t pageID, const String& message, const String& description, WebCore::ShouldSample);
void logDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result, WebCore::ShouldSample);
Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in 2017-03-13 21:50:50 UTC (rev 213871)
@@ -32,7 +32,7 @@
GrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, Vector<String> paths)
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> topPrivatelyOwnedDomains, bool value)
+ ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd)
#endif
ProcessReadyToSuspend()
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -88,7 +88,10 @@
void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
{
- WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler(hostName, value);
+ if (value)
+ WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({ }, {hostName});
+ else
+ WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({hostName}, { });
}
void WebResourceLoadStatisticsManager::setNotifyPagesWhenDataRecordsWereScanned(bool value)
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -85,11 +85,8 @@
void WebResourceLoadStatisticsStore::classifyResource(ResourceLoadStatistics& resourceStatistic)
{
if (!resourceStatistic.isPrevalentResource
- && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) {
+ && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
resourceStatistic.isPrevalentResource = true;
- if (!resourceStatistic.hadUserInteraction)
- m_resourceLoadStatisticsStore->fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
- }
}
void WebResourceLoadStatisticsStore::removeDataRecords()
@@ -97,15 +94,15 @@
if (m_dataRecordsRemovalPending)
return;
- Vector<String> prevalentResourceDomains = coreStore().prevalentResourceDomainsWithoutUserInteraction();
- if (!prevalentResourceDomains.size())
- return;
-
double now = currentTime();
if (m_lastTimeDataRecordsWereRemoved
&& now < m_lastTimeDataRecordsWereRemoved + minimumTimeBetweeenDataRecordsRemoval)
return;
+ Vector<String> prevalentResourceDomains = coreStore().prevalentResourceDomainsWithoutUserInteraction();
+ if (!prevalentResourceDomains.size())
+ return;
+
m_dataRecordsRemovalPending = true;
m_lastTimeDataRecordsWereRemoved = now;
@@ -153,6 +150,7 @@
void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins)
{
coreStore().mergeStatistics(origins);
+ coreStore().fireShouldPartitionCookiesHandler();
processStatisticsAndDataRecords();
}
@@ -181,11 +179,11 @@
});
}
-void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function<void(const Vector<String>& primaryDomain, bool value)>&& shouldPartitionCookiesForDomainsHandler)
+void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& shouldPartitionCookiesForDomainsHandler)
{
registerSharedResourceLoadObserver();
- m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& primaryDomains, bool value) {
- shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
+ m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
+ shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
});
m_resourceLoadStatisticsStore->setWritePersistentStoreCallback([this]() {
writeStoreToDisk();
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -63,7 +63,7 @@
void setResourceLoadStatisticsEnabled(bool);
bool resourceLoadStatisticsEnabled() const;
void registerSharedResourceLoadObserver();
- void registerSharedResourceLoadObserver(std::function<void(const Vector<String>& primaryDomain, bool value)>&& shouldPartitionCookiesForDomainsHandler);
+ void registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& shouldPartitionCookiesForDomainsHandler);
void resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins);
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-03-13 21:50:50 UTC (rev 213871)
@@ -1059,10 +1059,10 @@
}
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& topPrivatelyOwnedDomains, bool value)
+void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
{
for (auto& processPool : processPools())
- processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value));
+ processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd));
}
#endif
@@ -1233,8 +1233,8 @@
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
m_resourceLoadStatistics->registerSharedResourceLoadObserver(
- [this] (const Vector<String>& topPrivatelyOwnedDomains, bool value) {
- this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value);
+ [this] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
+ this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd);
});
#else
m_resourceLoadStatistics->registerSharedResourceLoadObserver();
Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (213870 => 213871)
--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2017-03-13 21:44:32 UTC (rev 213870)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h 2017-03-13 21:50:50 UTC (rev 213871)
@@ -92,7 +92,7 @@
void removeDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<String>)> completionHandler);
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
+ void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
#endif
void resolveDirectoriesIfNecessary();
const String& resolvedApplicationCacheDirectory() const { return m_resolvedConfiguration.applicationCacheDirectory; }