<!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>[205125] trunk/Source/WebKit2</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/205125">205125</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-08-29 10:49:13 -0700 (Mon, 29 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove sync message sending from secondary threads
https://bugs.webkit.org/show_bug.cgi?id=161277

Reviewed by Sam Weinig.

This codepath hasn't been used for some time, and removing it will make it easier to make IPC::Connection backed by libxpc.

* Platform/IPC/Connection.cpp:
(IPC::Connection::sendSyncMessage):
(IPC::Connection::processIncomingSyncReply):
(IPC::Connection::connectionDidClose):
(IPC::Connection::sendSyncMessageFromSecondaryThread): Deleted.
* Platform/IPC/Connection.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectioncpp">trunk/Source/WebKit2/Platform/IPC/Connection.cpp</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectionh">trunk/Source/WebKit2/Platform/IPC/Connection.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (205124 => 205125)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-08-29 17:26:47 UTC (rev 205124)
+++ trunk/Source/WebKit2/ChangeLog        2016-08-29 17:49:13 UTC (rev 205125)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-08-26  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Remove sync message sending from secondary threads
+        https://bugs.webkit.org/show_bug.cgi?id=161277
+
+        Reviewed by Sam Weinig.
+
+        This codepath hasn't been used for some time, and removing it will make it easier to make IPC::Connection backed by libxpc.
+
+        * Platform/IPC/Connection.cpp:
+        (IPC::Connection::sendSyncMessage):
+        (IPC::Connection::processIncomingSyncReply):
+        (IPC::Connection::connectionDidClose):
+        (IPC::Connection::sendSyncMessageFromSecondaryThread): Deleted.
+        * Platform/IPC/Connection.h:
+
</ins><span class="cx"> 2016-08-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Accelerated compositing does not work in Wayland
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.cpp (205124 => 205125)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.cpp        2016-08-29 17:26:47 UTC (rev 205124)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.cpp        2016-08-29 17:49:13 UTC (rev 205125)
</span><span class="lines">@@ -98,15 +98,6 @@
</span><span class="cx">     Vector&lt;ConnectionAndIncomingMessage&gt; m_messagesToDispatchWhileWaitingForSyncReply;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class Connection::SecondaryThreadPendingSyncReply {
-public:
-    // The reply decoder, will be null if there was an error processing the sync message on the other side.
-    std::unique_ptr&lt;Decoder&gt; replyDecoder;
-
-    BinarySemaphore semaphore;
-};
-
-
</del><span class="cx"> Connection::SyncMessageState&amp; Connection::SyncMessageState::singleton()
</span><span class="cx"> {
</span><span class="cx">     static std::once_flag onceFlag;
</span><span class="lines">@@ -449,13 +440,8 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;Decoder&gt; Connection::sendSyncMessage(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt; encoder, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</span><span class="cx"> {
</span><del>-    if (!RunLoop::isMain()) {
-        // No flags are supported for synchronous messages sent from secondary threads.
-        ASSERT(sendSyncOptions.isEmpty());
</del><ins>+    ASSERT(RunLoop::isMain());
</ins><span class="cx"> 
</span><del>-        return sendSyncMessageFromSecondaryThread(syncRequestID, WTFMove(encoder), timeout);
-    }
-
</del><span class="cx">     if (!isValid()) {
</span><span class="cx">         didFailToSendSyncMessage();
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -497,40 +483,6 @@
</span><span class="cx">     return reply;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;Decoder&gt; Connection::sendSyncMessageFromSecondaryThread(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt; encoder, std::chrono::milliseconds timeout)
-{
-    ASSERT(!RunLoop::isMain());
-
-    if (!isValid())
-        return nullptr;
-
-    SecondaryThreadPendingSyncReply pendingReply;
-
-    // Push the pending sync reply information on our stack.
-    {
-        LockHolder locker(m_syncReplyStateMutex);
-        if (!m_shouldWaitForSyncReplies)
-            return nullptr;
-
-        ASSERT(!m_secondaryThreadPendingSyncReplyMap.contains(syncRequestID));
-        m_secondaryThreadPendingSyncReplyMap.add(syncRequestID, &amp;pendingReply);
-    }
-
-    sendMessage(WTFMove(encoder), { });
-
-    timeout = timeoutRespectingIgnoreTimeoutsForTesting(timeout);
-    pendingReply.semaphore.wait(currentTime() + (timeout.count() / 1000.0));
-
-    // Finally, pop the pending sync reply information.
-    {
-        LockHolder locker(m_syncReplyStateMutex);
-        ASSERT(m_secondaryThreadPendingSyncReplyMap.contains(syncRequestID));
-        m_secondaryThreadPendingSyncReplyMap.remove(syncRequestID);
-    }
-
-    return WTFMove(pendingReply.replyDecoder);
-}
-
</del><span class="cx"> std::unique_ptr&lt;Decoder&gt; Connection::waitForSyncReply(uint64_t syncRequestID, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions)
</span><span class="cx"> {
</span><span class="cx">     timeout = timeoutRespectingIgnoreTimeoutsForTesting(timeout);
</span><span class="lines">@@ -605,15 +557,6 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // If it's not a reply to any primary thread message, check if it is a reply to a secondary thread one.
-    SecondaryThreadPendingSyncReplyMap::iterator secondaryThreadReplyMapItem = m_secondaryThreadPendingSyncReplyMap.find(decoder-&gt;destinationID());
-    if (secondaryThreadReplyMapItem != m_secondaryThreadPendingSyncReplyMap.end()) {
-        SecondaryThreadPendingSyncReply* reply = secondaryThreadReplyMapItem-&gt;value;
-        ASSERT(!reply-&gt;replyDecoder);
-        reply-&gt;replyDecoder = WTFMove(decoder);
-        reply-&gt;semaphore.signal();
-    }
-
</del><span class="cx">     // If we get here, it means we got a reply for a message that wasn't in the sync request stack or map.
</span><span class="cx">     // This can happen if the send timed out, so it's fine to ignore.
</span><span class="cx"> }
</span><span class="lines">@@ -745,9 +688,6 @@
</span><span class="cx"> 
</span><span class="cx">         if (!m_pendingSyncReplies.isEmpty())
</span><span class="cx">             SyncMessageState::singleton().wakeUpClientRunLoop();
</span><del>-
-        for (SecondaryThreadPendingSyncReplyMap::iterator iter = m_secondaryThreadPendingSyncReplyMap.begin(); iter != m_secondaryThreadPendingSyncReplyMap.end(); ++iter)
-            iter-&gt;value-&gt;semaphore.signal();
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (205124 => 205125)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.h        2016-08-29 17:26:47 UTC (rev 205124)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h        2016-08-29 17:49:13 UTC (rev 205125)
</span><span class="lines">@@ -172,7 +172,6 @@
</span><span class="cx">     std::unique_ptr&lt;Encoder&gt; createSyncMessageEncoder(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, uint64_t&amp; syncRequestID);
</span><span class="cx">     bool sendMessage(std::unique_ptr&lt;Encoder&gt;, OptionSet&lt;SendOption&gt; sendOptions);
</span><span class="cx">     std::unique_ptr&lt;Decoder&gt; sendSyncMessage(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt;, std::chrono::milliseconds timeout, OptionSet&lt;SendSyncOption&gt; sendSyncOptions);
</span><del>-    std::unique_ptr&lt;Decoder&gt; sendSyncMessageFromSecondaryThread(uint64_t syncRequestID, std::unique_ptr&lt;Encoder&gt;, std::chrono::milliseconds timeout);
</del><span class="cx">     bool sendSyncReply(std::unique_ptr&lt;Encoder&gt;);
</span><span class="cx"> 
</span><span class="cx">     void wakeUpRunLoop();
</span><span class="lines">@@ -306,10 +305,6 @@
</span><span class="cx">     bool m_shouldWaitForSyncReplies;
</span><span class="cx">     Vector&lt;PendingSyncReply&gt; m_pendingSyncReplies;
</span><span class="cx"> 
</span><del>-    class SecondaryThreadPendingSyncReply;
-    typedef HashMap&lt;uint64_t, SecondaryThreadPendingSyncReply*&gt; SecondaryThreadPendingSyncReplyMap;
-    SecondaryThreadPendingSyncReplyMap m_secondaryThreadPendingSyncReplyMap;
-
</del><span class="cx">     Lock m_incomingSyncMessageCallbackMutex;
</span><span class="cx">     HashMap&lt;uint64_t, std::function&lt;void ()&gt;&gt; m_incomingSyncMessageCallbacks;
</span><span class="cx">     RefPtr&lt;WorkQueue&gt; m_incomingSyncMessageCallbackQueue;
</span></span></pre>
</div>
</div>

</body>
</html>