<!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>[225984] trunk/Source/WebKit</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/225984">225984</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2017-12-15 13:27:24 -0800 (Fri, 15 Dec 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Avoid waking plugin process up unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=180819
<rdar://problem/36051548>

Reviewed by Geoffrey Garen.

WebKit purges data from origins marked as prevalent on an hourly interval. This includes waking up plugins
and removing relevant data stored in those plugins. This causes multiple plugin processes to be spawned,
even though the user is not interacting with any plugins.

Instead, we should delay removing data from plugins until they are loaded due to the user interacting with
a website using a plugin.

Make the following changes:
1. When looking for plugin data related to prevalent sites, only examine plugin data if the relevant plugin
   is already running.
2. When the state of the active plugins changes, trigger a data removal check.

* Shared/WebsiteData/WebsiteDataFetchOption.h: Add a new option 'DoNotCreateProcesses'
* UIProcess/Plugins/PluginProcessManager.cpp:
(WebKit::PluginProcessManager::getPluginProcessConnection): Pass new argument 'Launch', since we always
want to launch processes in this case.
(WebKit::PluginProcessManager::fetchWebsiteData): Pass a new parameter 'processAccessType' so that the
caller can specify if they only want to examine already-active plugins, or if they want to spawn new
processes. Call the completion handler if we need to exit early when no process exists.
(WebKit::PluginProcessManager::deleteWebsiteData): Always launch new processes.
(WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): Ditto.
(WebKit::PluginProcessManager::getOrCreatePluginProcess): Accept new parameter indicating if new processes
shoudl be launched. Also switch to C++ style loops.
* UIProcess/Plugins/PluginProcessManager.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Use the
new 'DoNotCreatePrcesses' access type.
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords): Update the active plugin count when we
remove data.
(WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords const): Return true if the active plugin
process count changed since the last time data was removed.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataAndApply): Check fetch option for new 'DoNotCreateProcesses' flag,
and tell the PluginProcessManager which mode we are using.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedWebsiteDataWebsiteDataFetchOptionh">trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataFetchOption.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessPluginsPluginProcessManagercpp">trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessPluginsPluginProcessManagerh">trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxycpp">trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebResourceLoadStatisticsStorecpp">trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebResourceLoadStatisticsStoreh">trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp">trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/ChangeLog       2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2017-12-15  Brent Fulgham  <bfulgham@apple.com>
+
+        Avoid waking plugin process up unnecessarily
+        https://bugs.webkit.org/show_bug.cgi?id=180819
+        <rdar://problem/36051548>
+
+        Reviewed by Geoffrey Garen.
+
+        WebKit purges data from origins marked as prevalent on an hourly interval. This includes waking up plugins
+        and removing relevant data stored in those plugins. This causes multiple plugin processes to be spawned,
+        even though the user is not interacting with any plugins.
+
+        Instead, we should delay removing data from plugins until they are loaded due to the user interacting with
+        a website using a plugin.
+
+        Make the following changes:
+        1. When looking for plugin data related to prevalent sites, only examine plugin data if the relevant plugin
+           is already running.
+        2. When the state of the active plugins changes, trigger a data removal check.
+
+        * Shared/WebsiteData/WebsiteDataFetchOption.h: Add a new option 'DoNotCreateProcesses'
+        * UIProcess/Plugins/PluginProcessManager.cpp:
+        (WebKit::PluginProcessManager::getPluginProcessConnection): Pass new argument 'Launch', since we always
+        want to launch processes in this case.
+        (WebKit::PluginProcessManager::fetchWebsiteData): Pass a new parameter 'processAccessType' so that the
+        caller can specify if they only want to examine already-active plugins, or if they want to spawn new
+        processes. Call the completion handler if we need to exit early when no process exists.
+        (WebKit::PluginProcessManager::deleteWebsiteData): Always launch new processes.
+        (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): Ditto.
+        (WebKit::PluginProcessManager::getOrCreatePluginProcess): Accept new parameter indicating if new processes
+        shoudl be launched. Also switch to C++ style loops.
+        * UIProcess/Plugins/PluginProcessManager.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Use the
+        new 'DoNotCreatePrcesses' access type.
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::removeDataRecords): Update the active plugin count when we
+        remove data.
+        (WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords const): Return true if the active plugin
+        process count changed since the last time data was removed.
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::fetchDataAndApply): Check fetch option for new 'DoNotCreateProcesses' flag,
+        and tell the PluginProcessManager which mode we are using.
+
</ins><span class="cx"> 2017-12-15  Brady Eidson  <beidson@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Make sure only WebsiteDataStores with valid SessionIDs register themselves.
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebsiteDataWebsiteDataFetchOptionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataFetchOption.h (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataFetchOption.h  2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/Shared/WebsiteData/WebsiteDataFetchOption.h     2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,16 +23,14 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebsiteDataFetchOption_h
-#define WebsiteDataFetchOption_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> enum class WebsiteDataFetchOption {
</span><span class="cx">     ComputeSizes = 1 << 0,
</span><ins>+    DoNotCreateProcesses = 1 << 1,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-#endif // WebsiteDataFetchOption_h
</del></span></pre></div>
<a id="trunkSourceWebKitUIProcessPluginsPluginProcessManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp   2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp      2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><span class="cx"> #include "PluginProcessProxy.h"
</span><ins>+#include "WebsiteDataFetchOption.h"
</ins><span class="cx"> #include <wtf/CryptographicallyRandomNumber.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="lines">@@ -96,9 +97,14 @@
</span><span class="cx">     m_pluginProcesses.remove(vectorIndex);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PluginProcessManager::fetchWebsiteData(const PluginModuleInfo& plugin, WTF::Function<void (Vector<String>)>&& completionHandler)
</del><ins>+void PluginProcessManager::fetchWebsiteData(const PluginModuleInfo& plugin, OptionSet<WebsiteDataFetchOption> fetchOptions, WTF::Function<void (Vector<String>)>&& completionHandler)
</ins><span class="cx"> {
</span><del>-    PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal));
</del><ins>+    auto token = pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal);
+    auto pluginProcess = fetchOptions.contains(WebsiteDataFetchOption::DoNotCreateProcesses) ? getPluginProcess(token) : getOrCreatePluginProcess(token);
+    if (!pluginProcess) {
+        completionHandler({ });
+        return;
+    }
</ins><span class="cx"> 
</span><span class="cx">     pluginProcess->fetchWebsiteData(WTFMove(completionHandler));
</span><span class="cx"> }
</span><span class="lines">@@ -106,7 +112,6 @@
</span><span class="cx"> void PluginProcessManager::deleteWebsiteData(const PluginModuleInfo& plugin, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(pluginProcessToken(plugin, PluginProcessTypeNormal, PluginProcessSandboxPolicyNormal));
</span><del>-
</del><span class="cx">     pluginProcess->deleteWebsiteData(modifiedSince, WTFMove(completionHandler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -116,19 +121,25 @@
</span><span class="cx">     pluginProcess->deleteWebsiteDataForHostNames(hostNames, WTFMove(completionHandler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(uint64_t pluginProcessToken)
</del><ins>+PluginProcessProxy* PluginProcessManager::getPluginProcess(uint64_t pluginProcessToken)
</ins><span class="cx"> {
</span><del>-    for (size_t i = 0; i < m_pluginProcesses.size(); ++i) {
-        if (m_pluginProcesses[i]->pluginProcessToken() == pluginProcessToken)
-            return m_pluginProcesses[i].get();
</del><ins>+    for (auto pluginProcess : m_pluginProcesses) {
+        if (pluginProcess->pluginProcessToken() == pluginProcessToken)
+            return pluginProcess.get();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    for (size_t i = 0; i < m_pluginProcessTokens.size(); ++i) {
-        auto& attributesAndToken = m_pluginProcessTokens[i];
</del><ins>+    return nullptr;
+}
+
+PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(uint64_t pluginProcessToken)
+{
+    if (auto existingProcess = getPluginProcess(pluginProcessToken))
+        return existingProcess;
+
+    for (auto& attributesAndToken : m_pluginProcessTokens) {
</ins><span class="cx">         if (attributesAndToken.second == pluginProcessToken) {
</span><span class="cx">             auto pluginProcess = PluginProcessProxy::create(this, attributesAndToken.first, attributesAndToken.second);
</span><span class="cx">             PluginProcessProxy* pluginProcessPtr = pluginProcess.ptr();
</span><del>-
</del><span class="cx">             m_pluginProcesses.append(WTFMove(pluginProcess));
</span><span class="cx">             return pluginProcessPtr;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessPluginsPluginProcessManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h     2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h        2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> class PluginInfoStore;
</span><span class="cx"> class PluginProcessProxy;
</span><span class="cx"> class WebProcessProxy;
</span><ins>+enum class WebsiteDataFetchOption;
</ins><span class="cx"> 
</span><span class="cx"> class PluginProcessManager {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PluginProcessManager);
</span><span class="lines">@@ -59,7 +60,7 @@
</span><span class="cx">     void getPluginProcessConnection(uint64_t pluginProcessToken, Ref<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>&&);
</span><span class="cx">     void removePluginProcessProxy(PluginProcessProxy*);
</span><span class="cx"> 
</span><del>-    void fetchWebsiteData(const PluginModuleInfo&, WTF::Function<void (Vector<String>)>&& completionHandler);
</del><ins>+    void fetchWebsiteData(const PluginModuleInfo&, OptionSet<WebsiteDataFetchOption>, WTF::Function<void (Vector<String>)>&& completionHandler);
</ins><span class="cx">     void deleteWebsiteData(const PluginModuleInfo&, std::chrono::system_clock::time_point modifiedSince, WTF::Function<void ()>&& completionHandler);
</span><span class="cx">     void deleteWebsiteDataForHostNames(const PluginModuleInfo&, const Vector<String>& hostNames, WTF::Function<void ()>&& completionHandler);
</span><span class="cx"> 
</span><span class="lines">@@ -74,6 +75,7 @@
</span><span class="cx"> private:
</span><span class="cx">     PluginProcessManager();
</span><span class="cx"> 
</span><ins>+    PluginProcessProxy* getPluginProcess(uint64_t pluginProcessToken);
</ins><span class="cx">     PluginProcessProxy* getOrCreatePluginProcess(uint64_t pluginProcessToken);
</span><span class="cx"> 
</span><span class="cx">     Vector<std::pair<PluginProcessAttributes, uint64_t>> m_pluginProcessTokens;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp        2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp   2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include "WebProcessProxyMessages.h"
</span><span class="cx"> #include "WebUserContentControllerProxy.h"
</span><span class="cx"> #include "WebsiteData.h"
</span><ins>+#include "WebsiteDataFetchOption.h"
</ins><span class="cx"> #include <WebCore/DiagnosticLoggingKeys.h>
</span><span class="cx"> #include <WebCore/PublicSuffix.h>
</span><span class="cx"> #include <WebCore/SuddenTermination.h>
</span><span class="lines">@@ -244,6 +245,7 @@
</span><span class="cx">     };
</span><span class="cx">     
</span><span class="cx">     RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));
</span><ins>+    OptionSet<WebsiteDataFetchOption> fetchOptions = WebsiteDataFetchOption::DoNotCreateProcesses;
</ins><span class="cx"> 
</span><span class="cx">     HashSet<PAL::SessionID> visitedSessionIDs;
</span><span class="cx">     for (auto& page : globalPageMap()) {
</span><span class="lines">@@ -252,7 +254,7 @@
</span><span class="cx">             continue;
</span><span class="cx">         visitedSessionIDs.add(dataStore.sessionID());
</span><span class="cx">         callbackAggregator->addPendingCallback();
</span><del>-        dataStore.removeDataForTopPrivatelyControlledDomains(dataTypes, { }, topPrivatelyControlledDomains, [callbackAggregator, shouldNotifyPage, page](HashSet<String>&& domainsWithDeletedWebsiteData) {
</del><ins>+        dataStore.removeDataForTopPrivatelyControlledDomains(dataTypes, fetchOptions, topPrivatelyControlledDomains, [callbackAggregator, shouldNotifyPage, page](HashSet<String>&& domainsWithDeletedWebsiteData) {
</ins><span class="cx">             // When completing the task, we should be getting called on the main thread.
</span><span class="cx">             ASSERT(RunLoop::isMain());
</span><span class="cx">             
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp    2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx"> #include "WebResourceLoadStatisticsStore.h"
</span><span class="cx"> 
</span><span class="cx"> #include "Logging.h"
</span><ins>+#include "PluginProcessManager.h"
+#include "PluginProcessProxy.h"
</ins><span class="cx"> #include "WebProcessMessages.h"
</span><span class="cx"> #include "WebProcessProxy.h"
</span><span class="cx"> #include "WebResourceLoadStatisticsStoreMessages.h"
</span><span class="lines">@@ -185,6 +187,12 @@
</span><span class="cx">     if (!shouldRemoveDataRecords())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+#if ENABLE(NETSCAPE_PLUGIN_API)
+    m_activePluginTokens.clear();
+    for (auto plugin : PluginProcessManager::singleton().pluginProcesses())
+        m_activePluginTokens.add(plugin->pluginProcessToken());
+#endif
+
</ins><span class="cx">     auto prevalentResourceDomains = topPrivatelyControlledDomainsToRemoveWebsiteDataFor();
</span><span class="cx">     if (prevalentResourceDomains.isEmpty())
</span><span class="cx">         return;
</span><span class="lines">@@ -627,6 +635,13 @@
</span><span class="cx">     if (m_dataRecordsBeingRemoved)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+#if ENABLE(NETSCAPE_PLUGIN_API)
+    for (auto plugin : PluginProcessManager::singleton().pluginProcesses()) {
+        if (!m_activePluginTokens.contains(plugin->pluginProcessToken()))
+            return true;
+    }
+#endif
+
</ins><span class="cx">     return !m_lastTimeDataRecordsWereRemoved || MonotonicTime::now() >= (m_lastTimeDataRecordsWereRemoved + m_parameters.minimumTimeBetweenDataRecordsRemoval);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h   2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h      2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "ResourceLoadStatisticsPersistentStorage.h"
</span><span class="cx"> #include "WebsiteDataType.h"
</span><span class="cx"> #include <wtf/CompletionHandler.h>
</span><ins>+#include <wtf/HashSet.h>
</ins><span class="cx"> #include <wtf/MonotonicTime.h>
</span><span class="cx"> #include <wtf/RunLoop.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="lines">@@ -203,6 +204,9 @@
</span><span class="cx"> 
</span><span class="cx">     Parameters m_parameters;
</span><span class="cx"> 
</span><ins>+#if ENABLE(NETSCAPE_PLUGIN_API)
+    HashSet<uint64_t> m_activePluginTokens;
+#endif
</ins><span class="cx">     bool m_dataRecordsBeingRemoved { false };
</span><span class="cx"> 
</span><span class="cx">     Function<void (const String&)> m_statisticsTestingCallback;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (225983 => 225984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp   2017-12-15 21:18:59 UTC (rev 225983)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp      2017-12-15 21:27:24 UTC (rev 225984)
</span><span class="lines">@@ -524,7 +524,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 auto plugin = m_plugins.takeLast();
</span><del>-                PluginProcessManager::singleton().fetchWebsiteData(plugin, [this](Vector<String> hostNames) {
</del><ins>+                PluginProcessManager::singleton().fetchWebsiteData(plugin, m_callbackAggregator->fetchOptions, [this](Vector<String> hostNames) {
</ins><span class="cx">                     for (auto& hostName : hostNames)
</span><span class="cx">                         m_hostNames.add(WTFMove(hostName));
</span><span class="cx">                     fetchWebsiteDataForNextPlugin();
</span></span></pre>
</div>
</div>

</body>
</html>