<!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>[194895] 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/194895">194895</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-12 09:23:27 -0800 (Tue, 12 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move ChildProcessProxy from Shared to UIProcess
https://bugs.webkit.org/show_bug.cgi?id=125570

Patch by Carlos Garcia Campos &lt;cgarcia@igalia.com&gt; on 2016-01-12
Reviewed by Darin Adler.

ChildProcessProxy is only used by the UI process.

* CMakeLists.txt:
* PlatformGTK.cmake:
* UIProcess/ChildProcessProxy.cpp: Renamed from Source/WebKit2/Shared/ChildProcessProxy.cpp.
(WebKit::ChildProcessProxy::ChildProcessProxy):
(WebKit::ChildProcessProxy::~ChildProcessProxy):
(WebKit::ChildProcessProxy::fromConnection):
(WebKit::ChildProcessProxy::getLaunchOptions):
(WebKit::ChildProcessProxy::connect):
(WebKit::ChildProcessProxy::terminate):
(WebKit::ChildProcessProxy::state):
(WebKit::ChildProcessProxy::sendMessage):
(WebKit::ChildProcessProxy::addMessageReceiver):
(WebKit::ChildProcessProxy::removeMessageReceiver):
(WebKit::ChildProcessProxy::dispatchMessage):
(WebKit::ChildProcessProxy::dispatchSyncMessage):
(WebKit::ChildProcessProxy::didFinishLaunching):
(WebKit::ChildProcessProxy::shutDownProcess):
(WebKit::ChildProcessProxy::connectionWillOpen):
* UIProcess/ChildProcessProxy.h: Renamed from Source/WebKit2/Shared/ChildProcessProxy.h.
(WebKit::ChildProcessProxy::connection):
(WebKit::ChildProcessProxy::processIdentifier):
(WebKit::ChildProcessProxy::canSendMessage):
(WebKit::ChildProcessProxy::send):
(WebKit::ChildProcessProxy::sendSync):
* WebKit2.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessChildProcessProxycpp">trunk/Source/WebKit2/UIProcess/ChildProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessChildProcessProxyh">trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedChildProcessProxycpp">trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedChildProcessProxyh">trunk/Source/WebKit2/Shared/ChildProcessProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (194894 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2016-01-12 17:17:44 UTC (rev 194894)
+++ trunk/Source/WebKit2/CMakeLists.txt        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -231,7 +231,6 @@
</span><span class="cx">     Shared/BlobDataFileReferenceWithSandboxExtension.cpp
</span><span class="cx">     Shared/CacheModel.cpp
</span><span class="cx">     Shared/ChildProcess.cpp
</span><del>-    Shared/ChildProcessProxy.cpp
</del><span class="cx">     Shared/ContextMenuContextData.cpp
</span><span class="cx">     Shared/EditorState.cpp
</span><span class="cx">     Shared/FontInfo.cpp
</span><span class="lines">@@ -337,6 +336,7 @@
</span><span class="cx"> 
</span><span class="cx">     Shared/WebsiteData/WebsiteData.cpp
</span><span class="cx"> 
</span><ins>+    UIProcess/ChildProcessProxy.cpp
</ins><span class="cx">     UIProcess/DrawingAreaProxy.cpp
</span><span class="cx">     UIProcess/FrameLoadState.cpp
</span><span class="cx">     UIProcess/GeolocationPermissionRequestManagerProxy.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (194894 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-01-12 17:17:44 UTC (rev 194894)
+++ trunk/Source/WebKit2/ChangeLog        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -1,5 +1,40 @@
</span><span class="cx"> 2016-01-12  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        Move ChildProcessProxy from Shared to UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=125570
+
+        Reviewed by Darin Adler.
+
+        ChildProcessProxy is only used by the UI process.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+        * UIProcess/ChildProcessProxy.cpp: Renamed from Source/WebKit2/Shared/ChildProcessProxy.cpp.
+        (WebKit::ChildProcessProxy::ChildProcessProxy):
+        (WebKit::ChildProcessProxy::~ChildProcessProxy):
+        (WebKit::ChildProcessProxy::fromConnection):
+        (WebKit::ChildProcessProxy::getLaunchOptions):
+        (WebKit::ChildProcessProxy::connect):
+        (WebKit::ChildProcessProxy::terminate):
+        (WebKit::ChildProcessProxy::state):
+        (WebKit::ChildProcessProxy::sendMessage):
+        (WebKit::ChildProcessProxy::addMessageReceiver):
+        (WebKit::ChildProcessProxy::removeMessageReceiver):
+        (WebKit::ChildProcessProxy::dispatchMessage):
+        (WebKit::ChildProcessProxy::dispatchSyncMessage):
+        (WebKit::ChildProcessProxy::didFinishLaunching):
+        (WebKit::ChildProcessProxy::shutDownProcess):
+        (WebKit::ChildProcessProxy::connectionWillOpen):
+        * UIProcess/ChildProcessProxy.h: Renamed from Source/WebKit2/Shared/ChildProcessProxy.h.
+        (WebKit::ChildProcessProxy::connection):
+        (WebKit::ChildProcessProxy::processIdentifier):
+        (WebKit::ChildProcessProxy::canSendMessage):
+        (WebKit::ChildProcessProxy::send):
+        (WebKit::ChildProcessProxy::sendSync):
+        * WebKit2.xcodeproj/project.pbxproj:
+
+2016-01-12  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
</ins><span class="cx">         [GTK] UI process crashes if webkit_web_view_get_tls_info is called before internal load-committed event
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=142375
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (194894 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2016-01-12 17:17:44 UTC (rev 194894)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -744,7 +744,6 @@
</span><span class="cx">         Shared/ActivityAssertion.cpp
</span><span class="cx">         Shared/BlobDataFileReferenceWithSandboxExtension.cpp
</span><span class="cx">         Shared/ChildProcess.cpp
</span><del>-        Shared/ChildProcessProxy.cpp
</del><span class="cx">         Shared/ShareableBitmap.cpp
</span><span class="cx">         Shared/WebCoreArgumentCoders.cpp
</span><span class="cx">         Shared/WebEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcessProxycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp (194894 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp        2016-01-12 17:17:44 UTC (rev 194894)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -1,200 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 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.
- */
-
-#include &quot;config.h&quot;
-#include &quot;ChildProcessProxy.h&quot;
-
-#include &quot;ChildProcessMessages.h&quot;
-#include &lt;wtf/RunLoop.h&gt;
-
-namespace WebKit {
-
-ChildProcessProxy::ChildProcessProxy()
-{
-}
-
-ChildProcessProxy::~ChildProcessProxy()
-{
-    if (m_connection)
-        m_connection-&gt;invalidate();
-
-    if (m_processLauncher) {
-        m_processLauncher-&gt;invalidate();
-        m_processLauncher = nullptr;
-    }
-}
-
-ChildProcessProxy* ChildProcessProxy::fromConnection(IPC::Connection* connection)
-{
-    ASSERT(connection);
-
-    ChildProcessProxy* childProcessProxy = static_cast&lt;ChildProcessProxy*&gt;(connection-&gt;client());
-    ASSERT(childProcessProxy-&gt;connection() == connection);
-
-    return childProcessProxy;
-}
-
-void ChildProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&amp; launchOptions)
-{
-    if (const char* userDirectorySuffix = getenv(&quot;DIRHELPER_USER_DIR_SUFFIX&quot;))
-        launchOptions.extraInitializationData.add(ASCIILiteral(&quot;user-directory-suffix&quot;), userDirectorySuffix);
-}
-
-void ChildProcessProxy::connect()
-{
-    ASSERT(!m_processLauncher);
-    ProcessLauncher::LaunchOptions launchOptions;
-    getLaunchOptions(launchOptions);
-    m_processLauncher = ProcessLauncher::create(this, launchOptions);
-}
-
-void ChildProcessProxy::terminate()
-{
-#if PLATFORM(COCOA)
-    if (m_connection &amp;&amp; m_connection-&gt;kill())
-        return;
-#endif
-
-    // FIXME: We should really merge process launching into IPC connection creation and get rid of the process launcher.
-    if (m_processLauncher)
-        m_processLauncher-&gt;terminateProcess();
-}
-
-ChildProcessProxy::State ChildProcessProxy::state() const
-{
-    if (m_processLauncher &amp;&amp; m_processLauncher-&gt;isLaunching())
-        return ChildProcessProxy::State::Launching;
-
-    if (!m_connection)
-        return ChildProcessProxy::State::Terminated;
-
-    return ChildProcessProxy::State::Running;
-}
-
-bool ChildProcessProxy::sendMessage(std::unique_ptr&lt;IPC::MessageEncoder&gt; encoder, unsigned messageSendFlags)
-{
-    switch (state()) {
-    case State::Launching:
-        // If we're waiting for the child process to launch, we need to stash away the messages so we can send them once we have a connection.
-        m_pendingMessages.append(std::make_pair(WTFMove(encoder), messageSendFlags));
-        return true;
-
-    case State::Running:
-        return connection()-&gt;sendMessage(WTFMove(encoder), messageSendFlags);
-
-    case State::Terminated:
-        return false;
-    }
-
-    return false;
-}
-
-void ChildProcessProxy::addMessageReceiver(IPC::StringReference messageReceiverName, IPC::MessageReceiver&amp; messageReceiver)
-{
-    m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver);
-}
-
-void ChildProcessProxy::addMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID, IPC::MessageReceiver&amp; messageReceiver)
-{
-    m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver);
-}
-
-void ChildProcessProxy::removeMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID)
-{
-    m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID);
-}
-
-void ChildProcessProxy::removeMessageReceiver(IPC::StringReference messageReceiverName)
-{
-    m_messageReceiverMap.removeMessageReceiver(messageReceiverName);
-}
-
-bool ChildProcessProxy::dispatchMessage(IPC::Connection&amp; connection, IPC::MessageDecoder&amp; decoder)
-{
-    return m_messageReceiverMap.dispatchMessage(connection, decoder);
-}
-
-bool ChildProcessProxy::dispatchSyncMessage(IPC::Connection&amp; connection, IPC::MessageDecoder&amp; decoder, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp; replyEncoder)
-{
-    return m_messageReceiverMap.dispatchSyncMessage(connection, decoder, replyEncoder);
-}
-
-void ChildProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier connectionIdentifier)
-{
-    ASSERT(!m_connection);
-
-    m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
-#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt;= 101000
-    m_connection-&gt;setShouldCloseConnectionOnMachExceptions();
-#endif
-
-    connectionWillOpen(*m_connection);
-    m_connection-&gt;open();
-
-    for (size_t i = 0; i &lt; m_pendingMessages.size(); ++i) {
-        std::unique_ptr&lt;IPC::MessageEncoder&gt; message = WTFMove(m_pendingMessages[i].first);
-        unsigned messageSendFlags = m_pendingMessages[i].second;
-        m_connection-&gt;sendMessage(WTFMove(message), messageSendFlags);
-    }
-
-    m_pendingMessages.clear();
-}
-
-void ChildProcessProxy::shutDownProcess()
-{
-    switch (state()) {
-    case State::Launching:
-        m_processLauncher-&gt;invalidate();
-        m_processLauncher = nullptr;
-        break;
-    case State::Running:
-#if PLATFORM(IOS)
-        // On iOS deploy a watchdog in the UI process, since the child process may be suspended.
-        // If 30s is insufficient for any outstanding activity to complete cleanly, then it will be killed.
-        ASSERT(m_connection);
-        m_connection-&gt;terminateSoon(30);
-#endif
-        break;
-    case State::Terminated:
-        return;
-    }
-
-    if (!m_connection)
-        return;
-
-    processWillShutDown(*m_connection);
-
-    if (canSendMessage())
-        send(Messages::ChildProcess::ShutDown(), 0);
-
-    m_connection-&gt;invalidate();
-    m_connection = nullptr;
-}
-
-void ChildProcessProxy::connectionWillOpen(IPC::Connection&amp;)
-{
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcessProxyh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/Shared/ChildProcessProxy.h (194894 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcessProxy.h        2016-01-12 17:17:44 UTC (rev 194894)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.h        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -1,121 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 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.
- */
-
-#ifndef ChildProcessProxy_h
-#define ChildProcessProxy_h
-
-#include &quot;Connection.h&quot;
-#include &quot;MessageReceiverMap.h&quot;
-#include &quot;ProcessLauncher.h&quot;
-
-#include &lt;wtf/ThreadSafeRefCounted.h&gt;
-
-namespace WebKit {
-
-class ChildProcessProxy : ProcessLauncher::Client, public IPC::Connection::Client, public ThreadSafeRefCounted&lt;ChildProcessProxy&gt; {
-    WTF_MAKE_NONCOPYABLE(ChildProcessProxy);
-
-public:
-    ChildProcessProxy();
-    virtual ~ChildProcessProxy();
-
-    // FIXME: This function does an unchecked upcast, and it is only used in a deprecated code path. Would like to get rid of it.
-    static ChildProcessProxy* fromConnection(IPC::Connection*);
-
-    void connect();
-    void terminate();
-
-    template&lt;typename T&gt; bool send(T&amp;&amp; message, uint64_t destinationID, unsigned messageSendFlags = 0);
-    template&lt;typename T&gt; bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp;, uint64_t destinationID, std::chrono::milliseconds timeout = std::chrono::seconds(1), unsigned sendSyncFlags = 0);
-    
-    IPC::Connection* connection() const
-    {
-        ASSERT(m_connection);
-        return m_connection.get();
-    }
-
-    void addMessageReceiver(IPC::StringReference messageReceiverName, IPC::MessageReceiver&amp;);
-    void addMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID, IPC::MessageReceiver&amp;);
-    void removeMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID);
-    void removeMessageReceiver(IPC::StringReference messageReceiverName);
-
-    enum class State {
-        Launching,
-        Running,
-        Terminated,
-    };
-    State state() const;
-
-    PlatformProcessIdentifier processIdentifier() const { return m_processLauncher-&gt;processIdentifier(); }
-
-    bool canSendMessage() const { return state() != State::Terminated;}
-    bool sendMessage(std::unique_ptr&lt;IPC::MessageEncoder&gt;, unsigned messageSendFlags);
-
-    void shutDownProcess();
-
-protected:
-    // ProcessLauncher::Client
-    virtual void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
-
-    bool dispatchMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;);
-    bool dispatchSyncMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp;);
-    
-    virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&amp;);
-
-private:
-    virtual void connectionWillOpen(IPC::Connection&amp;);
-    virtual void processWillShutDown(IPC::Connection&amp;) = 0;
-
-    Vector&lt;std::pair&lt;std::unique_ptr&lt;IPC::MessageEncoder&gt;, unsigned&gt;&gt; m_pendingMessages;
-    RefPtr&lt;ProcessLauncher&gt; m_processLauncher;
-    RefPtr&lt;IPC::Connection&gt; m_connection;
-    IPC::MessageReceiverMap m_messageReceiverMap;
-};
-
-template&lt;typename T&gt;
-bool ChildProcessProxy::send(T&amp;&amp; message, uint64_t destinationID, unsigned messageSendFlags)
-{
-    COMPILE_ASSERT(!T::isSync, AsyncMessageExpected);
-
-    auto encoder = std::make_unique&lt;IPC::MessageEncoder&gt;(T::receiverName(), T::name(), destinationID);
-    encoder-&gt;encode(message.arguments());
-
-    return sendMessage(WTFMove(encoder), messageSendFlags);
-}
-
-template&lt;typename U&gt; 
-bool ChildProcessProxy::sendSync(U&amp;&amp; message, typename U::Reply&amp;&amp; reply, uint64_t destinationID, std::chrono::milliseconds timeout, unsigned sendSyncFlags)
-{
-    COMPILE_ASSERT(U::isSync, SyncMessageExpected);
-
-    if (!m_connection)
-        return false;
-
-    return connection()-&gt;sendSync(std::forward&lt;U&gt;(message), WTFMove(reply), destinationID, timeout, sendSyncFlags);
-}
-
-} // namespace WebKit
-
-#endif // ChildProcessProxy_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessChildProcessProxycppfromrev194894trunkSourceWebKit2SharedChildProcessProxycpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/ChildProcessProxy.cpp (from rev 194894, trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp) (0 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ChildProcessProxy.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ChildProcessProxy.cpp        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -0,0 +1,200 @@
</span><ins>+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ChildProcessProxy.h&quot;
+
+#include &quot;ChildProcessMessages.h&quot;
+#include &lt;wtf/RunLoop.h&gt;
+
+namespace WebKit {
+
+ChildProcessProxy::ChildProcessProxy()
+{
+}
+
+ChildProcessProxy::~ChildProcessProxy()
+{
+    if (m_connection)
+        m_connection-&gt;invalidate();
+
+    if (m_processLauncher) {
+        m_processLauncher-&gt;invalidate();
+        m_processLauncher = nullptr;
+    }
+}
+
+ChildProcessProxy* ChildProcessProxy::fromConnection(IPC::Connection* connection)
+{
+    ASSERT(connection);
+
+    ChildProcessProxy* childProcessProxy = static_cast&lt;ChildProcessProxy*&gt;(connection-&gt;client());
+    ASSERT(childProcessProxy-&gt;connection() == connection);
+
+    return childProcessProxy;
+}
+
+void ChildProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&amp; launchOptions)
+{
+    if (const char* userDirectorySuffix = getenv(&quot;DIRHELPER_USER_DIR_SUFFIX&quot;))
+        launchOptions.extraInitializationData.add(ASCIILiteral(&quot;user-directory-suffix&quot;), userDirectorySuffix);
+}
+
+void ChildProcessProxy::connect()
+{
+    ASSERT(!m_processLauncher);
+    ProcessLauncher::LaunchOptions launchOptions;
+    getLaunchOptions(launchOptions);
+    m_processLauncher = ProcessLauncher::create(this, launchOptions);
+}
+
+void ChildProcessProxy::terminate()
+{
+#if PLATFORM(COCOA)
+    if (m_connection &amp;&amp; m_connection-&gt;kill())
+        return;
+#endif
+
+    // FIXME: We should really merge process launching into IPC connection creation and get rid of the process launcher.
+    if (m_processLauncher)
+        m_processLauncher-&gt;terminateProcess();
+}
+
+ChildProcessProxy::State ChildProcessProxy::state() const
+{
+    if (m_processLauncher &amp;&amp; m_processLauncher-&gt;isLaunching())
+        return ChildProcessProxy::State::Launching;
+
+    if (!m_connection)
+        return ChildProcessProxy::State::Terminated;
+
+    return ChildProcessProxy::State::Running;
+}
+
+bool ChildProcessProxy::sendMessage(std::unique_ptr&lt;IPC::MessageEncoder&gt; encoder, unsigned messageSendFlags)
+{
+    switch (state()) {
+    case State::Launching:
+        // If we're waiting for the child process to launch, we need to stash away the messages so we can send them once we have a connection.
+        m_pendingMessages.append(std::make_pair(WTFMove(encoder), messageSendFlags));
+        return true;
+
+    case State::Running:
+        return connection()-&gt;sendMessage(WTFMove(encoder), messageSendFlags);
+
+    case State::Terminated:
+        return false;
+    }
+
+    return false;
+}
+
+void ChildProcessProxy::addMessageReceiver(IPC::StringReference messageReceiverName, IPC::MessageReceiver&amp; messageReceiver)
+{
+    m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver);
+}
+
+void ChildProcessProxy::addMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID, IPC::MessageReceiver&amp; messageReceiver)
+{
+    m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver);
+}
+
+void ChildProcessProxy::removeMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID)
+{
+    m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID);
+}
+
+void ChildProcessProxy::removeMessageReceiver(IPC::StringReference messageReceiverName)
+{
+    m_messageReceiverMap.removeMessageReceiver(messageReceiverName);
+}
+
+bool ChildProcessProxy::dispatchMessage(IPC::Connection&amp; connection, IPC::MessageDecoder&amp; decoder)
+{
+    return m_messageReceiverMap.dispatchMessage(connection, decoder);
+}
+
+bool ChildProcessProxy::dispatchSyncMessage(IPC::Connection&amp; connection, IPC::MessageDecoder&amp; decoder, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp; replyEncoder)
+{
+    return m_messageReceiverMap.dispatchSyncMessage(connection, decoder, replyEncoder);
+}
+
+void ChildProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier connectionIdentifier)
+{
+    ASSERT(!m_connection);
+
+    m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt;= 101000
+    m_connection-&gt;setShouldCloseConnectionOnMachExceptions();
+#endif
+
+    connectionWillOpen(*m_connection);
+    m_connection-&gt;open();
+
+    for (size_t i = 0; i &lt; m_pendingMessages.size(); ++i) {
+        std::unique_ptr&lt;IPC::MessageEncoder&gt; message = WTFMove(m_pendingMessages[i].first);
+        unsigned messageSendFlags = m_pendingMessages[i].second;
+        m_connection-&gt;sendMessage(WTFMove(message), messageSendFlags);
+    }
+
+    m_pendingMessages.clear();
+}
+
+void ChildProcessProxy::shutDownProcess()
+{
+    switch (state()) {
+    case State::Launching:
+        m_processLauncher-&gt;invalidate();
+        m_processLauncher = nullptr;
+        break;
+    case State::Running:
+#if PLATFORM(IOS)
+        // On iOS deploy a watchdog in the UI process, since the child process may be suspended.
+        // If 30s is insufficient for any outstanding activity to complete cleanly, then it will be killed.
+        ASSERT(m_connection);
+        m_connection-&gt;terminateSoon(30);
+#endif
+        break;
+    case State::Terminated:
+        return;
+    }
+
+    if (!m_connection)
+        return;
+
+    processWillShutDown(*m_connection);
+
+    if (canSendMessage())
+        send(Messages::ChildProcess::ShutDown(), 0);
+
+    m_connection-&gt;invalidate();
+    m_connection = nullptr;
+}
+
+void ChildProcessProxy::connectionWillOpen(IPC::Connection&amp;)
+{
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessChildProcessProxyhfromrev194894trunkSourceWebKit2SharedChildProcessProxyh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h (from rev 194894, trunk/Source/WebKit2/Shared/ChildProcessProxy.h) (0 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ChildProcessProxy.h        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -0,0 +1,121 @@
</span><ins>+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef ChildProcessProxy_h
+#define ChildProcessProxy_h
+
+#include &quot;Connection.h&quot;
+#include &quot;MessageReceiverMap.h&quot;
+#include &quot;ProcessLauncher.h&quot;
+
+#include &lt;wtf/ThreadSafeRefCounted.h&gt;
+
+namespace WebKit {
+
+class ChildProcessProxy : ProcessLauncher::Client, public IPC::Connection::Client, public ThreadSafeRefCounted&lt;ChildProcessProxy&gt; {
+    WTF_MAKE_NONCOPYABLE(ChildProcessProxy);
+
+public:
+    ChildProcessProxy();
+    virtual ~ChildProcessProxy();
+
+    // FIXME: This function does an unchecked upcast, and it is only used in a deprecated code path. Would like to get rid of it.
+    static ChildProcessProxy* fromConnection(IPC::Connection*);
+
+    void connect();
+    void terminate();
+
+    template&lt;typename T&gt; bool send(T&amp;&amp; message, uint64_t destinationID, unsigned messageSendFlags = 0);
+    template&lt;typename T&gt; bool sendSync(T&amp;&amp; message, typename T::Reply&amp;&amp;, uint64_t destinationID, std::chrono::milliseconds timeout = std::chrono::seconds(1), unsigned sendSyncFlags = 0);
+    
+    IPC::Connection* connection() const
+    {
+        ASSERT(m_connection);
+        return m_connection.get();
+    }
+
+    void addMessageReceiver(IPC::StringReference messageReceiverName, IPC::MessageReceiver&amp;);
+    void addMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID, IPC::MessageReceiver&amp;);
+    void removeMessageReceiver(IPC::StringReference messageReceiverName, uint64_t destinationID);
+    void removeMessageReceiver(IPC::StringReference messageReceiverName);
+
+    enum class State {
+        Launching,
+        Running,
+        Terminated,
+    };
+    State state() const;
+
+    PlatformProcessIdentifier processIdentifier() const { return m_processLauncher-&gt;processIdentifier(); }
+
+    bool canSendMessage() const { return state() != State::Terminated;}
+    bool sendMessage(std::unique_ptr&lt;IPC::MessageEncoder&gt;, unsigned messageSendFlags);
+
+    void shutDownProcess();
+
+protected:
+    // ProcessLauncher::Client
+    virtual void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
+
+    bool dispatchMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;);
+    bool dispatchSyncMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp;);
+    
+    virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&amp;);
+
+private:
+    virtual void connectionWillOpen(IPC::Connection&amp;);
+    virtual void processWillShutDown(IPC::Connection&amp;) = 0;
+
+    Vector&lt;std::pair&lt;std::unique_ptr&lt;IPC::MessageEncoder&gt;, unsigned&gt;&gt; m_pendingMessages;
+    RefPtr&lt;ProcessLauncher&gt; m_processLauncher;
+    RefPtr&lt;IPC::Connection&gt; m_connection;
+    IPC::MessageReceiverMap m_messageReceiverMap;
+};
+
+template&lt;typename T&gt;
+bool ChildProcessProxy::send(T&amp;&amp; message, uint64_t destinationID, unsigned messageSendFlags)
+{
+    COMPILE_ASSERT(!T::isSync, AsyncMessageExpected);
+
+    auto encoder = std::make_unique&lt;IPC::MessageEncoder&gt;(T::receiverName(), T::name(), destinationID);
+    encoder-&gt;encode(message.arguments());
+
+    return sendMessage(WTFMove(encoder), messageSendFlags);
+}
+
+template&lt;typename U&gt; 
+bool ChildProcessProxy::sendSync(U&amp;&amp; message, typename U::Reply&amp;&amp; reply, uint64_t destinationID, std::chrono::milliseconds timeout, unsigned sendSyncFlags)
+{
+    COMPILE_ASSERT(U::isSync, SyncMessageExpected);
+
+    if (!m_connection)
+        return false;
+
+    return connection()-&gt;sendSync(std::forward&lt;U&gt;(message), WTFMove(reply), destinationID, timeout, sendSyncFlags);
+}
+
+} // namespace WebKit
+
+#endif // ChildProcessProxy_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (194894 => 194895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-01-12 17:17:44 UTC (rev 194894)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-01-12 17:23:27 UTC (rev 194895)
</span><span class="lines">@@ -4720,8 +4720,6 @@
</span><span class="cx">                                 1A2D956E12848564001EB962 /* ChildProcess.cpp */,
</span><span class="cx">                                 1A2D956D12848564001EB962 /* ChildProcess.h */,
</span><span class="cx">                                 5164C0941B05B757004F102A /* ChildProcess.messages.in */,
</span><del>-                                E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */,
-                                E1513C65166EABB200149FCB /* ChildProcessProxy.h */,
</del><span class="cx">                                 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */,
</span><span class="cx">                                 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
</span><span class="cx">                                 5106D7BF18BDBE73000AB166 /* ContextMenuContextData.cpp */,
</span><span class="lines">@@ -6153,6 +6151,8 @@
</span><span class="cx">                                 1AAF089E192681AC00B6390C /* UserContent */,
</span><span class="cx">                                 1A53C2A31A325691004E8C70 /* WebsiteData */,
</span><span class="cx">                                 7CD102D91866770600ED429D /* AutoCorrectionCallback.h */,
</span><ins>+                                E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */,
+                                E1513C65166EABB200149FCB /* ChildProcessProxy.h */,
</ins><span class="cx">                                 BC2652121182608100243E12 /* DrawingAreaProxy.cpp */,
</span><span class="cx">                                 BC2652131182608100243E12 /* DrawingAreaProxy.h */,
</span><span class="cx">                                 1A6422FC12DD08FE00CAAE2C /* DrawingAreaProxy.messages.in */,
</span></span></pre>
</div>
</div>

</body>
</html>