Changeset 213871 in webkit


Ignore:
Timestamp:
Mar 13, 2017 2:50:50 PM (7 years ago)
Author:
wilander@apple.com
Message:

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.

Source/WebCore:

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.

Source/WebKit2:

  • 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:
Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r213869 r213871  
     12017-03-13  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
     4        https://bugs.webkit.org/show_bug.cgi?id=169506
     5
     6        Reviewed by Alex Christensen.
     7
     8        Covered by previous test which now follows the code path more closely to when reporting
     9        happens in the web process.
     10
     11        * loader/ResourceLoadObserver.cpp:
     12        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
     13            No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
     14            Instead just calls ResourceLoadStatisticsStore::fireDataModificationHandler().
     15        (WebCore::ResourceLoadObserver::logUserInteraction):
     16            Updated to call the new ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
     17        (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
     18            Now takes two vectors – domainsToRemove and domainsToAdd.
     19        * loader/ResourceLoadObserver.h:
     20        * loader/ResourceLoadStatistics.cpp:
     21        (WebCore::ResourceLoadStatistics::toString):
     22            Added boolean field isMarkedForCookiePartitioning.
     23        (WebCore::ResourceLoadStatistics::merge):
     24            Added boolean field isMarkedForCookiePartitioning.
     25        * loader/ResourceLoadStatistics.h:
     26            Added boolean field isMarkedForCookiePartitioning.
     27        * loader/ResourceLoadStatisticsStore.cpp:
     28        (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
     29            Now marks statistics with isMarkedForCookiePartitioning before sending them off to
     30            ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
     31        (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
     32            Now accepts a handler with two vectors.
     33        (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
     34            Now the only exported version of this function is the one without arguments.
     35            The one internal to WebCore accepts two vectors – domainsToRemove and domainsToAdd.
     36            The exported one generates the two vectors and then calls the internal one.
     37        (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
     38            No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
     39        * loader/ResourceLoadStatisticsStore.h:
     40        * platform/network/NetworkStorageSession.h:
     41        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
     42        (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
     43            Now takes two vectors – domainsToRemove and domainsToAdd.
     44
    1452017-03-13  Dean Jackson  <dino@apple.com>
    246
  • trunk/Source/WebCore/loader/ResourceLoadObserver.cpp

    r213688 r213871  
    327327    statistics.mostRecentUserInteraction = newTimestamp;
    328328
    329     m_store->fireShouldPartitionCookiesHandler(primaryDomainStr, false);
    330329    m_store->fireDataModificationHandler();
    331330}
     
    342341    statistics.mostRecentUserInteraction = WTF::currentTime();
    343342
    344     m_store->fireShouldPartitionCookiesHandler(primaryDomainStr, false);
     343    m_store->fireShouldPartitionCookiesHandler({primaryDomainStr}, { });
    345344}
    346345
     
    433432}
    434433
    435 void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
    436 {
    437     m_store->fireShouldPartitionCookiesHandler(primaryDomain(hostName), value);
     434void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
     435{
     436    m_store->fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
    438437}
    439438
  • trunk/Source/WebCore/loader/ResourceLoadObserver.h

    r213688 r213871  
    6767
    6868    WEBCORE_EXPORT void fireDataModificationHandler();
    69     WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String& primaryDomain, bool value);
     69    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
    7070
    7171    WEBCORE_EXPORT RefPtr<ResourceLoadStatisticsStore> statisticsStore();
  • trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp

    r212183 r213871  
    295295    builder.append('\n');
    296296
     297    // In-memory only
     298    appendBoolean(builder, "isMarkedForCookiePartitioning", isMarkedForCookiePartitioning);
     299    builder.append('\n');
     300
    297301    builder.append('\n');
    298302
     
    354358    isPrevalentResource |= other.isPrevalentResource;
    355359    dataRecordsRemoved += other.dataRecordsRemoved;
    356 }
    357 
    358 }
     360   
     361    // In-memory only
     362    isMarkedForCookiePartitioning |= other.isMarkedForCookiePartitioning;
     363}
     364
     365}
  • trunk/Source/WebCore/loader/ResourceLoadStatistics.h

    r212183 r213871  
    8888    bool isPrevalentResource { false };
    8989    unsigned dataRecordsRemoved { 0 };
     90
     91    // In-memory only
     92    bool isMarkedForCookiePartitioning { false };
    9093};
    9194
  • trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp

    r213688 r213871  
    104104    prevalentResourceDomainsWithoutUserInteraction.reserveInitialCapacity(loadedStatistics.size());
    105105    for (auto& statistics : loadedStatistics) {
     106        if (statistics.isPrevalentResource && !statistics.hadUserInteraction) {
     107            prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
     108            statistics.isMarkedForCookiePartitioning = true;
     109        }
    106110        m_resourceStatisticsMap.set(statistics.highLevelDomain, statistics);
    107         if (statistics.isPrevalentResource && !statistics.hadUserInteraction)
    108             prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
    109     }
    110    
    111     fireShouldPartitionCookiesHandler(prevalentResourceDomainsWithoutUserInteraction, true);
     111    }
     112
     113    fireShouldPartitionCookiesHandler({ }, prevalentResourceDomainsWithoutUserInteraction);
    112114}
    113115
     
    156158}
    157159
    158 void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& primaryDomains, bool value)>&& handler)
     160void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& handler)
    159161{
    160162    m_shouldPartitionCookiesForDomainsHandler = WTFMove(handler);
     
    172174}
    173175
    174 void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const String& primaryDomain, bool value)
    175 {
    176     Vector<String> domainVector;
    177     domainVector.append(primaryDomain);
    178     fireShouldPartitionCookiesHandler(domainVector, value);
    179 }
    180 
    181 void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& primaryDomains, bool value)
    182 {
     176void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
     177{
     178    Vector<String> domainsToRemove;
     179    Vector<String> domainsToAdd;
     180   
     181    for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
     182        bool recentUserInteraction = hasHadRecentUserInteraction(resourceStatistic);
     183        if (resourceStatistic.isMarkedForCookiePartitioning && recentUserInteraction) {
     184            resourceStatistic.isMarkedForCookiePartitioning = false;
     185            domainsToRemove.append(resourceStatistic.highLevelDomain);
     186        } else if (!resourceStatistic.isMarkedForCookiePartitioning && !recentUserInteraction && resourceStatistic.isPrevalentResource) {
     187            resourceStatistic.isMarkedForCookiePartitioning = true;
     188            domainsToAdd.append(resourceStatistic.highLevelDomain);
     189        }
     190    }
     191   
     192    fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
     193}
     194
     195void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
     196{
     197    if (domainsToRemove.isEmpty() && domainsToAdd.isEmpty())
     198        return;
     199
    183200    if (m_shouldPartitionCookiesForDomainsHandler)
    184         m_shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
     201        m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
    185202}
    186203
     
    209226        resourceStatistic.hadUserInteraction = false;
    210227
    211         if (resourceStatistic.isPrevalentResource)
    212             fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
    213 
    214228        return false;
    215229    }
  • trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h

    r213688 r213871  
    5959
    6060    WEBCORE_EXPORT void setNotificationCallback(std::function<void()>);
    61     WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& primaryDomains, bool value)>&&);
     61    WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&&);
    6262    WEBCORE_EXPORT void setWritePersistentStoreCallback(std::function<void()>&&);
    63 
    6463
    6564    void fireDataModificationHandler();
    6665    void setTimeToLiveUserInteraction(double seconds);
    67     WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String& primaryDomain, bool value);
    68     WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& primaryDomain, bool value);
     66    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler();
     67    void fireShouldPartitionCookiesHandler(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
    6968
    7069    WEBCORE_EXPORT void processStatistics(std::function<void(ResourceLoadStatistics&)>&&);
     
    7877    HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap;
    7978    std::function<void()> m_dataAddedHandler;
    80     std::function<void(const Vector<String>& primaryDomains, bool value)> m_shouldPartitionCookiesForDomainsHandler;
     79    std::function<void(const Vector<String>&, const Vector<String>&)> m_shouldPartitionCookiesForDomainsHandler;
    8180    std::function<void()> m_writePersistentStoreHandler;
    8281};
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.h

    r213759 r213871  
    8181#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    8282    WEBCORE_EXPORT bool shouldPartitionCookiesForHost(const String&);
    83     WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>&, bool value);
     83    WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
    8484#endif
    8585#elif USE(SOUP)
  • trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp

    r213759 r213871  
    155155}
    156156
    157 void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector<String>& hosts, bool value)
     157void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
    158158{
    159     if (value)
    160         m_topPrivatelyControlledDomainsForCookiePartitioning.add(hosts.begin(), hosts.end());
    161     else {
    162         for (auto& host : hosts)
    163             m_topPrivatelyControlledDomainsForCookiePartitioning.remove(host);
     159    if (!domainsToRemove.isEmpty()) {
     160        for (auto& domain : domainsToRemove)
     161            m_topPrivatelyControlledDomainsForCookiePartitioning.remove(domain);
    164162    }
     163       
     164    if (!domainsToAdd.isEmpty())
     165        m_topPrivatelyControlledDomainsForCookiePartitioning.add(domainsToAdd.begin(), domainsToAdd.end());
    165166}
    166167
  • trunk/Source/WebKit2/ChangeLog

    r213869 r213871  
     12017-03-13  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
     4        https://bugs.webkit.org/show_bug.cgi?id=169506
     5
     6        Reviewed by Alex Christensen.
     7
     8        * NetworkProcess/NetworkProcess.cpp:
     9        (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
     10            Now takes two vectors – domainsToRemove and domainsToAdd.
     11        * NetworkProcess/NetworkProcess.h:
     12        * NetworkProcess/NetworkProcess.messages.in:
     13            The message now takes two vectors – domainsToRemove and domainsToAdd.
     14        * UIProcess/Network/NetworkProcessProxy.cpp:
     15        (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
     16            Now takes two vectors – domainsToRemove and domainsToAdd.
     17        * UIProcess/Network/NetworkProcessProxy.h:
     18        * UIProcess/Network/NetworkProcessProxy.messages.in:
     19            The message now takes two vectors – domainsToRemove and domainsToAdd.
     20        * UIProcess/WebResourceLoadStatisticsManager.cpp:
     21        (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
     22            Now converts to the two vectors needed by
     23            WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
     24        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     25        (WebKit::WebResourceLoadStatisticsStore::classifyResource):
     26            No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
     27        (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
     28            Changed the order of two blocks to not build a vector if we are to return early.
     29        (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
     30            Now calls WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
     31        (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
     32            Now takes a handler with two vectors – domainsToRemove and domainsToAdd.
     33        * UIProcess/WebResourceLoadStatisticsStore.h:
     34        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     35        (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
     36            Now takes two vectors – domainsToRemove and domainsToAdd.
     37        (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
     38            Now submits a handler that takes two vectors – domainsToRemove and domainsToAdd.
     39        * UIProcess/WebsiteData/WebsiteDataStore.h:
     40
    1412017-03-13  Dean Jackson  <dino@apple.com>
    242
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r213760 r213871  
    312312
    313313#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    314 void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domains, bool value)
    315 {
    316     NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domains, value);
     314void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
     315{
     316    NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domainsToRemove, domainsToAdd);
    317317}
    318318#endif
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h

    r213623 r213871  
    118118
    119119#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    120     void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
     120    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
    121121#endif
    122122
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in

    r213623 r213871  
    8080
    8181#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    82     ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> topPrivatelyOwnedDomains, bool value)
     82    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd)
    8383#endif
    8484}
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp

    r213623 r213871  
    294294
    295295#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    296 void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& topPrivatelyOwnedDomains, bool value)
    297 {
    298     connection()->send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value), 0);
     296void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
     297{
     298    connection()->send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd), 0);
    299299}
    300300#endif
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h

    r213623 r213871  
    111111    void grantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, const Vector<String>& paths);
    112112#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    113     void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
     113    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
    114114#endif
    115115    void logDiagnosticMessage(uint64_t pageID, const String& message, const String& description, WebCore::ShouldSample);
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in

    r213623 r213871  
    3333
    3434#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    35     ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> topPrivatelyOwnedDomains, bool value)
     35    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> domainsToRemove, Vector<String> domainsToAdd)
    3636#endif
    3737
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp

    r213688 r213871  
    8989void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
    9090{
    91     WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler(hostName, value);
     91    if (value)
     92        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({ }, {hostName});
     93    else
     94        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({hostName}, { });
    9295}
    9396
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp

    r213688 r213871  
    8686{
    8787    if (!resourceStatistic.isPrevalentResource
    88         && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) {
     88        && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
    8989        resourceStatistic.isPrevalentResource = true;
    90         if (!resourceStatistic.hadUserInteraction)
    91             m_resourceLoadStatisticsStore->fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
    92     }
    9390}
    9491
     
    9693{
    9794    if (m_dataRecordsRemovalPending)
    98         return;
    99 
    100     Vector<String> prevalentResourceDomains = coreStore().prevalentResourceDomainsWithoutUserInteraction();
    101     if (!prevalentResourceDomains.size())
    10295        return;
    10396
     
    107100        return;
    108101
     102    Vector<String> prevalentResourceDomains = coreStore().prevalentResourceDomainsWithoutUserInteraction();
     103    if (!prevalentResourceDomains.size())
     104        return;
     105   
    109106    m_dataRecordsRemovalPending = true;
    110107    m_lastTimeDataRecordsWereRemoved = now;
     
    154151{
    155152    coreStore().mergeStatistics(origins);
     153    coreStore().fireShouldPartitionCookiesHandler();
    156154    processStatisticsAndDataRecords();
    157155}
     
    182180}
    183181   
    184 void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function<void(const Vector<String>& primaryDomain, bool value)>&& shouldPartitionCookiesForDomainsHandler)
     182void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& shouldPartitionCookiesForDomainsHandler)
    185183{
    186184    registerSharedResourceLoadObserver();
    187     m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& primaryDomains, bool value) {
    188         shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
     185    m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
     186        shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
    189187    });
    190188    m_resourceLoadStatisticsStore->setWritePersistentStoreCallback([this]() {
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h

    r213688 r213871  
    6464    bool resourceLoadStatisticsEnabled() const;
    6565    void registerSharedResourceLoadObserver();
    66     void registerSharedResourceLoadObserver(std::function<void(const Vector<String>& primaryDomain, bool value)>&& shouldPartitionCookiesForDomainsHandler);
     66    void registerSharedResourceLoadObserver(std::function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)>&& shouldPartitionCookiesForDomainsHandler);
    6767   
    6868    void resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& origins);
  • trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r213690 r213871  
    10601060
    10611061#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    1062 void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& topPrivatelyOwnedDomains, bool value)
     1062void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd)
    10631063{
    10641064    for (auto& processPool : processPools())
    1065         processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value));
     1065        processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd));
    10661066}
    10671067#endif
     
    12341234#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    12351235    m_resourceLoadStatistics->registerSharedResourceLoadObserver(
    1236         [this] (const Vector<String>& topPrivatelyOwnedDomains, bool value) {
    1237             this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value);
     1236        [this] (const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd) {
     1237            this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd);
    12381238        });
    12391239#else
  • trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h

    r213690 r213871  
    9393
    9494#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    95     void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
     95    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd);
    9696#endif
    9797    void resolveDirectoriesIfNecessary();
Note: See TracChangeset for help on using the changeset viewer.