<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213871] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213871">213871</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2017-03-13 14:50:50 -0700 (Mon, 13 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadObservercpp">trunk/Source/WebCore/loader/ResourceLoadObserver.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadObserverh">trunk/Source/WebCore/loader/ResourceLoadObserver.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadStatisticscpp">trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadStatisticsh">trunk/Source/WebCore/loader/ResourceLoadStatistics.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadStatisticsStorecpp">trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadStatisticsStoreh">trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkStorageSessionh">trunk/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfNetworkStorageSessionCFNetcpp">trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessmessagesin">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxyh">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsManagercpp">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStorecpp">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStoreh">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStoreh">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2017-03-13  John Wilander  &lt;wilander@apple.com&gt;
+
+        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.
+
</ins><span class="cx"> 2017-03-13  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Respect the runtime flag for WebGPU, default feature to off.
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadObservercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -326,7 +326,6 @@
</span><span class="cx">     statistics.hadUserInteraction = true;
</span><span class="cx">     statistics.mostRecentUserInteraction = newTimestamp;
</span><span class="cx"> 
</span><del>-    m_store-&gt;fireShouldPartitionCookiesHandler(primaryDomainStr, false);
</del><span class="cx">     m_store-&gt;fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -341,7 +340,7 @@
</span><span class="cx">     statistics.hadUserInteraction = true;
</span><span class="cx">     statistics.mostRecentUserInteraction = WTF::currentTime();
</span><span class="cx"> 
</span><del>-    m_store-&gt;fireShouldPartitionCookiesHandler(primaryDomainStr, false);
</del><ins>+    m_store-&gt;fireShouldPartitionCookiesHandler({primaryDomainStr}, { });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoadObserver::clearUserInteraction(const URL&amp; url)
</span><span class="lines">@@ -432,9 +431,9 @@
</span><span class="cx">     m_store-&gt;fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const String&amp; hostName, bool value)
</del><ins>+void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</ins><span class="cx"> {
</span><del>-    m_store-&gt;fireShouldPartitionCookiesHandler(primaryDomain(hostName), value);
</del><ins>+    m_store-&gt;fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String ResourceLoadObserver::primaryDomain(const URL&amp; url)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadObserverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     WEBCORE_EXPORT void setReducedTimestampResolution(double seconds);
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void fireDataModificationHandler();
</span><del>-    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String&amp; primaryDomain, bool value);
</del><ins>+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT RefPtr&lt;ResourceLoadStatisticsStore&gt; statisticsStore();
</span><span class="cx">     WEBCORE_EXPORT void setStatisticsStore(Ref&lt;ResourceLoadStatisticsStore&gt;&amp;&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadStatisticscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -294,8 +294,12 @@
</span><span class="cx">     builder.appendNumber(dataRecordsRemoved);
</span><span class="cx">     builder.append('\n');
</span><span class="cx"> 
</span><ins>+    // In-memory only
+    appendBoolean(builder, &quot;isMarkedForCookiePartitioning&quot;, isMarkedForCookiePartitioning);
</ins><span class="cx">     builder.append('\n');
</span><span class="cx"> 
</span><ins>+    builder.append('\n');
+
</ins><span class="cx">     return builder.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -353,6 +357,9 @@
</span><span class="cx">     mergeHashCountedSet(redirectedToOtherPrevalentResourceOrigins, other.redirectedToOtherPrevalentResourceOrigins);
</span><span class="cx">     isPrevalentResource |= other.isPrevalentResource;
</span><span class="cx">     dataRecordsRemoved += other.dataRecordsRemoved;
</span><ins>+    
+    // In-memory only
+    isMarkedForCookiePartitioning |= other.isMarkedForCookiePartitioning;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadStatisticsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -87,6 +87,9 @@
</span><span class="cx">     HashCountedSet&lt;String&gt; redirectedToOtherPrevalentResourceOrigins;
</span><span class="cx">     bool isPrevalentResource { false };
</span><span class="cx">     unsigned dataRecordsRemoved { 0 };
</span><ins>+
+    // In-memory only
+    bool isMarkedForCookiePartitioning { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -103,12 +103,14 @@
</span><span class="cx">     Vector&lt;String&gt; prevalentResourceDomainsWithoutUserInteraction;
</span><span class="cx">     prevalentResourceDomainsWithoutUserInteraction.reserveInitialCapacity(loadedStatistics.size());
</span><span class="cx">     for (auto&amp; statistics : loadedStatistics) {
</span><ins>+        if (statistics.isPrevalentResource &amp;&amp; !statistics.hadUserInteraction) {
+            prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
+            statistics.isMarkedForCookiePartitioning = true;
+        }
</ins><span class="cx">         m_resourceStatisticsMap.set(statistics.highLevelDomain, statistics);
</span><del>-        if (statistics.isPrevalentResource &amp;&amp; !statistics.hadUserInteraction)
-            prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
</del><span class="cx">     }
</span><del>-    
-    fireShouldPartitionCookiesHandler(prevalentResourceDomainsWithoutUserInteraction, true);
</del><ins>+
+    fireShouldPartitionCookiesHandler({ }, prevalentResourceDomainsWithoutUserInteraction);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoadStatisticsStore::clearInMemoryAndPersistent()
</span><span class="lines">@@ -155,7 +157,7 @@
</span><span class="cx">     m_dataAddedHandler = WTFMove(handler);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomains, bool value)&gt;&amp;&amp; handler)
</del><ins>+void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function&lt;void(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)&gt;&amp;&amp; handler)
</ins><span class="cx"> {
</span><span class="cx">     m_shouldPartitionCookiesForDomainsHandler = WTFMove(handler);
</span><span class="cx"> }
</span><span class="lines">@@ -171,17 +173,32 @@
</span><span class="cx">         m_dataAddedHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const String&amp; primaryDomain, bool value)
</del><ins>+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
</ins><span class="cx"> {
</span><del>-    Vector&lt;String&gt; domainVector;
-    domainVector.append(primaryDomain);
-    fireShouldPartitionCookiesHandler(domainVector, value);
</del><ins>+    Vector&lt;String&gt; domainsToRemove;
+    Vector&lt;String&gt; domainsToAdd;
+    
+    for (auto&amp; resourceStatistic : m_resourceStatisticsMap.values()) {
+        bool recentUserInteraction = hasHadRecentUserInteraction(resourceStatistic);
+        if (resourceStatistic.isMarkedForCookiePartitioning &amp;&amp; recentUserInteraction) {
+            resourceStatistic.isMarkedForCookiePartitioning = false;
+            domainsToRemove.append(resourceStatistic.highLevelDomain);
+        } else if (!resourceStatistic.isMarkedForCookiePartitioning &amp;&amp; !recentUserInteraction &amp;&amp; resourceStatistic.isPrevalentResource) {
+            resourceStatistic.isMarkedForCookiePartitioning = true;
+            domainsToAdd.append(resourceStatistic.highLevelDomain);
+        }
+    }
+    
+    fireShouldPartitionCookiesHandler(domainsToRemove, domainsToAdd);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; primaryDomains, bool value)
</del><ins>+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</ins><span class="cx"> {
</span><ins>+    if (domainsToRemove.isEmpty() &amp;&amp; domainsToAdd.isEmpty())
+        return;
+
</ins><span class="cx">     if (m_shouldPartitionCookiesForDomainsHandler)
</span><del>-        m_shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
</del><ins>+        m_shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(double seconds)
</span><span class="lines">@@ -208,9 +225,6 @@
</span><span class="cx">         resourceStatistic.mostRecentUserInteraction = 0;
</span><span class="cx">         resourceStatistic.hadUserInteraction = false;
</span><span class="cx"> 
</span><del>-        if (resourceStatistic.isPrevalentResource)
-            fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
-
</del><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -58,14 +58,13 @@
</span><span class="cx">     WEBCORE_EXPORT Vector&lt;ResourceLoadStatistics&gt; takeStatistics();
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void setNotificationCallback(std::function&lt;void()&gt;);
</span><del>-    WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomains, bool value)&gt;&amp;&amp;);
</del><ins>+    WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function&lt;void(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)&gt;&amp;&amp;);
</ins><span class="cx">     WEBCORE_EXPORT void setWritePersistentStoreCallback(std::function&lt;void()&gt;&amp;&amp;);
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     void fireDataModificationHandler();
</span><span class="cx">     void setTimeToLiveUserInteraction(double seconds);
</span><del>-    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String&amp; primaryDomain, bool value);
-    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; primaryDomain, bool value);
</del><ins>+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler();
+    void fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void processStatistics(std::function&lt;void(ResourceLoadStatistics&amp;)&gt;&amp;&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -77,7 +76,7 @@
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;String, ResourceLoadStatistics&gt; m_resourceStatisticsMap;
</span><span class="cx">     std::function&lt;void()&gt; m_dataAddedHandler;
</span><del>-    std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomains, bool value)&gt; m_shouldPartitionCookiesForDomainsHandler;
</del><ins>+    std::function&lt;void(const Vector&lt;String&gt;&amp;, const Vector&lt;String&gt;&amp;)&gt; m_shouldPartitionCookiesForDomainsHandler;
</ins><span class="cx">     std::function&lt;void()&gt; m_writePersistentStoreHandler;
</span><span class="cx"> };
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">     WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool);
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><span class="cx">     WEBCORE_EXPORT bool shouldPartitionCookiesForHost(const String&amp;);
</span><del>-    WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp;, bool value);
</del><ins>+    WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</ins><span class="cx"> #endif
</span><span class="cx"> #elif USE(SOUP)
</span><span class="cx">     NetworkStorageSession(SessionID, std::unique_ptr&lt;SoupNetworkSession&gt;&amp;&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfNetworkStorageSessionCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -154,14 +154,15 @@
</span><span class="cx">     return m_topPrivatelyControlledDomainsForCookiePartitioning.contains(domain);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp; hosts, bool value)
</del><ins>+void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</ins><span class="cx"> {
</span><del>-    if (value)
-        m_topPrivatelyControlledDomainsForCookiePartitioning.add(hosts.begin(), hosts.end());
-    else {
-        for (auto&amp; host : hosts)
-            m_topPrivatelyControlledDomainsForCookiePartitioning.remove(host);
</del><ins>+    if (!domainsToRemove.isEmpty()) {
+        for (auto&amp; domain : domainsToRemove)
+            m_topPrivatelyControlledDomainsForCookiePartitioning.remove(domain);
</ins><span class="cx">     }
</span><ins>+        
+    if (!domainsToAdd.isEmpty())
+        m_topPrivatelyControlledDomainsForCookiePartitioning.add(domainsToAdd.begin(), domainsToAdd.end());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2017-03-13  John Wilander  &lt;wilander@apple.com&gt;
+
+        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:
+
</ins><span class="cx"> 2017-03-13  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Respect the runtime flag for WebGPU, default feature to off, and print a warning
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -311,9 +311,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domains, bool value)
</del><ins>+void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</ins><span class="cx"> {
</span><del>-    NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domains, value);
</del><ins>+    NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domainsToRemove, domainsToAdd);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx">     void grantSandboxExtensionsToDatabaseProcessForBlobs(const Vector&lt;String&gt;&amp; filenames, Function&lt;void ()&gt;&amp;&amp; completionHandler);
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp;, bool value);
</del><ins>+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     std::chrono::milliseconds loadThrottleLatency() const { return m_loadThrottleLatency; }
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -79,6 +79,6 @@
</span><span class="cx">     DidGrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID)
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector&lt;String&gt; topPrivatelyOwnedDomains, bool value)
</del><ins>+    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector&lt;String&gt; domainsToRemove, Vector&lt;String&gt; domainsToAdd)
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -293,9 +293,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, bool value)
</del><ins>+void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</ins><span class="cx"> {
</span><del>-    connection()-&gt;send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value), 0);
</del><ins>+    connection()-&gt;send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd), 0);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx">     void didDeleteWebsiteDataForOrigins(uint64_t callbackID);
</span><span class="cx">     void grantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, const Vector&lt;String&gt;&amp; paths);
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp;, bool value);
</del><ins>+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</ins><span class="cx"> #endif
</span><span class="cx">     void logDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description, WebCore::ShouldSample);
</span><span class="cx">     void logDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result, WebCore::ShouldSample);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">     GrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, Vector&lt;String&gt; paths)
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector&lt;String&gt; topPrivatelyOwnedDomains, bool value)
</del><ins>+    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector&lt;String&gt; domainsToRemove, Vector&lt;String&gt; domainsToAdd)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     ProcessReadyToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -88,7 +88,10 @@
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const String&amp; hostName, bool value)
</span><span class="cx"> {
</span><del>-    WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler(hostName, value);
</del><ins>+    if (value)
+        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({ }, {hostName});
+    else
+        WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler({hostName}, { });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoadStatisticsManager::setNotifyPagesWhenDataRecordsWereScanned(bool value)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -85,11 +85,8 @@
</span><span class="cx"> void WebResourceLoadStatisticsStore::classifyResource(ResourceLoadStatistics&amp; resourceStatistic)
</span><span class="cx"> {
</span><span class="cx">     if (!resourceStatistic.isPrevalentResource
</span><del>-        &amp;&amp; m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) {
</del><ins>+        &amp;&amp; m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
</ins><span class="cx">         resourceStatistic.isPrevalentResource = true;
</span><del>-        if (!resourceStatistic.hadUserInteraction)
-            m_resourceLoadStatisticsStore-&gt;fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoadStatisticsStore::removeDataRecords()
</span><span class="lines">@@ -97,15 +94,15 @@
</span><span class="cx">     if (m_dataRecordsRemovalPending)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    Vector&lt;String&gt; prevalentResourceDomains = coreStore().prevalentResourceDomainsWithoutUserInteraction();
-    if (!prevalentResourceDomains.size())
-        return;
-
</del><span class="cx">     double now = currentTime();
</span><span class="cx">     if (m_lastTimeDataRecordsWereRemoved
</span><span class="cx">         &amp;&amp; now &lt; m_lastTimeDataRecordsWereRemoved + minimumTimeBetweeenDataRecordsRemoval)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    Vector&lt;String&gt; prevalentResourceDomains = coreStore().prevalentResourceDomainsWithoutUserInteraction();
+    if (!prevalentResourceDomains.size())
+        return;
+    
</ins><span class="cx">     m_dataRecordsRemovalPending = true;
</span><span class="cx">     m_lastTimeDataRecordsWereRemoved = now;
</span><span class="cx"> 
</span><span class="lines">@@ -153,6 +150,7 @@
</span><span class="cx"> void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(const Vector&lt;WebCore::ResourceLoadStatistics&gt;&amp; origins)
</span><span class="cx"> {
</span><span class="cx">     coreStore().mergeStatistics(origins);
</span><ins>+    coreStore().fireShouldPartitionCookiesHandler();
</ins><span class="cx">     processStatisticsAndDataRecords();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -181,11 +179,11 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomain, bool value)&gt;&amp;&amp; shouldPartitionCookiesForDomainsHandler)
</del><ins>+void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function&lt;void(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)&gt;&amp;&amp; shouldPartitionCookiesForDomainsHandler)
</ins><span class="cx"> {
</span><span class="cx">     registerSharedResourceLoadObserver();
</span><del>-    m_resourceLoadStatisticsStore-&gt;setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector&lt;String&gt;&amp; primaryDomains, bool value) {
-        shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
</del><ins>+    m_resourceLoadStatisticsStore-&gt;setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd) {
+        shouldPartitionCookiesForDomainsHandler(domainsToRemove, domainsToAdd);
</ins><span class="cx">     });
</span><span class="cx">     m_resourceLoadStatisticsStore-&gt;setWritePersistentStoreCallback([this]() {
</span><span class="cx">         writeStoreToDisk();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     void setResourceLoadStatisticsEnabled(bool);
</span><span class="cx">     bool resourceLoadStatisticsEnabled() const;
</span><span class="cx">     void registerSharedResourceLoadObserver();
</span><del>-    void registerSharedResourceLoadObserver(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomain, bool value)&gt;&amp;&amp; shouldPartitionCookiesForDomainsHandler);
</del><ins>+    void registerSharedResourceLoadObserver(std::function&lt;void(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)&gt;&amp;&amp; shouldPartitionCookiesForDomainsHandler);
</ins><span class="cx">     
</span><span class="cx">     void resourceLoadStatisticsUpdated(const Vector&lt;WebCore::ResourceLoadStatistics&gt;&amp; origins);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1059,10 +1059,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, bool value)
</del><ins>+void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</ins><span class="cx"> {
</span><span class="cx">     for (auto&amp; processPool : processPools())
</span><del>-        processPool-&gt;sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value));
</del><ins>+        processPool-&gt;sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -1233,8 +1233,8 @@
</span><span class="cx">     
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><span class="cx">     m_resourceLoadStatistics-&gt;registerSharedResourceLoadObserver(
</span><del>-        [this] (const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, bool value) {
-            this-&gt;shouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value);
</del><ins>+        [this] (const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd) {
+            this-&gt;shouldPartitionCookiesForTopPrivatelyOwnedDomains(domainsToRemove, domainsToAdd);
</ins><span class="cx">         });
</span><span class="cx"> #else
</span><span class="cx">     m_resourceLoadStatistics-&gt;registerSharedResourceLoadObserver();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (213870 => 213871)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">     void removeDataForTopPrivatelyOwnedDomains(OptionSet&lt;WebsiteDataType&gt;, OptionSet&lt;WebsiteDataFetchOption&gt;, const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, std::function&lt;void(Vector&lt;String&gt;)&gt; completionHandler);
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp;, bool value);
</del><ins>+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</ins><span class="cx"> #endif
</span><span class="cx">     void resolveDirectoriesIfNecessary();
</span><span class="cx">     const String&amp; resolvedApplicationCacheDirectory() const { return m_resolvedConfiguration.applicationCacheDirectory; }
</span></span></pre>
</div>
</div>

</body>
</html>