<!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>[242889] 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/242889">242889</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2019-03-13 10:48:47 -0700 (Wed, 13 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use new RegistrableDomain type in PSON code
https://bugs.webkit.org/show_bug.cgi?id=195634

Reviewed by Youenn Fablet.

Use new RegistrableDomain type in PSON code instead of more error-prone String type.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::canCacheProcess const):
(WebKit::WebProcessCache::addProcessIfPossible):
(WebKit::WebProcessCache::takeProcess):
(WebKit::WebProcessCache::clearAllProcessesForSession):
* UIProcess/WebProcessCache.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::addProcessToOriginCacheSet):
(WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
(WebKit::WebProcessPool::processForNavigationInternal):
(WebKit::WebProcessPool::findReusableSuspendedPageProcess):
(WebKit::WebProcessPool::didCollectPrewarmInformation):
(WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
(WebKit::WebProcessProxy::maybeShutDown):
(WebKit::WebProcessProxy::didCollectPrewarmInformation):
(WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::registrableDomain const):
* UIProcess/WebProcessProxy.messages.in:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::sendPrewarmInformation):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessSuspendedPageProxycpp">trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessSuspendedPageProxyh">trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessCachecpp">trunk/Source/WebKit/UIProcess/WebProcessCache.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessCacheh">trunk/Source/WebKit/UIProcess/WebProcessCache.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessPoolcpp">trunk/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessPoolh">trunk/Source/WebKit/UIProcess/WebProcessPool.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxycpp">trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxyh">trunk/Source/WebKit/UIProcess/WebProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxymessagesin">trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcesscpp">trunk/Source/WebKit/WebProcess/WebProcess.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/ChangeLog       2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2019-03-13  Chris Dumez  <cdumez@apple.com>
+
+        Use new RegistrableDomain type in PSON code
+        https://bugs.webkit.org/show_bug.cgi?id=195634
+
+        Reviewed by Youenn Fablet.
+
+        Use new RegistrableDomain type in PSON code instead of more error-prone String type.
+
+        * UIProcess/SuspendedPageProxy.cpp:
+        (WebKit::SuspendedPageProxy::SuspendedPageProxy):
+        * UIProcess/SuspendedPageProxy.h:
+        * UIProcess/WebProcessCache.cpp:
+        (WebKit::WebProcessCache::canCacheProcess const):
+        (WebKit::WebProcessCache::addProcessIfPossible):
+        (WebKit::WebProcessCache::takeProcess):
+        (WebKit::WebProcessCache::clearAllProcessesForSession):
+        * UIProcess/WebProcessCache.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::addProcessToOriginCacheSet):
+        (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
+        (WebKit::WebProcessPool::processForNavigationInternal):
+        (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
+        (WebKit::WebProcessPool::didCollectPrewarmInformation):
+        (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
+        (WebKit::WebProcessProxy::maybeShutDown):
+        (WebKit::WebProcessProxy::didCollectPrewarmInformation):
+        (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::registrableDomain const):
+        * UIProcess/WebProcessProxy.messages.in:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::sendPrewarmInformation):
+
</ins><span class="cx"> 2019-03-13  Fujii Hironori  <Hironori.Fujii@sony.com>
</span><span class="cx"> 
</span><span class="cx">         [Win][PlayStation] Remove WebCore::standardUserAgentForURL
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessSuspendedPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp     2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp        2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     : m_page(page)
</span><span class="cx">     , m_process(WTFMove(process))
</span><span class="cx">     , m_mainFrameID(mainFrameID)
</span><del>-    , m_registrableDomain(toRegistrableDomain(URL(URL(), item.url())))
</del><ins>+    , m_registrableDomain(URL(URL(), item.url()))
</ins><span class="cx">     , m_suspensionTimeoutTimer(RunLoop::main(), this, &SuspendedPageProxy::suspensionTimedOut)
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx">     , m_suspensionToken(m_process->throttler().backgroundActivityToken())
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessSuspendedPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h       2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h  2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include "ProcessThrottler.h"
</span><span class="cx"> #include "WebBackForwardListItem.h"
</span><span class="cx"> #include "WebPageProxyMessages.h"
</span><del>-#include <WebCore/SecurityOriginData.h>
</del><ins>+#include <WebCore/RegistrableDomain.h>
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/WeakPtr.h>
</span><span class="cx"> 
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     WebPageProxy& page() const { return m_page; }
</span><span class="cx">     WebProcessProxy& process() { return m_process.get(); }
</span><span class="cx">     uint64_t mainFrameID() const { return m_mainFrameID; }
</span><del>-    const String& registrableDomain() const { return m_registrableDomain; }
</del><ins>+    const WebCore::RegistrableDomain& registrableDomain() const { return m_registrableDomain; }
</ins><span class="cx"> 
</span><span class="cx">     bool failedToSuspend() const { return m_suspensionState == SuspensionState::FailedToSuspend; }
</span><span class="cx"> 
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">     WebPageProxy& m_page;
</span><span class="cx">     Ref<WebProcessProxy> m_process;
</span><span class="cx">     uint64_t m_mainFrameID;
</span><del>-    String m_registrableDomain;
</del><ins>+    WebCore::RegistrableDomain m_registrableDomain;
</ins><span class="cx">     bool m_isClosed { false };
</span><span class="cx"> 
</span><span class="cx">     SuspensionState m_suspensionState { SuspensionState::Suspending };
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessCache.cpp (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessCache.cpp        2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessCache.cpp   2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -55,6 +55,11 @@
</span><span class="cx">     if (!capacity())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    if (process.registrableDomain().isEmpty()) {
+        RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::canCacheProcess(): Not caching process %i because it does not have an associated registrable domain", this, process.processIdentifier());
+        return false;
+    }
+
</ins><span class="cx">     if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</span><span class="cx">         RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::canCacheProcess(): Not caching process %i because we are under memory pressure", this, process.processIdentifier());
</span><span class="cx">         return false;
</span><span class="lines">@@ -69,9 +74,8 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebProcessCache::addProcessIfPossible(const String& registrableDomain, Ref<WebProcessProxy>&& process)
</del><ins>+bool WebProcessCache::addProcessIfPossible(Ref<WebProcessProxy>&& process)
</ins><span class="cx"> {
</span><del>-    ASSERT(!registrableDomain.isEmpty());
</del><span class="cx">     ASSERT(!process->pageCount());
</span><span class="cx">     ASSERT(!process->provisionalPageCount());
</span><span class="cx">     ASSERT(!process->suspendedPageCount());
</span><span class="lines">@@ -124,7 +128,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<WebProcessProxy> WebProcessCache::takeProcess(const String& registrableDomain, WebsiteDataStore& dataStore)
</del><ins>+RefPtr<WebProcessProxy> WebProcessCache::takeProcess(const WebCore::RegistrableDomain& registrableDomain, WebsiteDataStore& dataStore)
</ins><span class="cx"> {
</span><span class="cx">     auto it = m_processesPerRegistrableDomain.find(registrableDomain);
</span><span class="cx">     if (it == m_processesPerRegistrableDomain.end())
</span><span class="lines">@@ -180,7 +184,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcessCache::clearAllProcessesForSession(PAL::SessionID sessionID)
</span><span class="cx"> {
</span><del>-    Vector<String> keysToRemove;
</del><ins>+    Vector<WebCore::RegistrableDomain> keysToRemove;
</ins><span class="cx">     for (auto& pair : m_processesPerRegistrableDomain) {
</span><span class="cx">         if (pair.value->process().websiteDataStore().sessionID() == sessionID) {
</span><span class="cx">             RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::clearAllProcessesForSession() evicting process %i because its session was destroyed", this, pair.value->process().processIdentifier());
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessCache.h (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessCache.h  2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessCache.h     2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include <WebCore/RegistrableDomain.h>
</ins><span class="cx"> #include <pal/SessionID.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/RunLoop.h>
</span><span class="lines">@@ -42,8 +43,8 @@
</span><span class="cx"> public:
</span><span class="cx">     explicit WebProcessCache(WebProcessPool&);
</span><span class="cx"> 
</span><del>-    bool addProcessIfPossible(const String& registrableDomain, Ref<WebProcessProxy>&&);
-    RefPtr<WebProcessProxy> takeProcess(const String& registrableDomain, WebsiteDataStore&);
</del><ins>+    bool addProcessIfPossible(Ref<WebProcessProxy>&&);
+    RefPtr<WebProcessProxy> takeProcess(const WebCore::RegistrableDomain&, WebsiteDataStore&);
</ins><span class="cx"> 
</span><span class="cx">     void updateCapacity(WebProcessPool&);
</span><span class="cx">     unsigned capacity() const { return m_capacity; }
</span><span class="lines">@@ -85,7 +86,7 @@
</span><span class="cx">     unsigned m_capacity { 0 };
</span><span class="cx"> 
</span><span class="cx">     HashMap<uint64_t, std::unique_ptr<CachedProcess>> m_pendingAddRequests;
</span><del>-    HashMap<String, std::unique_ptr<CachedProcess>> m_processesPerRegistrableDomain;
</del><ins>+    HashMap<WebCore::RegistrableDomain, std::unique_ptr<CachedProcess>> m_processesPerRegistrableDomain;
</ins><span class="cx">     RunLoop::Timer<WebProcessCache> m_evictionTimer;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp    2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -2159,12 +2159,12 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcessPool::addProcessToOriginCacheSet(WebProcessProxy& process, const URL& url)
</span><span class="cx"> {
</span><del>-    auto registrableDomain = toRegistrableDomain(url);
</del><ins>+    auto registrableDomain = WebCore::RegistrableDomain { url };
</ins><span class="cx">     auto result = m_swappedProcessesPerRegistrableDomain.add(registrableDomain, &process);
</span><span class="cx">     if (!result.isNewEntry)
</span><span class="cx">         result.iterator->value = &process;
</span><span class="cx"> 
</span><del>-    LOG(ProcessSwapping, "(ProcessSwapping) Registrable domain %s just saved a cached process with pid %i", registrableDomain.utf8().data(), process.processIdentifier());
</del><ins>+    LOG(ProcessSwapping, "(ProcessSwapping) Registrable domain %s just saved a cached process with pid %i", registrableDomain.string().utf8().data(), process.processIdentifier());
</ins><span class="cx">     if (!result.isNewEntry)
</span><span class="cx">         LOG(ProcessSwapping, "(ProcessSwapping) Note: It already had one saved");
</span><span class="cx"> }
</span><span class="lines">@@ -2174,7 +2174,7 @@
</span><span class="cx">     LOG(ProcessSwapping, "(ProcessSwapping) Removing process with pid %i from the origin cache set", process.processIdentifier());
</span><span class="cx"> 
</span><span class="cx">     // FIXME: This can be very inefficient as the number of remembered origins and processes grows
</span><del>-    Vector<String> registrableDomainsToRemove;
</del><ins>+    Vector<WebCore::RegistrableDomain> registrableDomainsToRemove;
</ins><span class="cx">     for (auto entry : m_swappedProcessesPerRegistrableDomain) {
</span><span class="cx">         if (entry.value == &process)
</span><span class="cx">             registrableDomainsToRemove.append(entry.key);
</span><span class="lines">@@ -2212,7 +2212,7 @@
</span><span class="cx"> void WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API::Navigation& navigation, Ref<WebProcessProxy>&& sourceProcess, const URL& pageSourceURL, ProcessSwapRequestedByClient processSwapRequestedByClient, Ref<WebsiteDataStore>&& dataStore, CompletionHandler<void(Ref<WebProcessProxy>&&, SuspendedPageProxy*, const String&)>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     auto& targetURL = navigation.currentRequest().url();
</span><del>-    auto registrableDomain = toRegistrableDomain(targetURL);
</del><ins>+    auto registrableDomain = WebCore::RegistrableDomain { targetURL };
</ins><span class="cx"> 
</span><span class="cx">     auto createNewProcess = [this, protectedThis = makeRef(*this), page = makeRef(page), targetURL, registrableDomain, dataStore = dataStore.copyRef()] () -> Ref<WebProcessProxy> {
</span><span class="cx">         if (auto process = webProcessCache().takeProcess(registrableDomain, dataStore))
</span><span class="lines">@@ -2306,7 +2306,7 @@
</span><span class="cx">     String reason = "Navigation is cross-site"_s;
</span><span class="cx">     
</span><span class="cx">     if (m_configuration->alwaysKeepAndReuseSwappedProcesses()) {
</span><del>-        LOG(ProcessSwapping, "(ProcessSwapping) Considering re-use of a previously cached process for domain %s", registrableDomain.utf8().data());
</del><ins>+        LOG(ProcessSwapping, "(ProcessSwapping) Considering re-use of a previously cached process for domain %s", registrableDomain.string().utf8().data());
</ins><span class="cx"> 
</span><span class="cx">         if (auto* process = m_swappedProcessesPerRegistrableDomain.get(registrableDomain)) {
</span><span class="cx">             if (&process->websiteDataStore() == dataStore.ptr()) {
</span><span class="lines">@@ -2326,7 +2326,7 @@
</span><span class="cx">     return completionHandler(createNewProcess(), nullptr, reason);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<WebProcessProxy> WebProcessPool::findReusableSuspendedPageProcess(const String& registrableDomain, WebPageProxy& page, WebsiteDataStore& dataStore)
</del><ins>+RefPtr<WebProcessProxy> WebProcessPool::findReusableSuspendedPageProcess(const WebCore::RegistrableDomain& registrableDomain, WebPageProxy& page, WebsiteDataStore& dataStore)
</ins><span class="cx"> {
</span><span class="cx">     auto it = m_suspendedPages.findIf([&](auto& suspendedPage) {
</span><span class="cx">         return suspendedPage->registrableDomain() == registrableDomain && &suspendedPage->process().websiteDataStore() == &dataStore;
</span><span class="lines">@@ -2450,7 +2450,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcessPool::didCollectPrewarmInformation(const String& registrableDomain, const WebCore::PrewarmInformation& prewarmInformation)
</del><ins>+void WebProcessPool::didCollectPrewarmInformation(const WebCore::RegistrableDomain& registrableDomain, const WebCore::PrewarmInformation& prewarmInformation)
</ins><span class="cx"> {
</span><span class="cx">     static const size_t maximumSizeToPreventUnlimitedGrowth = 100;
</span><span class="cx">     if (m_prewarmInformationPerRegistrableDomain.size() == maximumSizeToPreventUnlimitedGrowth)
</span><span class="lines">@@ -2465,7 +2465,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcessPool::tryPrewarmWithDomainInformation(WebProcessProxy& process, const URL& url)
</span><span class="cx"> {
</span><del>-    auto* prewarmInformation = m_prewarmInformationPerRegistrableDomain.get(toRegistrableDomain(url));
</del><ins>+    auto* prewarmInformation = m_prewarmInformationPerRegistrableDomain.get(RegistrableDomain { url });
</ins><span class="cx">     if (!prewarmInformation)
</span><span class="cx">         return;
</span><span class="cx">     process.send(Messages::WebProcess::PrewarmWithDomainInformation(*prewarmInformation), 0);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessPool.h   2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h      2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -467,13 +467,13 @@
</span><span class="cx">     void removeSuspendedPage(SuspendedPageProxy&);
</span><span class="cx">     bool hasSuspendedPageFor(WebProcessProxy&, WebPageProxy&) const;
</span><span class="cx">     unsigned maxSuspendedPageCount() const { return m_maxSuspendedPageCount; }
</span><del>-    RefPtr<WebProcessProxy> findReusableSuspendedPageProcess(const String&, WebPageProxy&, WebsiteDataStore&);
</del><ins>+    RefPtr<WebProcessProxy> findReusableSuspendedPageProcess(const WebCore::RegistrableDomain&, WebPageProxy&, WebsiteDataStore&);
</ins><span class="cx"> 
</span><span class="cx">     void clearSuspendedPages(AllowProcessCaching);
</span><span class="cx"> 
</span><span class="cx">     void didReachGoodTimeToPrewarm(WebsiteDataStore&);
</span><span class="cx"> 
</span><del>-    void didCollectPrewarmInformation(const String& registrableDomain, const WebCore::PrewarmInformation&);
</del><ins>+    void didCollectPrewarmInformation(const WebCore::RegistrableDomain&, const WebCore::PrewarmInformation&);
</ins><span class="cx"> 
</span><span class="cx">     void screenPropertiesStateChanged();
</span><span class="cx"> 
</span><span class="lines">@@ -756,9 +756,9 @@
</span><span class="cx">     unsigned m_maxSuspendedPageCount { 0 };
</span><span class="cx"> 
</span><span class="cx">     UniqueRef<WebProcessCache> m_webProcessCache;
</span><del>-    HashMap<String, RefPtr<WebProcessProxy>> m_swappedProcessesPerRegistrableDomain;
</del><ins>+    HashMap<WebCore::RegistrableDomain, RefPtr<WebProcessProxy>> m_swappedProcessesPerRegistrableDomain;
</ins><span class="cx"> 
</span><del>-    HashMap<String, std::unique_ptr<WebCore::PrewarmInformation>> m_prewarmInformationPerRegistrableDomain;
</del><ins>+    HashMap<WebCore::RegistrableDomain, std::unique_ptr<WebCore::PrewarmInformation>> m_prewarmInformationPerRegistrableDomain;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
</span><span class="cx">     Vector<std::unique_ptr<DisplayLink>> m_displayLinks;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp        2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp   2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -834,9 +834,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool WebProcessProxy::canBeAddedToWebProcessCache() const
</span><span class="cx"> {
</span><del>-    if (registrableDomain().isEmpty())
-        return false;
-
</del><span class="cx">     if (isServiceWorkerProcess())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -851,7 +848,7 @@
</span><span class="cx">     if (state() == State::Terminated || !canTerminateAuxiliaryProcess())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (allowProcessCaching == AllowProcessCaching::Yes && canBeAddedToWebProcessCache() && processPool().webProcessCache().addProcessIfPossible(registrableDomain(), *this))
</del><ins>+    if (allowProcessCaching == AllowProcessCaching::Yes && canBeAddedToWebProcessCache() && processPool().webProcessCache().addProcessIfPossible(*this))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     shutDown();
</span><span class="lines">@@ -1415,7 +1412,7 @@
</span><span class="cx">     callback(isLocallyReachable ? MessagePortChannelProvider::HasActivity::Yes : MessagePortChannelProvider::HasActivity::No);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcessProxy::didCollectPrewarmInformation(const String& domain, const WebCore::PrewarmInformation& prewarmInformation)
</del><ins>+void WebProcessProxy::didCollectPrewarmInformation(const WebCore::RegistrableDomain& domain, const WebCore::PrewarmInformation& prewarmInformation)
</ins><span class="cx"> {
</span><span class="cx">     processPool().didCollectPrewarmInformation(domain, prewarmInformation);
</span><span class="cx"> }
</span><span class="lines">@@ -1430,13 +1427,13 @@
</span><span class="cx">     RELEASE_ASSERT(!isInProcessCache());
</span><span class="cx"> 
</span><span class="cx">     // This process has been used for several registrable domains already.
</span><del>-    if (m_registrableDomain && m_registrableDomain->isNull())
</del><ins>+    if (m_registrableDomain && m_registrableDomain->isEmpty())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto registrableDomain = toRegistrableDomain(url);
</del><ins>+    auto registrableDomain = WebCore::RegistrableDomain { url };
</ins><span class="cx">     if (m_registrableDomain && *m_registrableDomain != registrableDomain) {
</span><span class="cx">         // Null out registrable domain since this process has now been used for several domains.
</span><del>-        m_registrableDomain = String();
</del><ins>+        m_registrableDomain = WebCore::RegistrableDomain { };
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h  2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h     2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include <WebCore/MessagePortChannelProvider.h>
</span><span class="cx"> #include <WebCore/MessagePortIdentifier.h>
</span><span class="cx"> #include <WebCore/ProcessIdentifier.h>
</span><ins>+#include <WebCore/RegistrableDomain.h>
</ins><span class="cx"> #include <WebCore/SharedStringHash.h>
</span><span class="cx"> #include <memory>
</span><span class="cx"> #include <pal/SessionID.h>
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx"> 
</span><span class="cx">     WebProcessPool& processPool() const { ASSERT(m_processPool); return *m_processPool.get(); }
</span><span class="cx"> 
</span><del>-    String registrableDomain() const { return m_registrableDomain.valueOr(String()); }
</del><ins>+    WebCore::RegistrableDomain registrableDomain() const { return m_registrableDomain.valueOr(WebCore::RegistrableDomain { }); }
</ins><span class="cx">     void setIsInProcessCache(bool);
</span><span class="cx">     bool isInProcessCache() const { return m_isInProcessCache; }
</span><span class="cx"> 
</span><span class="lines">@@ -371,7 +372,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool canTerminateAuxiliaryProcess();
</span><span class="cx"> 
</span><del>-    void didCollectPrewarmInformation(const String& domain, const WebCore::PrewarmInformation&);
</del><ins>+    void didCollectPrewarmInformation(const WebCore::RegistrableDomain&, const WebCore::PrewarmInformation&);
</ins><span class="cx"> 
</span><span class="cx">     void logDiagnosticMessageForResourceLimitTermination(const String& limitKey);
</span><span class="cx"> 
</span><span class="lines">@@ -434,7 +435,7 @@
</span><span class="cx"> 
</span><span class="cx">     HashMap<String, uint64_t> m_pageURLRetainCountMap;
</span><span class="cx"> 
</span><del>-    Optional<String> m_registrableDomain;
</del><ins>+    Optional<WebCore::RegistrableDomain> m_registrableDomain;
</ins><span class="cx">     bool m_isInProcessCache { false };
</span><span class="cx"> 
</span><span class="cx">     enum class NoOrMaybe { No, Maybe } m_isResponsive;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in        2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in   2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">     DidDeliverMessagePortMessages(uint64_t messageBatchIdentifier)
</span><span class="cx">     DidCheckProcessLocalPortForActivity(uint64_t callbackIdentifier, bool isLocallyReachable)
</span><span class="cx"> 
</span><del>-    DidCollectPrewarmInformation(String domain, struct WebCore::PrewarmInformation prewarmInformation)
</del><ins>+    DidCollectPrewarmInformation(WebCore::RegistrableDomain domain, struct WebCore::PrewarmInformation prewarmInformation)
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     CacheMediaMIMETypes(Vector<String> types)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (242888 => 242889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.cpp    2019-03-13 17:28:21 UTC (rev 242888)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp       2019-03-13 17:48:47 UTC (rev 242889)
</span><span class="lines">@@ -1575,7 +1575,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::sendPrewarmInformation(const URL& url)
</span><span class="cx"> {
</span><del>-    auto registrableDomain = toRegistrableDomain(url);
</del><ins>+    auto registrableDomain = WebCore::RegistrableDomain { url };
</ins><span class="cx">     if (registrableDomain.isEmpty())
</span><span class="cx">         return;
</span><span class="cx">     parentProcessConnection()->send(Messages::WebProcessProxy::DidCollectPrewarmInformation(registrableDomain, WebCore::ProcessWarming::collectPrewarmInformation()), 0);
</span></span></pre>
</div>
</div>

</body>
</html>