<!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>[225298] trunk/Source</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
https://bugs.webkit.org/show_bug.cgi?id=180166

Reviewed by Chris Dumez.

Source/WebCore:

No new tests (No behavior change).

We'll sometimes be starting SW contexts without an associated job, so ServiceWorkerContextData
should not required actually having a job identifier.

* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::decode):

* workers/service/context/SWContextManager.h:

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::scriptContextFailedToStart):
(WebCore::SWServer::scriptContextStarted):
(WebCore::SWServer::didFinishInstall):
* workers/service/server/SWServer.h:

* workers/service/server/SWServerToContextConnection.cpp:
(WebCore::SWServerToContextConnection::scriptContextFailedToStart):
(WebCore::SWServerToContextConnection::scriptContextStarted):
(WebCore::SWServerToContextConnection::didFinishInstall):
* workers/service/server/SWServerToContextConnection.h:

* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::scriptContextFailedToStart):
(WebCore::SWServerWorker::scriptContextStarted):
(WebCore::SWServerWorker::didFinishInstall):
* workers/service/server/SWServerWorker.h:

Source/WebKit:

* StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:

* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
(WebKit::WebSWContextManagerConnection::didFinishInstall):
* WebProcess/Storage/WebSWContextManagerConnection.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceServiceWorkerContextDatah">trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h</a></li>
<li><a href="#trunkSourceWebCoreworkersservicecontextSWContextManagerh">trunk/Source/WebCore/workers/service/context/SWContextManager.h</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServercpp">trunk/Source/WebCore/workers/service/server/SWServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServerh">trunk/Source/WebCore/workers/service/server/SWServer.h</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServerToContextConnectioncpp">trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServerToContextConnectionh">trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.h</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServerWorkercpp">trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersserviceserverSWServerWorkerh">trunk/Source/WebCore/workers/service/server/SWServerWorker.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitStorageProcessServiceWorkerWebSWServerToContextConnectionmessagesin">trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebProcessStorageWebSWContextManagerConnectioncpp">trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessStorageWebSWContextManagerConnectionh">trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/ChangeLog      2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2017-11-29  Brady Eidson  <beidson@apple.com>
+
+        When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
+        https://bugs.webkit.org/show_bug.cgi?id=180166
+
+        Reviewed by Chris Dumez.
+
+        No new tests (No behavior change).
+
+        We'll sometimes be starting SW contexts without an associated job, so ServiceWorkerContextData
+        should not required actually having a job identifier.
+
+        * workers/service/ServiceWorkerContextData.h:
+        (WebCore::ServiceWorkerContextData::decode):
+
+        * workers/service/context/SWContextManager.h:
+
+        * workers/service/server/SWServer.cpp:
+        (WebCore::SWServer::scriptContextFailedToStart):
+        (WebCore::SWServer::scriptContextStarted):
+        (WebCore::SWServer::didFinishInstall):
+        * workers/service/server/SWServer.h:
+
+        * workers/service/server/SWServerToContextConnection.cpp:
+        (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
+        (WebCore::SWServerToContextConnection::scriptContextStarted):
+        (WebCore::SWServerToContextConnection::didFinishInstall):
+        * workers/service/server/SWServerToContextConnection.h:
+
+        * workers/service/server/SWServerWorker.cpp:
+        (WebCore::SWServerWorker::scriptContextFailedToStart):
+        (WebCore::SWServerWorker::scriptContextStarted):
+        (WebCore::SWServerWorker::didFinishInstall):
+        * workers/service/server/SWServerWorker.h:
+
</ins><span class="cx"> 2017-11-29  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add support for service worker generated redirections
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceServiceWorkerContextDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h  2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h     2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> struct ServiceWorkerContextData {
</span><del>-    ServiceWorkerJobDataIdentifier jobDataIdentifier;
</del><ins>+    std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier;
</ins><span class="cx">     ServiceWorkerRegistrationData registration;
</span><span class="cx">     ServiceWorkerIdentifier serviceWorkerIdentifier;
</span><span class="cx">     String script;
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> template<class Decoder>
</span><span class="cx"> std::optional<ServiceWorkerContextData> ServiceWorkerContextData::decode(Decoder& decoder)
</span><span class="cx"> {
</span><del>-    std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier;
</del><ins>+    std::optional<std::optional<ServiceWorkerJobDataIdentifier>> jobDataIdentifier;
</ins><span class="cx">     decoder >> jobDataIdentifier;
</span><span class="cx">     if (!jobDataIdentifier)
</span><span class="cx">         return std::nullopt;
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersservicecontextSWContextManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/context/SWContextManager.h  2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h     2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -46,8 +46,8 @@
</span><span class="cx">         virtual ~Connection() { }
</span><span class="cx"> 
</span><span class="cx">         virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, Ref<SerializedScriptValue>&& message, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0;
</span><del>-        virtual void serviceWorkerStartedWithMessage(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, const String& exceptionMessage) = 0;
-        virtual void didFinishInstall(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, bool wasSuccessful) = 0;
</del><ins>+        virtual void serviceWorkerStartedWithMessage(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage) = 0;
+        virtual void didFinishInstall(std::optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool wasSuccessful) = 0;
</ins><span class="cx">         virtual void didFinishActivation(ServiceWorkerIdentifier) = 0;
</span><span class="cx">         virtual void setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier, bool) = 0;
</span><span class="cx">         virtual void workerTerminated(ServiceWorkerIdentifier) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp    2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -266,22 +266,31 @@
</span><span class="cx">     jobQueue->scriptFetchFinished(connection, result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServer::scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerWorker& worker, const String& message)
</del><ins>+void SWServer::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, const String& message)
</ins><span class="cx"> {
</span><ins>+    if (!jobDataIdentifier)
+        return;
+
</ins><span class="cx">     if (auto* jobQueue = m_jobQueues.get(worker.registrationKey()))
</span><del>-        jobQueue->scriptContextFailedToStart(jobDataIdentifier, worker.identifier(), message);
</del><ins>+        jobQueue->scriptContextFailedToStart(*jobDataIdentifier, worker.identifier(), message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServer::scriptContextStarted(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerWorker& worker)
</del><ins>+void SWServer::scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker)
</ins><span class="cx"> {
</span><ins>+    if (!jobDataIdentifier)
+        return;
+
</ins><span class="cx">     if (auto* jobQueue = m_jobQueues.get(worker.registrationKey()))
</span><del>-        jobQueue->scriptContextStarted(jobDataIdentifier, worker.identifier());
</del><ins>+        jobQueue->scriptContextStarted(*jobDataIdentifier, worker.identifier());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServer::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerWorker& worker, bool wasSuccessful)
</del><ins>+void SWServer::didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, SWServerWorker& worker, bool wasSuccessful)
</ins><span class="cx"> {
</span><ins>+    if (!jobDataIdentifier)
+        return;
+
</ins><span class="cx">     if (auto* jobQueue = m_jobQueues.get(worker.registrationKey()))
</span><del>-        jobQueue->didFinishInstall(jobDataIdentifier, worker.identifier(), wasSuccessful);
</del><ins>+        jobQueue->didFinishInstall(*jobDataIdentifier, worker.identifier(), wasSuccessful);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SWServer::didFinishActivation(SWServerWorker& worker)
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServer.h   2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h      2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -130,9 +130,9 @@
</span><span class="cx">     Connection* getConnection(SWServerConnectionIdentifier identifier) { return m_connections.get(identifier); }
</span><span class="cx">     SWOriginStore& originStore() { return m_originStore; }
</span><span class="cx"> 
</span><del>-    void scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier&, SWServerWorker&, const String& message);
-    void scriptContextStarted(const ServiceWorkerJobDataIdentifier&, SWServerWorker&);
-    void didFinishInstall(const ServiceWorkerJobDataIdentifier&, SWServerWorker&, bool wasSuccessful);
</del><ins>+    void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, const String& message);
+    void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&);
+    void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, SWServerWorker&, bool wasSuccessful);
</ins><span class="cx">     void didFinishActivation(SWServerWorker&);
</span><span class="cx">     void workerContextTerminated(SWServerWorker&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServerToContextConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp      2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp 2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -72,19 +72,19 @@
</span><span class="cx">     return allConnections().begin()->value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServerToContextConnection::scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& message)
</del><ins>+void SWServerToContextConnection::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& message)
</ins><span class="cx"> {
</span><span class="cx">     if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier))
</span><span class="cx">         worker->scriptContextFailedToStart(jobDataIdentifier, message);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServerToContextConnection::scriptContextStarted(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier)
</del><ins>+void SWServerToContextConnection::scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier)
</ins><span class="cx"> {
</span><span class="cx">     if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier))
</span><span class="cx">         worker->scriptContextStarted(jobDataIdentifier);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void SWServerToContextConnection::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful)
</del><ins>+void SWServerToContextConnection::didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful)
</ins><span class="cx"> {
</span><span class="cx">     if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier))
</span><span class="cx">         worker->didFinishInstall(jobDataIdentifier, wasSuccessful);
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServerToContextConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.h (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.h        2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.h   2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx">     virtual void terminateWorker(ServiceWorkerIdentifier) = 0;
</span><span class="cx"> 
</span><span class="cx">     // Messages back from the SW host process
</span><del>-    WEBCORE_EXPORT void scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, const String& message);
-    WEBCORE_EXPORT void scriptContextStarted(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier);
-    WEBCORE_EXPORT void didFinishInstall(const ServiceWorkerJobDataIdentifier&, ServiceWorkerIdentifier, bool wasSuccessful);
</del><ins>+    WEBCORE_EXPORT void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, const String& message);
+    WEBCORE_EXPORT void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier);
+    WEBCORE_EXPORT void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, bool wasSuccessful);
</ins><span class="cx">     WEBCORE_EXPORT void didFinishActivation(ServiceWorkerIdentifier);
</span><span class="cx">     WEBCORE_EXPORT void setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier, bool hasPendingEvents);
</span><span class="cx">     WEBCORE_EXPORT void workerTerminated(ServiceWorkerIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServerWorkercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp   2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp      2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -65,17 +65,17 @@
</span><span class="cx">     m_server.terminateWorker(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServerWorker::scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, const String& message)
</del><ins>+void SWServerWorker::scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, const String& message)
</ins><span class="cx"> {
</span><span class="cx">     m_server.scriptContextFailedToStart(jobDataIdentifier, *this, message);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServerWorker::scriptContextStarted(const ServiceWorkerJobDataIdentifier& jobDataIdentifier)
</del><ins>+void SWServerWorker::scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier)
</ins><span class="cx"> {
</span><span class="cx">     m_server.scriptContextStarted(jobDataIdentifier, *this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SWServerWorker::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, bool wasSuccessful)
</del><ins>+void SWServerWorker::didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, bool wasSuccessful)
</ins><span class="cx"> {
</span><span class="cx">     m_server.didFinishInstall(jobDataIdentifier, *this, wasSuccessful);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersserviceserverSWServerWorkerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.h (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/service/server/SWServerWorker.h     2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.h        2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -68,9 +68,9 @@
</span><span class="cx">     bool hasPendingEvents() const { return m_hasPendingEvents; }
</span><span class="cx">     void setHasPendingEvents(bool value) { m_hasPendingEvents = value; }
</span><span class="cx"> 
</span><del>-    void scriptContextFailedToStart(const ServiceWorkerJobDataIdentifier&, const String& message);
-    void scriptContextStarted(const ServiceWorkerJobDataIdentifier&);
-    void didFinishInstall(const ServiceWorkerJobDataIdentifier&, bool wasSuccessful);
</del><ins>+    void scriptContextFailedToStart(const std::optional<ServiceWorkerJobDataIdentifier>&, const String& message);
+    void scriptContextStarted(const std::optional<ServiceWorkerJobDataIdentifier>&);
+    void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, bool wasSuccessful);
</ins><span class="cx">     void didFinishActivation();
</span><span class="cx">     void contextTerminated();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebKit/ChangeLog       2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-11-29  Brady Eidson  <beidson@apple.com>
+
+        When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
+        https://bugs.webkit.org/show_bug.cgi?id=180166
+
+        Reviewed by Chris Dumez.
+
+        * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
+
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
+        (WebKit::WebSWContextManagerConnection::didFinishInstall):
+        * WebProcess/Storage/WebSWContextManagerConnection.h:
+
</ins><span class="cx"> 2017-11-29  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add support for service worker generated redirections
</span></span></pre></div>
<a id="trunkSourceWebKitStorageProcessServiceWorkerWebSWServerToContextConnectionmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in      2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in 2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -25,9 +25,9 @@
</span><span class="cx"> messages -> WebSWServerToContextConnection {
</span><span class="cx">     # When possible, these messages can be implemented directly by WebCore::SWServerToContextConnection
</span><span class="cx"> 
</span><del>-    ScriptContextFailedToStart(struct WebCore::ServiceWorkerJobDataIdentifier jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message);
-    ScriptContextStarted(struct WebCore::ServiceWorkerJobDataIdentifier jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier);
-    DidFinishInstall(struct WebCore::ServiceWorkerJobDataIdentifier jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful);
</del><ins>+    ScriptContextFailedToStart(std::optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message);
+    ScriptContextStarted(std::optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier);
+    DidFinishInstall(std::optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful);
</ins><span class="cx">     DidFinishActivation(WebCore::ServiceWorkerIdentifier identifier);
</span><span class="cx">     SetServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier identifier, bool hasPendingEvents);
</span><span class="cx">     WorkerTerminated(WebCore::ServiceWorkerIdentifier identifier);
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessStorageWebSWContextManagerConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp    2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx">     LOG(ServiceWorker, "Context process PID: %i created worker thread\n", getpid());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage)
</del><ins>+void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage)
</ins><span class="cx"> {
</span><span class="cx">     if (exceptionMessage.isEmpty())
</span><span class="cx">         m_connectionToStorageProcess->send(Messages::WebSWServerToContextConnection::ScriptContextStarted(jobDataIdentifier, serviceWorkerIdentifier), 0);
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx">     m_connectionToStorageProcess->send(Messages::StorageProcess::PostMessageToServiceWorkerClient(destinationIdentifier, IPC::DataReference { message->data() }, sourceIdentifier, sourceOrigin), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebSWContextManagerConnection::didFinishInstall(const ServiceWorkerJobDataIdentifier& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful)
</del><ins>+void WebSWContextManagerConnection::didFinishInstall(std::optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful)
</ins><span class="cx"> {
</span><span class="cx">     m_connectionToStorageProcess->send(Messages::WebSWServerToContextConnection::DidFinishInstall(jobDataIdentifier, serviceWorkerIdentifier, wasSuccessful), 0);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessStorageWebSWContextManagerConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (225297 => 225298)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h   2017-11-29 23:03:49 UTC (rev 225297)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h      2017-11-29 23:16:03 UTC (rev 225298)
</span><span class="lines">@@ -57,13 +57,13 @@
</span><span class="cx"> 
</span><span class="cx">     // WebCore::SWContextManager::Connection.
</span><span class="cx">     void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, Ref<WebCore::SerializedScriptValue>&& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;
</span><del>-    void didFinishInstall(const WebCore::ServiceWorkerJobDataIdentifier&, WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final;
</del><ins>+    void didFinishInstall(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final;
</ins><span class="cx">     void didFinishActivation(WebCore::ServiceWorkerIdentifier) final;
</span><span class="cx">     void setServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier, bool) final;
</span><span class="cx">     void workerTerminated(WebCore::ServiceWorkerIdentifier) final;
</span><span class="cx"> 
</span><span class="cx">     // IPC messages.
</span><del>-    void serviceWorkerStartedWithMessage(const WebCore::ServiceWorkerJobDataIdentifier&, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;
</del><ins>+    void serviceWorkerStartedWithMessage(std::optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;
</ins><span class="cx">     void installServiceWorker(const WebCore::ServiceWorkerContextData&);
</span><span class="cx">     void startFetch(WebCore::SWServerConnectionIdentifier, uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&);
</span><span class="cx">     void postMessageToServiceWorkerGlobalScope(WebCore::ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& sourceData);
</span></span></pre>
</div>
</div>

</body>
</html>