<!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>[242764] 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/242764">242764</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2019-03-11 19:16:41 -0700 (Mon, 11 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
https://bugs.webkit.org/show_bug.cgi?id=195117
<rdar://problem/48448715>

Reviewed by Brent Fulgham.

Reading of user defaults on Cocoa platforms should be done in the UI process and
forwarded to Resource Load Statistics in the network process through the
WebKit::NetworkSessionCreationParameters struct.

This patch does away with some old user defaults we don't use anymore. It also
changes the developer-facing default name to ITPManualPrevalentResource.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
    Removed the call to the old registerUserDefaultsIfNeeded().
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
    Removed the call to the old registerUserDefaultsIfNeeded().
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
    Removed the declaration of the old registerUserDefaultsIfNeeded().
* NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
    Added an enum class EnableResourceLoadStatisticsDebugMode.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
   The struct now has two new fields:
   - enableResourceLoadStatisticsDebugMode
   - resourceLoadStatisticsManualPrevalentResource
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
    Forwarding of the parameters.
* SourcesCocoa.txt:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
    Forwarding of the parameters.
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
    This is where user defaults for Resource Load Statistics are now read.
* WebKit.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsDatabaseStorecpp">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsMemoryStorecpp">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStoreh">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierWebResourceLoadStatisticsStoreh">trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessioncpp">trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionh">trunk/Source/WebKit/NetworkProcess/NetworkSession.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionCreationParameterscpp">trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionCreationParametersh">trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscocoaNetworkSessionCocoamm">trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitSourcesCocoatxt">trunk/Source/WebKit/SourcesCocoa.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessPoolcpp">trunk/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm">trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStoreCocoamm">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/ChangeLog       2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2019-03-11  John Wilander  <wilander@apple.com>
+
+        Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
+        https://bugs.webkit.org/show_bug.cgi?id=195117
+        <rdar://problem/48448715>
+
+        Reviewed by Brent Fulgham.
+
+        Reading of user defaults on Cocoa platforms should be done in the UI process and
+        forwarded to Resource Load Statistics in the network process through the
+        WebKit::NetworkSessionCreationParameters struct.
+
+        This patch does away with some old user defaults we don't use anymore. It also
+        changes the developer-facing default name to ITPManualPrevalentResource.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
+            Removed the call to the old registerUserDefaultsIfNeeded().
+        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+        (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
+            Removed the call to the old registerUserDefaultsIfNeeded().
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
+            Removed the declaration of the old registerUserDefaultsIfNeeded().
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+            Added an enum class EnableResourceLoadStatisticsDebugMode.
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
+        * NetworkProcess/NetworkSession.h:
+        * NetworkProcess/NetworkSessionCreationParameters.cpp:
+        (WebKit::NetworkSessionCreationParameters::encode const):
+        (WebKit::NetworkSessionCreationParameters::decode):
+        * NetworkProcess/NetworkSessionCreationParameters.h:
+           The struct now has two new fields:
+           - enableResourceLoadStatisticsDebugMode
+           - resourceLoadStatisticsManualPrevalentResource
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+            Forwarding of the parameters.
+        * SourcesCocoa.txt:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+            Forwarding of the parameters.
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::parameters):
+            This is where user defaults for Resource Load Statistics are now read.
+        * WebKit.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2019-03-11  Zalan Bujtas  <zalan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Synthetic Click] Dispatch mouseout soon after mouseup
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsDatabaseStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp    2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp       2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -194,10 +194,6 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><del>-#if PLATFORM(COCOA)
-    registerUserDefaultsIfNeeded();
-#endif
-
</del><span class="cx">     if (!m_database.open(m_storageDirectoryPath)) {
</span><span class="cx">         RELEASE_LOG_ERROR(Network, "%p - ResourceLoadStatisticsDatabaseStore::open failed, error message: %{public}s, database path: %{public}s", this, m_database.lastErrorMsg(), m_storageDirectoryPath.utf8().data());
</span><span class="cx">         ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsMemoryStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp      2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp 2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -72,10 +72,6 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><del>-#if PLATFORM(COCOA)
-    registerUserDefaultsIfNeeded();
-#endif
-
</del><span class="cx">     workQueue.dispatchAfter(5_s, [weakThis = makeWeakPtr(*this)] {
</span><span class="cx">         if (weakThis)
</span><span class="cx">             weakThis->calculateAndSubmitTelemetry();
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h      2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h 2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -190,9 +190,6 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasStatisticsExpired(const ResourceLoadStatistics&) const;
</span><span class="cx">     bool hasStatisticsExpired(WallTime mostRecentUserInteractionTime) const;
</span><del>-#if PLATFORM(COCOA)
-    void registerUserDefaultsIfNeeded();
-#endif
</del><span class="cx">     void scheduleStatisticsProcessingRequestIfNecessary();
</span><span class="cx">     void mergeOperatingDates(Vector<OperatingDate>&&);
</span><span class="cx">     virtual Vector<RegistrableDomain> ensurePrevalentResourcesForDebugMode() = 0;
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStoreCocoamm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm        2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm   2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -1,80 +0,0 @@
</span><del>-/*
- * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "ResourceLoadStatisticsStore.h"
-
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-
-#import <WebCore/RegistrableDomain.h>
-#import <wtf/text/StringBuilder.h>
-#import <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-void ResourceLoadStatisticsStore::registerUserDefaultsIfNeeded()
-{
-    static dispatch_once_t initOnce;
-
-    dispatch_once(&initOnce, ^{
-        Seconds timeToLiveUserInteraction([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsTimeToLiveUserInteraction"]);
-        if (timeToLiveUserInteraction > 0_s && timeToLiveUserInteraction <= 24_h * 30)
-            setTimeToLiveUserInteraction(timeToLiveUserInteraction);
-
-        Seconds minimumTimeBetweenDataRecordsRemoval([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval"]);
-        if (minimumTimeBetweenDataRecordsRemoval > 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h)
-            setMinimumTimeBetweenDataRecordsRemoval(minimumTimeBetweenDataRecordsRemoval);
-
-        Seconds grandfatheringTime([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsGrandfatheringTime"]);
-        if (grandfatheringTime > 0_s && grandfatheringTime <= 24_h * 7)
-            setGrandfatheringTime(grandfatheringTime);
-
-        setResourceLoadStatisticsDebugMode([[NSUserDefaults standardUserDefaults] boolForKey:@"ItpDebugMode"]);
-        auto* debugManualPrevalentResource = [[NSUserDefaults standardUserDefaults] stringForKey:@"ItpManualPrevalentResource"];
-        if (debugManualPrevalentResource) {
-            URL url { URL(), debugManualPrevalentResource };
-            if (!url.isValid()) {
-                StringBuilder builder;
-                builder.appendLiteral("http://");
-                builder.append(debugManualPrevalentResource);
-                url = { URL(), builder.toString() };
-            }
-            if (url.isValid())
-                setPrevalentResourceForDebugMode(RegistrableDomain { url });
-        }
-
-        Seconds cacheMaxAgeCapForPrevalentResources([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsCacheMaxAgeCap"]);
-        if (cacheMaxAgeCapForPrevalentResources > 0_s && cacheMaxAgeCapForPrevalentResources <= 24_h * 365)
-            setCacheMaxAgeCap(cacheMaxAgeCapForPrevalentResources);
-        
-        Seconds clientSideCookiesAgeCap([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsClientSideCookiesAgeCap"]);
-        if (clientSideCookiesAgeCap > 0_s && clientSideCookiesAgeCap <= 24_h * 365)
-            setAgeCapForClientSideCookies(clientSideCookiesAgeCap);
-    });
-}
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierWebResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h   2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h      2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> class WebProcessProxy;
</span><span class="cx"> enum class ShouldGrandfatherStatistics : bool;
</span><span class="cx"> enum class ShouldIncludeLocalhost : bool { No, Yes };
</span><ins>+enum class EnableResourceLoadStatisticsDebugMode : bool { No, Yes };
</ins><span class="cx"> 
</span><span class="cx"> class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>, public IPC::MessageReceiver {
</span><span class="cx"> public:
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp    2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp       2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -100,6 +100,12 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this, m_resourceLoadStatisticsDirectory, m_shouldIncludeLocalhostInResourceLoadStatistics);
</span><ins>+
+    if (m_enableResourceLoadStatisticsDebugMode == EnableResourceLoadStatisticsDebugMode::Yes)
+        m_resourceLoadStatistics->setResourceLoadStatisticsDebugMode(true, [] { });
+    // This should always be forwarded since debug mode may be enabled at runtime.
+    if (!m_resourceLoadStatisticsManualPrevalentResource.isEmpty())
+        m_resourceLoadStatistics->setPrevalentResourceForDebugMode(m_resourceLoadStatisticsManualPrevalentResource, [] { });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkSession::notifyResourceLoadStatisticsProcessed()
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h      2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -93,6 +93,8 @@
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">     RefPtr<WebResourceLoadStatisticsStore> m_resourceLoadStatistics;
</span><span class="cx">     ShouldIncludeLocalhost m_shouldIncludeLocalhostInResourceLoadStatistics { ShouldIncludeLocalhost::Yes };
</span><ins>+    EnableResourceLoadStatisticsDebugMode m_enableResourceLoadStatisticsDebugMode { EnableResourceLoadStatisticsDebugMode::No };
+    WebCore::RegistrableDomain m_resourceLoadStatisticsManualPrevalentResource;
</ins><span class="cx"> #endif
</span><span class="cx">     UniqueRef<NetworkAdClickAttribution> m_adClickAttribution;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp  2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp     2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -80,6 +80,8 @@
</span><span class="cx">     encoder << resourceLoadStatisticsDirectoryExtensionHandle;
</span><span class="cx">     encoder << enableResourceLoadStatistics;
</span><span class="cx">     encoder << shouldIncludeLocalhostInResourceLoadStatistics;
</span><ins>+    encoder << enableResourceLoadStatisticsDebugMode;
+    encoder << resourceLoadStatisticsManualPrevalentResource;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder)
</span><span class="lines">@@ -178,6 +180,16 @@
</span><span class="cx">     if (!shouldIncludeLocalhostInResourceLoadStatistics)
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><ins>+    Optional<bool> enableResourceLoadStatisticsDebugMode;
+    decoder >> enableResourceLoadStatisticsDebugMode;
+    if (!enableResourceLoadStatisticsDebugMode)
+        return WTF::nullopt;
+
+    Optional<WebCore::RegistrableDomain> resourceLoadStatisticsManualPrevalentResource;
+    decoder >> resourceLoadStatisticsManualPrevalentResource;
+    if (!resourceLoadStatisticsManualPrevalentResource)
+        return WTF::nullopt;
+
</ins><span class="cx">     return {{
</span><span class="cx">         sessionID
</span><span class="cx">         , WTFMove(*boundInterfaceIdentifier)
</span><span class="lines">@@ -203,6 +215,8 @@
</span><span class="cx">         , WTFMove(*resourceLoadStatisticsDirectoryExtensionHandle)
</span><span class="cx">         , WTFMove(*enableResourceLoadStatistics)
</span><span class="cx">         , WTFMove(*shouldIncludeLocalhostInResourceLoadStatistics)
</span><ins>+        , WTFMove(*enableResourceLoadStatisticsDebugMode)
+        , WTFMove(*resourceLoadStatisticsManualPrevalentResource)
</ins><span class="cx">     }};
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h    2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h       2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "SandboxExtension.h"
</span><ins>+#include <WebCore/RegistrableDomain.h>
</ins><span class="cx"> #include <pal/SessionID.h>
</span><span class="cx"> #include <wtf/Seconds.h>
</span><span class="cx"> #include <wtf/URL.h>
</span><span class="lines">@@ -82,6 +83,8 @@
</span><span class="cx">     SandboxExtension::Handle resourceLoadStatisticsDirectoryExtensionHandle;
</span><span class="cx">     bool enableResourceLoadStatistics { false };
</span><span class="cx">     bool shouldIncludeLocalhostInResourceLoadStatistics { true };
</span><ins>+    bool enableResourceLoadStatisticsDebugMode { false };
+    WebCore::RegistrableDomain resourceLoadStatisticsManualPrevalentResource { };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscocoaNetworkSessionCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm  2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm     2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -966,6 +966,8 @@
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">     m_resourceLoadStatisticsDirectory = parameters.resourceLoadStatisticsDirectory;
</span><span class="cx">     m_shouldIncludeLocalhostInResourceLoadStatistics = parameters.shouldIncludeLocalhostInResourceLoadStatistics ? ShouldIncludeLocalhost::Yes : ShouldIncludeLocalhost::No;
</span><ins>+    m_enableResourceLoadStatisticsDebugMode = parameters.enableResourceLoadStatisticsDebugMode ? EnableResourceLoadStatisticsDebugMode::Yes : EnableResourceLoadStatisticsDebugMode::No;
+    m_resourceLoadStatisticsManualPrevalentResource = parameters.resourceLoadStatisticsManualPrevalentResource;
</ins><span class="cx">     setResourceLoadStatisticsEnabled(parameters.enableResourceLoadStatistics);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSourcesCocoatxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesCocoa.txt (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesCocoa.txt     2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/SourcesCocoa.txt        2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> NetworkProcess/cocoa/NetworkProcessCocoa.mm
</span><span class="cx"> NetworkProcess/cocoa/NetworkSessionCocoa.mm
</span><span class="cx"> 
</span><del>-NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm
</del><span class="cx"> NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
</span><span class="cx"> NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp    2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -575,16 +575,30 @@
</span><span class="cx"> 
</span><span class="cx">     bool enableResourceLoadStatistics = false;
</span><span class="cx">     bool shouldIncludeLocalhost = true;
</span><ins>+    bool enableResourceLoadStatisticsDebugMode = false;
+    WebCore::RegistrableDomain manualPrevalentResource { };
</ins><span class="cx">     if (withWebsiteDataStore) {
</span><span class="cx">         enableResourceLoadStatistics = withWebsiteDataStore->resourceLoadStatisticsEnabled();
</span><del>-        shouldIncludeLocalhost = withWebsiteDataStore->parameters().networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
</del><ins>+        if (enableResourceLoadStatistics) {
+            auto networkSessionParameters = withWebsiteDataStore->parameters().networkSessionParameters;
+            shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
+            enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
+            manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
+        }
</ins><span class="cx">     } else if (m_websiteDataStore) {
</span><span class="cx">         enableResourceLoadStatistics = m_websiteDataStore->resourceLoadStatisticsEnabled();
</span><del>-        shouldIncludeLocalhost = m_websiteDataStore->websiteDataStore().parameters().networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
</del><ins>+        if (enableResourceLoadStatistics) {
+            auto networkSessionParameters = m_websiteDataStore->websiteDataStore().parameters().networkSessionParameters;
+            shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
+            enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
+            manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatistics = enableResourceLoadStatistics;
</span><span class="cx">     parameters.defaultDataStoreParameters.networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics = shouldIncludeLocalhost;
</span><ins>+    parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatisticsDebugMode = enableResourceLoadStatisticsDebugMode;
+    parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsManualPrevalentResource = manualPrevalentResource;
</ins><span class="cx"> 
</span><span class="cx">     // Add any platform specific parameters
</span><span class="cx">     platformInitializeNetworkProcess(parameters);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm    2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import "StorageManager.h"
</span><span class="cx"> #import "WebResourceLoadStatisticsStore.h"
</span><span class="cx"> #import "WebsiteDataStoreParameters.h"
</span><ins>+#import <WebCore/RegistrableDomain.h>
</ins><span class="cx"> #import <WebCore/RuntimeApplicationChecks.h>
</span><span class="cx"> #import <WebCore/SearchPopupMenuCocoa.h>
</span><span class="cx"> #import <pal/spi/cf/CFNetworkSPI.h>
</span><span class="lines">@@ -36,6 +37,8 @@
</span><span class="cx"> #import <wtf/FileSystem.h>
</span><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><span class="cx"> #import <wtf/ProcessPrivilege.h>
</span><ins>+#import <wtf/URL.h>
+#import <wtf/text/StringBuilder.h>
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx"> #import <UIKit/UIApplication.h>
</span><span class="lines">@@ -61,12 +64,28 @@
</span><span class="cx">     resolveDirectoriesIfNecessary();
</span><span class="cx"> 
</span><span class="cx">     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span><del>-#if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
</del><ins>+    bool shouldLogCookieInformation = false;
+    bool enableResourceLoadStatisticsDebugMode = false;
+    WebCore::RegistrableDomain resourceLoadStatisticsManualPrevalentResource { };
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    enableResourceLoadStatisticsDebugMode = [defaults boolForKey:@"ITPDebugMode"];
+    auto* manualPrevalentResource = [defaults stringForKey:@"ITPManualPrevalentResource"];
+    if (manualPrevalentResource) {
+        URL url { URL(), manualPrevalentResource };
+        if (!url.isValid()) {
+            StringBuilder builder;
+            builder.appendLiteral("http://");
+            builder.append(manualPrevalentResource);
+            url = { URL(), builder.toString() };
+        }
+        if (url.isValid())
+            resourceLoadStatisticsManualPrevalentResource = WebCore::RegistrableDomain { url };
+    }
+#if !RELEASE_LOG_DISABLED
</ins><span class="cx">     static NSString * const WebKitLogCookieInformationDefaultsKey = @"WebKitLogCookieInformation";
</span><del>-    bool shouldLogCookieInformation = [defaults boolForKey:WebKitLogCookieInformationDefaultsKey];
-#else
-    bool shouldLogCookieInformation = false;
</del><ins>+    shouldLogCookieInformation = [defaults boolForKey:WebKitLogCookieInformationDefaultsKey];
</ins><span class="cx"> #endif
</span><ins>+#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
</ins><span class="cx"> 
</span><span class="cx">     URL httpProxy = m_configuration->httpProxy();
</span><span class="cx">     URL httpsProxy = m_configuration->httpsProxy();
</span><span class="lines">@@ -88,6 +107,7 @@
</span><span class="cx">     if (!resourceLoadStatisticsDirectory.isEmpty())
</span><span class="cx">         SandboxExtension::createHandleForReadWriteDirectory(resourceLoadStatisticsDirectory, resourceLoadStatisticsDirectoryHandle);
</span><span class="cx"> 
</span><ins>+    bool shouldIncludeLocalhostInResourceLoadStatistics = isSafari;
</ins><span class="cx">     WebsiteDataStoreParameters parameters;
</span><span class="cx">     parameters.networkSessionParameters = {
</span><span class="cx">         m_sessionID,
</span><span class="lines">@@ -103,7 +123,9 @@
</span><span class="cx">         WTFMove(resourceLoadStatisticsDirectory),
</span><span class="cx">         WTFMove(resourceLoadStatisticsDirectoryHandle),
</span><span class="cx">         false,
</span><del>-        isSafari
</del><ins>+        shouldIncludeLocalhostInResourceLoadStatistics,
+        enableResourceLoadStatisticsDebugMode,
+        WTFMove(resourceLoadStatisticsManualPrevalentResource)
</ins><span class="cx">     };
</span><span class="cx">     finalizeApplicationIdentifiers();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (242763 => 242764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj     2019-03-12 01:58:17 UTC (rev 242763)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2019-03-12 02:16:41 UTC (rev 242764)
</span><span class="lines">@@ -3569,7 +3569,6 @@
</span><span class="cx">          7AB6EA461EEAB6B000037B2B /* APIGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIGeolocationProvider.h; sourceTree = "<group>"; };
</span><span class="cx">          7ACE82E7221CAE06000DA94C /* ResourceLoadStatisticsStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ResourceLoadStatisticsStore.h; path = Classifier/ResourceLoadStatisticsStore.h; sourceTree = "<group>"; };
</span><span class="cx">          7ACE82E8221CAE07000DA94C /* ResourceLoadStatisticsStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ResourceLoadStatisticsStore.cpp; path = Classifier/ResourceLoadStatisticsStore.cpp; sourceTree = "<group>"; };
</span><del>-               7ACE82E9221DE722000DA94C /* ResourceLoadStatisticsStoreCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = ResourceLoadStatisticsStoreCocoa.mm; path = Classifier/ResourceLoadStatisticsStoreCocoa.mm; sourceTree = "<group>"; };
</del><span class="cx">           7AF2361E1E79A3B400438A05 /* WebErrors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebErrors.cpp; sourceTree = "<group>"; };
</span><span class="cx">          7AF2361F1E79A3D800438A05 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; };
</span><span class="cx">          7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebErrorsCocoa.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -6977,7 +6976,6 @@
</span><span class="cx">                          7AFBD36821E542E8005DBACB /* ResourceLoadStatisticsPersistentStorage.h */,
</span><span class="cx">                          7ACE82E8221CAE07000DA94C /* ResourceLoadStatisticsStore.cpp */,
</span><span class="cx">                          7ACE82E7221CAE06000DA94C /* ResourceLoadStatisticsStore.h */,
</span><del>-                               7ACE82E9221DE722000DA94C /* ResourceLoadStatisticsStoreCocoa.mm */,
</del><span class="cx">                           7A41E9FA21F81DAC00B88CDB /* ShouldGrandfatherStatistics.h */,
</span><span class="cx">                          7A3FECA121F7C09700F267CD /* StorageAccessStatus.h */,
</span><span class="cx">                          7A843A1A21E41FB200DEF663 /* WebResourceLoadStatisticsStore.cpp */,
</span></span></pre>
</div>
</div>

</body>
</html>