Title: [215741] trunk/Source
Revision
215741
Author
wilan...@apple.com
Date
2017-04-25 10:05:04 -0700 (Tue, 25 Apr 2017)

Log Message

Resource Load Statistics: Clear network process cache when clearing store
https://bugs.webkit.org/show_bug.cgi?id=171256
<rdar://problem/31802347>

Reviewed by Brent Fulgham.

Source/WebCore:

Test that covers this code:
http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::clearInMemoryStore):
    Better name.
(WebCore::ResourceLoadObserver::logUserInteraction):
    Now passes on the boolean parameter clearFirst to
    ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
(WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
    Now takes and passes on the boolean parameter clearFirst to
    ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
(WebCore::ResourceLoadObserver::statisticsStore): Deleted.
    This getter violated abstraction. The way it was used
    is now solved through dedicated functions.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
    Now passes on the boolean parameter clearFirst to
    ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
(WebCore::ResourceLoadStatisticsStore::clearInMemory):
    Better name.
    Now triggers clearing of the associated network process cache.
(WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
    Now calls clearInMemory().
(WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
    Now expects a handler with the boolean parameter clearFirst.
(WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
    Now takes and passes on the boolean parameter clearFirst to
    m_shouldPartitionCookiesForDomainsHandler().
* loader/ResourceLoadStatisticsStore.h:
(WebCore::ResourceLoadStatisticsStore::clear): Deleted.
* platform/network/NetworkStorageSession.h:
    NetworkStorageSession::setShouldPartitionCookiesForHosts() now
    takes the boolean parameter clearFirst.
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
    Now clears m_topPrivatelyControlledDomainsForCookiePartitioning
    if the boolean parameter clearFirst is true.

Source/WebKit2:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
    Now takes and passes on the boolean parameter clearFirst to
    WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts().
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
    The message ShouldPartitionCookiesForTopPrivatelyOwnedDomains now
    takes the boolean parameter clearFirst.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
    Now takes and passes on the boolean parameter clearFirst to
    Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
    The message ShouldPartitionCookiesForTopPrivatelyOwnedDomains now
    takes the boolean parameter clearFirst.
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
    Now uses the boolean parameter clearFirst when calling
    WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
    No longer uses the deleted store getter.
(WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
    No longer uses the deleted store getter.
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
    No sends the boolean parameter clearFirst to
    ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    Now expects a handler with the boolean parameter clearFirst.
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
* UIProcess/WebResourceLoadStatisticsStore.h:
    Now uses the new WebCore::ResourceLoadObserver::clearInMemoryStore().
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
    Now takes and passes on the boolean parameter clearFirst in its
    message to the network process.
(WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
    Now expects a handler with the boolean parameter clearFirst.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215740 => 215741)


--- trunk/Source/WebCore/ChangeLog	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/ChangeLog	2017-04-25 17:05:04 UTC (rev 215741)
@@ -1,3 +1,51 @@
+2017-04-25  John Wilander  <wilan...@apple.com>
+
+        Resource Load Statistics: Clear network process cache when clearing store
+        https://bugs.webkit.org/show_bug.cgi?id=171256
+        <rdar://problem/31802347>
+
+        Reviewed by Brent Fulgham.
+
+        Test that covers this code:
+        http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::clearInMemoryStore):
+            Better name.
+        (WebCore::ResourceLoadObserver::logUserInteraction):
+            Now passes on the boolean parameter clearFirst to
+            ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+        (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
+            Now takes and passes on the boolean parameter clearFirst to
+            ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+        (WebCore::ResourceLoadObserver::statisticsStore): Deleted.
+            This getter violated abstraction. The way it was used
+            is now solved through dedicated functions.
+        * loader/ResourceLoadObserver.h:
+        * loader/ResourceLoadStatisticsStore.cpp:
+        (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
+            Now passes on the boolean parameter clearFirst to
+            ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+        (WebCore::ResourceLoadStatisticsStore::clearInMemory):
+            Better name.
+            Now triggers clearing of the associated network process cache.
+        (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
+            Now calls clearInMemory().
+        (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
+            Now expects a handler with the boolean parameter clearFirst.
+        (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
+            Now takes and passes on the boolean parameter clearFirst to
+            m_shouldPartitionCookiesForDomainsHandler().
+        * loader/ResourceLoadStatisticsStore.h:
+        (WebCore::ResourceLoadStatisticsStore::clear): Deleted.
+        * platform/network/NetworkStorageSession.h:
+            NetworkStorageSession::setShouldPartitionCookiesForHosts() now
+            takes the boolean parameter clearFirst.
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+        (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
+            Now clears m_topPrivatelyControlledDomainsForCookiePartitioning
+            if the boolean parameter clearFirst is true.
+
 2017-04-25  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Add performance test for FontCache::systemFallbackForCharacters()

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (215740 => 215741)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -57,17 +57,17 @@
     return resourceLoadObserver;
 }
 
-RefPtr<ResourceLoadStatisticsStore> ResourceLoadObserver::statisticsStore()
+void ResourceLoadObserver::setStatisticsStore(Ref<ResourceLoadStatisticsStore>&& store)
 {
-    ASSERT(m_store);
-    return m_store;
+    m_store = WTFMove(store);
 }
 
-void ResourceLoadObserver::setStatisticsStore(Ref<ResourceLoadStatisticsStore>&& store)
+void ResourceLoadObserver::clearInMemoryStore()
 {
-    m_store = WTFMove(store);
+    if (m_store)
+        m_store->clearInMemory();
 }
-
+    
 void ResourceLoadObserver::clearInMemoryAndPersistentStore()
 {
     if (m_store)
@@ -341,7 +341,7 @@
     statistics.hadUserInteraction = true;
     statistics.mostRecentUserInteraction = WTF::currentTime();
 
-    m_store->fireShouldPartitionCookiesHandler({primaryDomainStr}, { });
+    m_store->fireShouldPartitionCookiesHandler({primaryDomainStr}, { }, false);
 }
 
 void ResourceLoadObserver::clearUserInteraction(const URL& url)
@@ -432,9 +432,9 @@
     m_store->fireDataModificationHandler();
 }
 
-void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
+void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
 {
-    m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
+    m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
 }
 
 String ResourceLoadObserver::primaryDomain(const URL& url)

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (215740 => 215741)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -66,10 +66,10 @@
     WEBCORE_EXPORT void setReducedTimestampResolution(double seconds);
 
     WEBCORE_EXPORT void fireDataModificationHandler();
-    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
 
-    WEBCORE_EXPORT RefPtr<ResourceLoadStatisticsStore> statisticsStore();
     WEBCORE_EXPORT void setStatisticsStore(Ref<ResourceLoadStatisticsStore>&&);
+    WEBCORE_EXPORT void clearInMemoryStore();
     WEBCORE_EXPORT void clearInMemoryAndPersistentStore();
     WEBCORE_EXPORT void clearInMemoryAndPersistentStore(std::chrono::system_clock::time_point modifiedSince);
 

Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp (215740 => 215741)


--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -110,12 +110,18 @@
         m_resourceStatisticsMap.set(statistics.highLevelDomain, statistics);
     }
 
-    fireShouldPartitionCookiesHandler({ }, prevalentResourceDomainsWithoutUserInteraction);
+    fireShouldPartitionCookiesHandler({ }, prevalentResourceDomainsWithoutUserInteraction, true);
 }
 
+void ResourceLoadStatisticsStore::clearInMemory()
+{
+    m_resourceStatisticsMap.clear();
+    fireShouldPartitionCookiesHandler({ }, { }, true);
+}
+
 void ResourceLoadStatisticsStore::clearInMemoryAndPersistent()
 {
-    clear();
+    clearInMemory();
     if (m_writePersistentStoreHandler)
         m_writePersistentStoreHandler();
 }
@@ -157,7 +163,7 @@
     m_dataAddedHandler = WTFMove(handler);
 }
 
-void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& handler)
+void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&& handler)
 {
     m_shouldPartitionCookiesForDomainsHandler = WTFMove(handler);
 }
@@ -173,7 +179,7 @@
         m_dataAddedHandler();
 }
 
-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(bool clearFirst)
 {
     Vector<String> domainsToRemove;
     Vector<String> domainsToAdd;
@@ -189,16 +195,16 @@
         }
     }
     
-    fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
+    fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd, clearFirst);
 }
 
-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
 {
     if (domainsToRemove.isEmpty() && domainsToAdd.isEmpty())
         return;
 
     if (m_shouldPartitionCookiesForDomainsHandler)
-        m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
+        m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd, clearFirst);
 }
 
 void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(double seconds)

Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h (215740 => 215741)


--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -46,7 +46,7 @@
 
     bool isEmpty() const { return m_resourceStatisticsMap.isEmpty(); }
     size_t size() const { return m_resourceStatisticsMap.size(); }
-    void clear() { m_resourceStatisticsMap.clear(); }
+    WEBCORE_EXPORT void clearInMemory();
     WEBCORE_EXPORT void clearInMemoryAndPersistent();
 
     ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
@@ -58,13 +58,13 @@
     WEBCORE_EXPORT Vector<ResourceLoadStatistics> takeStatistics();
 
     WEBCORE_EXPORT void setNotificationCallback(std::function<void()>);
-    WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&&);
+    WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&&);
     WEBCORE_EXPORT void setWritePersistentStoreCallback(std::function<void()>&&);
 
     void fireDataModificationHandler();
     void setTimeToLiveUserInteraction(double seconds);
-    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler();
-    void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(bool clearFirst);
+    void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
 
     WEBCORE_EXPORT void processStatistics(std::function<void(ResourceLoadStatistics&)>&&);
 
@@ -76,7 +76,7 @@
 
     HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap;
     std::function<void()> m_dataAddedHandler;
-    std::function<void(const Vector<String>&, const Vector<String>&)> m_shouldPartitionCookiesForDomainsHandler;
+    std::function<void(const Vector<String>&, const Vector<String>&, bool clearFirst)> m_shouldPartitionCookiesForDomainsHandler;
     std::function<void()> m_writePersistentStoreHandler;
 };
     

Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (215740 => 215741)


--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -81,7 +81,7 @@
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     WEBCORE_EXPORT String cookieStoragePartition(const ResourceRequest&) const;
     String cookieStoragePartition(const URL& firstPartyForCookies, const URL& resource) const;
-    WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
+    WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
 #endif
 #elif USE(SOUP)
     NetworkStorageSession(SessionID, std::unique_ptr<SoupNetworkSession>&&);

Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (215740 => 215741)


--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -151,8 +151,11 @@
     return m_topPrivatelyControlledDomainsForCookiePartitioning.contains(topPrivatelyControlledDomain);
 }
 
-void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
+void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
 {
+    if (clearFirst)
+        m_topPrivatelyControlledDomainsForCookiePartitioning.clear();
+
     if (!domainsToRemove.isEmpty()) {
         for (auto& domain : domainsToRemove)
             m_topPrivatelyControlledDomainsForCookiePartitioning.remove(domain);

Modified: trunk/Source/WebKit2/ChangeLog (215740 => 215741)


--- trunk/Source/WebKit2/ChangeLog	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-25 17:05:04 UTC (rev 215741)
@@ -1,3 +1,52 @@
+2017-04-25  John Wilander  <wilan...@apple.com>
+
+        Resource Load Statistics: Clear network process cache when clearing store
+        https://bugs.webkit.org/show_bug.cgi?id=171256
+        <rdar://problem/31802347>
+
+        Reviewed by Brent Fulgham.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+            Now takes and passes on the boolean parameter clearFirst to
+            WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts().
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+            The message ShouldPartitionCookiesForTopPrivatelyOwnedDomains now
+            takes the boolean parameter clearFirst.
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+            Now takes and passes on the boolean parameter clearFirst to
+            Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains.
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.messages.in:
+            The message ShouldPartitionCookiesForTopPrivatelyOwnedDomains now
+            takes the boolean parameter clearFirst.
+        * UIProcess/WebResourceLoadStatisticsManager.cpp:
+        (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
+            Now uses the boolean parameter clearFirst when calling
+            WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
+        (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
+            No longer uses the deleted store getter.
+        (WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
+            No longer uses the deleted store getter.
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
+            No sends the boolean parameter clearFirst to
+            ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
+        (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
+            Now expects a handler with the boolean parameter clearFirst.
+        (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+            Now uses the new WebCore::ResourceLoadObserver::clearInMemoryStore().
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+            Now takes and passes on the boolean parameter clearFirst in its
+            message to the network process.
+        (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
+            Now expects a handler with the boolean parameter clearFirst.
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+
 2017-04-25  Chris Dumez  <cdu...@apple.com>
 
         Content-Disposition header filename is ignored when 'download' attribute is specified in HTML

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (215740 => 215741)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -312,9 +312,9 @@
 }
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
+void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd,  bool clearFirst)
 {
-    NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domainsToRemove, domainsToAdd);
+    NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domainsToRemove, domainsToAdd, clearFirst);
 }
 #endif
 

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (215740 => 215741)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -117,7 +117,7 @@
     void grantSandboxExtensionsToDatabaseProcessForBlobs(const Vector<String>& filenames, Function<void ()>&& completionHandler);
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
 #endif
 
     Seconds loadThrottleLatency() const { return m_loadThrottleLatency; }

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (215740 => 215741)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2017-04-25 17:05:04 UTC (rev 215741)
@@ -80,6 +80,6 @@
     DidGrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID)
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd)
+    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd, bool clearFirst)
 #endif
 }

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -293,9 +293,9 @@
 }
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
+void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
 {
-    connection()->send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd), 0);
+    connection()->send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd, clearFirst), 0);
 }
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -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>& domainsToRemove, const Vector<String>& domainsToAdd);
+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
 #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 (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in	2017-04-25 17:05:04 UTC (rev 215741)
@@ -32,7 +32,7 @@
     GrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, Vector<String> paths)
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd)
+    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd, bool clearFirst)
 #endif
 
     ProcessReadyToSuspend()

Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -89,9 +89,9 @@
 void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
 {
     if (value)
-        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({ }, {hostName});
+        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({ }, {hostName}, false);
     else
-        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({hostName}, { });
+        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({hostName}, { }, false);
 }
 
 void WebResourceLoadStatisticsManager::setNotifyPagesWhenDataRecordsWereScanned(bool value)
@@ -111,9 +111,7 @@
 
 void WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore()
 {
-    auto store = WebCore::ResourceLoadObserver::sharedObserver().statisticsStore();
-    if (store)
-        store->clearInMemoryAndPersistent();
+    WebCore::ResourceLoadObserver::sharedObserver().clearInMemoryAndPersistentStore();
 }
 
 void WebResourceLoadStatisticsManager::resetToConsistentState()
@@ -122,9 +120,7 @@
     WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned(false);
     WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval(true);
     WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval(60);
-    auto store = WebCore::ResourceLoadObserver::sharedObserver().statisticsStore();
-    if (store)
-        store->clear();
+    WebCore::ResourceLoadObserver::sharedObserver().clearInMemoryStore();
 }
     
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -150,7 +150,9 @@
 void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins)
 {
     coreStore().mergeStatistics(origins);
-    coreStore().fireShouldPartitionCookiesHandler();
+    // Fire before processing statistics to propagate user
+    // interaction as fast as possible to the network process.
+    coreStore().fireShouldPartitionCookiesHandler(false);
     processStatisticsAndDataRecords();
 }
 
@@ -179,11 +181,11 @@
     });
 }
     
-void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& shouldPartitionCookiesForDomainsHandler)
+void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&& shouldPartitionCookiesForDomainsHandler)
 {
     registerSharedResourceLoadObserver();
-    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
-        shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
+    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst) {
+        shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd, clearFirst);
     });
     m_resourceLoadStatisticsStore->setWritePersistentStoreCallback([this]() {
         writeStoreToDisk();
@@ -196,7 +198,7 @@
         return;
 
     m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
-        coreStore().clear();
+        coreStore().clearInMemory();
 
         auto decoder = createDecoderFromDisk("full_browsing_session");
         if (!decoder)

Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -63,7 +63,7 @@
     void setResourceLoadStatisticsEnabled(bool);
     bool resourceLoadStatisticsEnabled() const;
     void registerSharedResourceLoadObserver();
-    void registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& shouldPartitionCookiesForDomainsHandler);
+    void registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)>&& shouldPartitionCookiesForDomainsHandler);
     
     void resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins);
 

Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp	2017-04-25 17:05:04 UTC (rev 215741)
@@ -1055,10 +1055,10 @@
 }
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
+void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst)
 {
     for (auto& processPool : processPools())
-        processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd));
+        processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd, clearFirst));
 }
 #endif
 
@@ -1235,8 +1235,8 @@
     
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     m_resourceLoadStatistics->registerSharedResourceLoadObserver(
-        [this] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
-            this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd);
+        [this] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst) {
+            this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd, clearFirst);
         });
 #else
     m_resourceLoadStatistics->registerSharedResourceLoadObserver();

Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (215740 => 215741)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2017-04-25 17:01:42 UTC (rev 215740)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2017-04-25 17:05:04 UTC (rev 215741)
@@ -92,7 +92,7 @@
     void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Vector<String>&& topPrivatelyControlledDomains, std::function<void(Vector<String>)> completionHandler);
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, bool clearFirst);
 #endif
     void resolveDirectoriesIfNecessary();
     const String& resolvedApplicationCacheDirectory() const { return m_resolvedConfiguration.applicationCacheDirectory; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to