<!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>[169255] 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/169255">169255</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-23 02:57:56 -0700 (Fri, 23 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[UNIX] Reorganize and cleanup main functions of GTK and EFL ports
https://bugs.webkit.org/show_bug.cgi?id=131024

Reviewed by Gustavo Noronha Silva.

Move main function implementation files to &lt;process-dir&gt;/EntryPoint/unix/&lt;ProcessName&gt;Main.cpp
files that are now shared by GTK and EFL ports. These files call a
main method that wraps a new method ChildProcessMain that contains
the common code and uses a helper class for the platform specific
code. GTK+ and EFL ports implement that helper class for every process type.

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp: Renamed from Source/WebKit2/efl/MainEfl.cpp.
(main):
* NetworkProcess/efl/NetworkProcessMainEfl.cpp: Renamed from Source/WebKit2/unix/NetworkMainUnix.cpp.
(WebKit::NetworkProcessMainUnix):
* NetworkProcess/gtk/NetworkProcessMainGtk.cpp: Renamed from Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp.
(WebKit::NetworkProcessMainUnix):
* NetworkProcess/unix/NetworkProcessMainUnix.h:
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PluginProcess/EntryPoint/unix/PluginProcessMain.cpp: Renamed from Source/WebKit2/unix/PluginMainUnix.cpp.
(main):
* PluginProcess/unix/PluginProcessMainUnix.cpp:
(WebKit::webkitXError):
(WebKit::PluginProcessMainUnix):
* PluginProcess/unix/PluginProcessMainUnix.h:
* Shared/unix/ChildProcessMain.cpp: Copied from Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h.
(WebKit::ChildProcessMainBase::parseCommandLine):
* Shared/unix/ChildProcessMain.h: Renamed from Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h.
(WebKit::ChildProcessMainBase::platformInitialize):
(WebKit::ChildProcessMainBase::platformFinalize):
(WebKit::ChildProcessMainBase::initializationParameters):
(WebKit::ChildProcessMain):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp: Renamed from Source/WebKit2/gtk/MainGtk.cpp.
(main):
* WebProcess/efl/WebProcessMainEfl.cpp:
(WebKit::WebProcessMainUnix):
(dummyExtensionErrorHandler): Deleted.
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMainUnix):
* WebProcess/unix/WebProcessMainUnix.h: Renamed from Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixh">trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformEflcmake">trunk/Source/WebKit2/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessunixPluginProcessMainUnixcpp">trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessunixPluginProcessMainUnixh">trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesseflWebProcessMainEflcpp">trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessgtkWebProcessMainGtkcpp">trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebKit2/NetworkProcess/EntryPoint/unix/</li>
<li><a href="#trunkSourceWebKit2NetworkProcessEntryPointunixNetworkProcessMaincpp">trunk/Source/WebKit2/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp</a></li>
<li>trunk/Source/WebKit2/NetworkProcess/efl/</li>
<li><a href="#trunkSourceWebKit2NetworkProcesseflNetworkProcessMainEflcpp">trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp</a></li>
<li>trunk/Source/WebKit2/NetworkProcess/gtk/</li>
<li><a href="#trunkSourceWebKit2NetworkProcessgtkNetworkProcessMainGtkcpp">trunk/Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp</a></li>
<li>trunk/Source/WebKit2/PluginProcess/EntryPoint/unix/</li>
<li><a href="#trunkSourceWebKit2PluginProcessEntryPointunixPluginProcessMaincpp">trunk/Source/WebKit2/PluginProcess/EntryPoint/unix/PluginProcessMain.cpp</a></li>
<li>trunk/Source/WebKit2/Shared/unix/</li>
<li><a href="#trunkSourceWebKit2SharedunixChildProcessMaincpp">trunk/Source/WebKit2/Shared/unix/ChildProcessMain.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedunixChildProcessMainh">trunk/Source/WebKit2/Shared/unix/ChildProcessMain.h</a></li>
<li>trunk/Source/WebKit2/WebProcess/EntryPoint/unix/</li>
<li><a href="#trunkSourceWebKit2WebProcessEntryPointunixWebProcessMaincpp">trunk/Source/WebKit2/WebProcess/EntryPoint/unix/WebProcessMain.cpp</a></li>
<li>trunk/Source/WebKit2/WebProcess/unix/</li>
<li><a href="#trunkSourceWebKit2WebProcessunixWebProcessMainUnixh">trunk/Source/WebKit2/WebProcess/unix/WebProcessMainUnix.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixcpp">trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesseflWebProcessMainEflh">trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessgtkWebProcessMainGtkh">trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h</a></li>
<li><a href="#trunkSourceWebKit2eflMainEflcpp">trunk/Source/WebKit2/efl/MainEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2gtkMainGtkcpp">trunk/Source/WebKit2/gtk/MainGtk.cpp</a></li>
<li>trunk/Source/WebKit2/unix/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2014-05-23  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [UNIX] Reorganize and cleanup main functions of GTK and EFL ports
+        https://bugs.webkit.org/show_bug.cgi?id=131024
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Move main function implementation files to &lt;process-dir&gt;/EntryPoint/unix/&lt;ProcessName&gt;Main.cpp
+        files that are now shared by GTK and EFL ports. These files call a
+        main method that wraps a new method ChildProcessMain that contains
+        the common code and uses a helper class for the platform specific
+        code. GTK+ and EFL ports implement that helper class for every process type.
+
+        * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp: Renamed from Source/WebKit2/efl/MainEfl.cpp.
+        (main):
+        * NetworkProcess/efl/NetworkProcessMainEfl.cpp: Renamed from Source/WebKit2/unix/NetworkMainUnix.cpp.
+        (WebKit::NetworkProcessMainUnix):
+        * NetworkProcess/gtk/NetworkProcessMainGtk.cpp: Renamed from Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp.
+        (WebKit::NetworkProcessMainUnix):
+        * NetworkProcess/unix/NetworkProcessMainUnix.h:
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+        * PluginProcess/EntryPoint/unix/PluginProcessMain.cpp: Renamed from Source/WebKit2/unix/PluginMainUnix.cpp.
+        (main):
+        * PluginProcess/unix/PluginProcessMainUnix.cpp:
+        (WebKit::webkitXError):
+        (WebKit::PluginProcessMainUnix):
+        * PluginProcess/unix/PluginProcessMainUnix.h:
+        * Shared/unix/ChildProcessMain.cpp: Copied from Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h.
+        (WebKit::ChildProcessMainBase::parseCommandLine):
+        * Shared/unix/ChildProcessMain.h: Renamed from Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h.
+        (WebKit::ChildProcessMainBase::platformInitialize):
+        (WebKit::ChildProcessMainBase::platformFinalize):
+        (WebKit::ChildProcessMainBase::initializationParameters):
+        (WebKit::ChildProcessMain):
+        * WebProcess/EntryPoint/unix/WebProcessMain.cpp: Renamed from Source/WebKit2/gtk/MainGtk.cpp.
+        (main):
+        * WebProcess/efl/WebProcessMainEfl.cpp:
+        (WebKit::WebProcessMainUnix):
+        (dummyExtensionErrorHandler): Deleted.
+        * WebProcess/gtk/WebProcessMainGtk.cpp:
+        (WebKit::WebProcessMainUnix):
+        * WebProcess/unix/WebProcessMainUnix.h: Renamed from Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h.
+
</ins><span class="cx"> 2014-05-22  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Have the decoded element in VectorArgumentCoder::decode() moved into Vector::append()
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessEntryPointunixNetworkProcessMaincppfromrev169254trunkSourceWebKit2eflMainEflcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp (from rev 169254, trunk/Source/WebKit2/efl/MainEfl.cpp) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp                                (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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;NetworkProcessMainUnix.h&quot;
+
+using namespace WebKit;
+
+int main(int argc, char** argv)
+{
+    return NetworkProcessMainUnix(argc, argv);
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesseflNetworkProcessMainEflcppfromrev169254trunkSourceWebKit2unixNetworkMainUnixcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp (from rev 169254, trunk/Source/WebKit2/unix/NetworkMainUnix.cpp) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp                                (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/efl/NetworkProcessMainEfl.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Company 100 Inc.
+ *
+ * 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 THE COPYRIGHT HOLDERS ``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;NetworkProcessMainUnix.h&quot;
+
+#if ENABLE(NETWORK_PROCESS)
+
+#include &quot;ChildProcessMain.h&quot;
+#include &quot;NetworkProcess.h&quot;
+#include &lt;Ecore.h&gt;
+#include &lt;WebCore/SoupNetworkSession.h&gt;
+#include &lt;libsoup/soup.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class NetworkProcessMain final: public ChildProcessMainBase {
+public:
+    bool platformInitialize() override
+    {
+        if (!ecore_init())
+            return false;
+
+        if (!ecore_main_loop_glib_integrate())
+            return false;
+
+        SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
+        return true;
+    }
+
+    void platformFinalize() override
+    {
+        if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+            soup_cache_flush(soupCache);
+            soup_cache_dump(soupCache);
+        }
+
+        ecore_shutdown();
+    }
+};
+
+int NetworkProcessMainUnix(int argc, char** argv)
+{
+    return ChildProcessMain&lt;NetworkProcess, NetworkProcessMain&gt;(argc, argv);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_PROCESS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessgtkNetworkProcessMainGtkcppfromrev169254trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp (from rev 169254, trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp                                (rev 0)
+++ trunk/Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2013 Company 100 Inc.
+ *
+ * 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 THE COPYRIGHT HOLDERS ``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;NetworkProcessMainUnix.h&quot;
+
+#if ENABLE(NETWORK_PROCESS)
+
+#include &quot;ChildProcessMain.h&quot;
+#include &quot;NetworkProcess.h&quot;
+#include &lt;WebCore/SoupNetworkSession.h&gt;
+#include &lt;libsoup/soup.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class NetworkProcessMain final: public ChildProcessMainBase {
+public:
+    bool platformInitialize() override
+    {
+        // Despite using system CAs to validate certificates we're
+        // accepting invalid certificates by default. New API will be
+        // added later to let client accept/discard invalid certificates.
+        SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
+        return true;
+    }
+
+    void platformFinalize() override
+    {
+        if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+            soup_cache_flush(soupCache);
+            soup_cache_dump(soupCache);
+        }
+    }
+};
+
+int NetworkProcessMainUnix(int argc, char** argv)
+{
+    return ChildProcessMain&lt;NetworkProcess, NetworkProcessMain&gt;(argc, argv);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_PROCESS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,99 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Company 100 Inc.
- *
- * 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 THE COPYRIGHT HOLDERS ``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;NetworkProcessMainUnix.h&quot;
-
-#if ENABLE(NETWORK_PROCESS)
-
-#include &quot;WKBase.h&quot;
-#include &quot;WebKit2Initialize.h&quot;
-#include &lt;WebCore/SoupNetworkSession.h&gt;
-#include &lt;WebKit/NetworkProcess.h&gt;
-#include &lt;runtime/InitializeThreading.h&gt;
-#include &lt;stdlib.h&gt;
-#include &lt;wtf/MainThread.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
-#include &lt;wtf/gobject/GRefPtr.h&gt;
-
-#if PLATFORM(EFL)
-#include &lt;Ecore.h&gt;
-#endif
-
-#if USE(SOUP)
-#include &lt;libsoup/soup.h&gt;
-#endif
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WK_EXPORT int NetworkProcessMain(int argc, char* argv[])
-{
-    if (argc != 2)
-        return 1;
-
-#if PLATFORM(EFL)
-    if (!ecore_init())
-        return 1;
-
-    if (!ecore_main_loop_glib_integrate())
-        return 1;
-#endif
-
-    InitializeWebKit2();
-
-    SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
-
-    int socket = atoi(argv[1]);
-
-    WebKit::ChildProcessInitializationParameters parameters;
-    parameters.connectionIdentifier = socket;
-
-    NetworkProcess::shared().initialize(parameters);
-
-#if USE(SOUP)
-    // Despite using system CAs to validate certificates we're
-    // accepting invalid certificates by default. New API will be
-    // added later to let client accept/discard invalid certificates.
-    SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
-#endif
-
-    RunLoop::run();
-
-#if USE(SOUP)
-    if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
-        soup_cache_flush(soupCache);
-        soup_cache_dump(soupCache);
-    }
-#endif
-
-    return 0;
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(NETWORK_PROCESS)
</del></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessunixNetworkProcessMainUnixh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.h (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.h        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.h        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -31,11 +31,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-#ifdef __cplusplus
</del><span class="cx"> extern &quot;C&quot; {
</span><del>-WK_EXPORT int NetworkProcessMain(int argc, char* argv[]);
-} // extern &quot;C&quot;
-#endif // __cplusplus
</del><ins>+WK_EXPORT int NetworkProcessMainUnix(int argc, char** argv);
+}
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformEfl.cmake (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformEfl.cmake        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/PlatformEfl.cmake        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,10 +1,10 @@
</span><span class="cx"> list(APPEND WebKit2_SOURCES
</span><ins>+    NetworkProcess/efl/NetworkProcessMainEfl.cpp
+
</ins><span class="cx">     NetworkProcess/soup/NetworkProcessSoup.cpp
</span><span class="cx">     NetworkProcess/soup/NetworkResourceLoadSchedulerSoup.cpp
</span><span class="cx">     NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
</span><span class="cx"> 
</span><del>-    NetworkProcess/unix/NetworkProcessMainUnix.cpp
-
</del><span class="cx">     Platform/IPC/unix/AttachmentUnix.cpp
</span><span class="cx">     Platform/IPC/unix/ConnectionUnix.cpp
</span><span class="cx"> 
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx"> 
</span><span class="cx">     Shared/soup/WebCoreArgumentCodersSoup.cpp
</span><span class="cx"> 
</span><ins>+    Shared/unix/ChildProcessMain.cpp
+
</ins><span class="cx">     UIProcess/DefaultUndoController.cpp
</span><span class="cx"> 
</span><span class="cx">     UIProcess/API/C/CoordinatedGraphics/WKView.cpp
</span><span class="lines">@@ -219,6 +221,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/opentype&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/network/soup&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/text/enchant&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/NetworkProcess/efl&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/NetworkProcess/unix&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Platform/efl&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/API/c/efl&quot;
</span><span class="lines">@@ -226,6 +229,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/Downloads/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/efl&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/soup&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/Shared/unix&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/cairo&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/CoordinatedGraphics&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/efl&quot;
</span><span class="lines">@@ -238,6 +242,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/efl&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/soup&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/WebProcess/unix&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/WebCoreSupport/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/WebPage/CoordinatedGraphics&quot;
</span><span class="lines">@@ -290,11 +295,11 @@
</span><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> list(APPEND WebProcess_SOURCES
</span><del>-    efl/MainEfl.cpp
</del><ins>+    WebProcess/EntryPoint/unix/WebProcessMain.cpp
</ins><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> list(APPEND NetworkProcess_SOURCES
</span><del>-        unix/NetworkMainUnix.cpp
</del><ins>+    NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
</ins><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> list(APPEND WebProcess_LIBRARIES
</span><span class="lines">@@ -406,7 +411,7 @@
</span><span class="cx">     include_directories(${PluginProcess_INCLUDE_DIRECTORIES})
</span><span class="cx"> 
</span><span class="cx">     list(APPEND PluginProcess_SOURCES
</span><del>-        ${WEBKIT2_DIR}/unix/PluginMainUnix.cpp
</del><ins>+        ${WEBKIT2_DIR}/PluginProcess/EntryPoint/unix/PluginProcessMain.cpp
</ins><span class="cx">     )
</span><span class="cx"> 
</span><span class="cx">     if (ENABLE_ECORE_X)
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -22,12 +22,12 @@
</span><span class="cx">     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitEnumTypes.cpp
</span><span class="cx">     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitMarshal.cpp
</span><span class="cx"> 
</span><ins>+    NetworkProcess/gtk/NetworkProcessMainGtk.cpp
+
</ins><span class="cx">     NetworkProcess/soup/NetworkProcessSoup.cpp
</span><span class="cx">     NetworkProcess/soup/NetworkResourceLoadSchedulerSoup.cpp
</span><span class="cx">     NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
</span><span class="cx"> 
</span><del>-    NetworkProcess/unix/NetworkProcessMainUnix.cpp
-
</del><span class="cx">     Platform/IPC/unix/AttachmentUnix.cpp
</span><span class="cx">     Platform/IPC/unix/ConnectionUnix.cpp
</span><span class="cx"> 
</span><span class="lines">@@ -75,6 +75,8 @@
</span><span class="cx"> 
</span><span class="cx">     Shared/soup/WebCoreArgumentCodersSoup.cpp
</span><span class="cx"> 
</span><ins>+    Shared/unix/ChildProcessMain.cpp
+
</ins><span class="cx">     UIProcess/DefaultUndoController.cpp
</span><span class="cx">     UIProcess/DrawingAreaProxyImpl.cpp
</span><span class="cx"> 
</span><span class="lines">@@ -397,12 +399,14 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/opentype&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/network/soup&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/text/enchant&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/NetworkProcess/gtk&quot;
+    &quot;${WEBKIT2_DIR}/NetworkProcess/unix&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/API/c/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/Network/CustomProtocols/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/Downloads/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/Shared/soup&quot;
</span><del>-    &quot;${WEBKIT2_DIR}/NetworkProcess/unix&quot;
</del><ins>+    &quot;${WEBKIT2_DIR}/Shared/unix&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/cairo&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/API/C/soup&quot;
</span><span class="lines">@@ -415,6 +419,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/soup&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/WebProcess/unix&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/WebCoreSupport/gtk&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/WebCoreSupport/soup&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/WebPage/atk&quot;
</span><span class="lines">@@ -438,11 +443,11 @@
</span><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> list(APPEND WebProcess_SOURCES
</span><del>-    gtk/MainGtk.cpp
</del><ins>+    WebProcess/EntryPoint/unix/WebProcessMain.cpp
</ins><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> list(APPEND NetworkProcess_SOURCES
</span><del>-    unix/NetworkMainUnix.cpp
</del><ins>+    NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
</ins><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> set(SharedWebKit2Libraries
</span><span class="lines">@@ -595,6 +600,8 @@
</span><span class="cx"> 
</span><span class="cx">         Platform/unix/SharedMemoryUnix.cpp
</span><span class="cx"> 
</span><ins>+        PluginProcess/EntryPoint/unix/PluginProcessMain.cpp
+
</ins><span class="cx">         PluginProcess/PluginControllerProxy.cpp
</span><span class="cx">         PluginProcess/PluginCreationParameters.cpp
</span><span class="cx">         PluginProcess/PluginProcess.cpp
</span><span class="lines">@@ -642,6 +649,8 @@
</span><span class="cx"> 
</span><span class="cx">         Shared/soup/WebCoreArgumentCodersSoup.cpp
</span><span class="cx"> 
</span><ins>+        Shared/unix/ChildProcessMain.cpp
+
</ins><span class="cx">         UIProcess/Launcher/ProcessLauncher.cpp
</span><span class="cx"> 
</span><span class="cx">         UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp
</span><span class="lines">@@ -658,8 +667,6 @@
</span><span class="cx"> 
</span><span class="cx">         WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
</span><span class="cx"> 
</span><del>-        unix/PluginMainUnix.cpp
-
</del><span class="cx">         ${DERIVED_SOURCES_WEBKIT2_DIR}/PluginControllerProxyMessageReceiver.cpp
</span><span class="cx">         ${DERIVED_SOURCES_WEBKIT2_DIR}/PluginProcessMessageReceiver.cpp
</span><span class="cx">         ${DERIVED_SOURCES_WEBKIT2_DIR}/WebProcessConnectionMessageReceiver.cpp
</span><span class="lines">@@ -699,7 +706,7 @@
</span><span class="cx"> 
</span><span class="cx">     # GTK3 PluginProcess
</span><span class="cx">     list(APPEND PluginProcess_SOURCES
</span><del>-        unix/PluginMainUnix.cpp
</del><ins>+        PluginProcess/EntryPoint/unix/PluginProcessMain.cpp
</ins><span class="cx">     )
</span><span class="cx"> 
</span><span class="cx"> endif () # ENABLE_PLUGIN_PROCESS
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessEntryPointunixPluginProcessMaincppfromrev169254trunkSourceWebKit2unixPluginMainUnixcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/PluginProcess/EntryPoint/unix/PluginProcessMain.cpp (from rev 169254, trunk/Source/WebKit2/unix/PluginMainUnix.cpp) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/EntryPoint/unix/PluginProcessMain.cpp                                (rev 0)
+++ trunk/Source/WebKit2/PluginProcess/EntryPoint/unix/PluginProcessMain.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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;PluginProcessMainUnix.h&quot;
+
+using namespace WebKit;
+
+int main(int argc, char** argv)
+{
+    return PluginProcessMainUnix(argc, argv);
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessunixPluginProcessMainUnixcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Igalia S.L.
</del><ins>+ * Copyright (C) 2011, 2014 Igalia S.L.
</ins><span class="cx">  * Copyright (C) 2011 Apple Inc.
</span><span class="cx">  * Copyright (C) 2012 Samsung Electronics
</span><span class="cx">  *
</span><span class="lines">@@ -30,96 +30,82 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(PLUGIN_PROCESS)
</span><span class="cx"> 
</span><ins>+#include &quot;ChildProcessMain.h&quot;
</ins><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;NetscapePlugin.h&quot;
</span><span class="cx"> #include &quot;PluginProcess.h&quot;
</span><del>-#include &quot;WebKit2Initialize.h&quot;
-#include &lt;libgen.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
</del><ins>+#include &lt;WebCore/FileSystem.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
</ins><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><del>-#if PLATFORM(X11) &amp;&amp; defined(GDK_WINDOWING_X11)
-#include &lt;gdk/gdkx.h&gt;
-#endif
</del><span class="cx"> #elif PLATFORM(EFL) &amp;&amp; HAVE_ECORE_X
</span><span class="cx"> #include &lt;Ecore_X.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-using namespace WebCore;
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-#ifdef XP_UNIX
</del><ins>+#if defined(XP_UNIX)
</ins><span class="cx"> 
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="cx"> static const char xErrorString[] = &quot;The program '%s' received an X Window System error.\n&quot;
</span><span class="cx">     &quot;This probably reflects a bug in a browser plugin.\n&quot;
</span><span class="cx">     &quot;The error was '%s'.\n&quot;
</span><span class="cx">     &quot;  (Details: serial %ld error_code %d request_code %d minor_code %d)\n&quot;;
</span><del>-#endif /* !LOG_DISABLED */
</del><ins>+#endif // !LOG_DISABLED
</ins><span class="cx"> 
</span><del>-static char* programName = 0;
</del><ins>+static CString programName;
</ins><span class="cx"> 
</span><span class="cx"> static int webkitXError(Display* xdisplay, XErrorEvent* error)
</span><span class="cx"> {
</span><span class="cx">     char errorMessage[64];
</span><span class="cx">     XGetErrorText(xdisplay, error-&gt;error_code, errorMessage, 63);
</span><span class="cx"> 
</span><del>-    LOG(Plugins, xErrorString,
-        programName, errorMessage,
-        error-&gt;serial, error-&gt;error_code,
-        error-&gt;request_code, error-&gt;minor_code);
</del><ins>+    LOG(Plugins, xErrorString, programName.data(), errorMessage, error-&gt;serial, error-&gt;error_code, error-&gt;request_code, error-&gt;minor_code);
</ins><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><del>-#endif
</del><ins>+#endif // XP_UNIX
</ins><span class="cx"> 
</span><del>-WK_EXPORT int PluginProcessMainUnix(int argc, char* argv[])
-{
-#if PLUGIN_ARCHITECTURE(X11)
-    bool scanPlugin = !strcmp(argv[1], &quot;-scanPlugin&quot;);
-#endif
-    ASSERT_UNUSED(argc, argc == 3);
-
</del><ins>+class PluginProcessMain final: public ChildProcessMainBase {
+public:
+    bool platformInitialize() override
+    {
</ins><span class="cx"> #if PLATFORM(GTK)
</span><del>-    gtk_init(&amp;argc, &amp;argv);
</del><ins>+        gtk_init(nullptr, nullptr);
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> #ifdef HAVE_ECORE_X
</span><del>-    if (!ecore_x_init(0))
</del><ins>+        if (!ecore_x_init(0))
</ins><span class="cx"> #endif
</span><del>-        return 1;
</del><ins>+            return false;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    InitializeWebKit2();
-
-#if PLUGIN_ARCHITECTURE(X11)
-    if (scanPlugin) {
-        String pluginPath(argv[2]);
-        if (!NetscapePluginModule::scanPlugin(pluginPath))
-            return EXIT_FAILURE;
-        return EXIT_SUCCESS;
</del><ins>+        return true;
</ins><span class="cx">     }
</span><del>-#endif
</del><span class="cx"> 
</span><del>-    // Plugins can produce X errors that are handled by the GDK X error handler, which
-    // exits the process. Since we don't want to crash due to plugin bugs, we install a
-    // custom error handler to show a warning when a X error happens without aborting.
</del><ins>+    bool parseCommandLine(int argc, char** argv) override
+    {
+        ASSERT(argc == 3);
+        if (argc != 3)
+            return false;
+
+        if (!strcmp(argv[1], &quot;-scanPlugin&quot;))
+            exit(NetscapePluginModule::scanPlugin(argv[2]) ? EXIT_SUCCESS : EXIT_FAILURE);
+
</ins><span class="cx"> #if defined(XP_UNIX)
</span><del>-    programName = basename(argv[0]);
-    XSetErrorHandler(webkitXError);
</del><ins>+        programName = WebCore::pathGetFileName(argv[0]).utf8();
+        XSetErrorHandler(webkitXError);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    int socket = atoi(argv[1]);
</del><ins>+        m_parameters.extraInitializationData.add(&quot;plugin-path&quot;, argv[2]);
+        return ChildProcessMainBase::parseCommandLine(argc, argv);
+    }
+};
</ins><span class="cx"> 
</span><del>-    WebKit::ChildProcessInitializationParameters parameters;
-    parameters.connectionIdentifier = socket;
-    parameters.extraInitializationData.add(&quot;plugin-path&quot;, argv[2]);
-
-    WebKit::PluginProcess::shared().initialize(parameters);
-
-    RunLoop::run();
-
-    return 0;
</del><ins>+int PluginProcessMainUnix(int argc, char** argv)
+{
+    return ChildProcessMain&lt;PluginProcess, PluginProcessMain&gt;(argc, argv);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessunixPluginProcessMainUnixh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.h (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.h        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.h        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -31,12 +31,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-#ifdef __cplusplus
</del><span class="cx"> extern &quot;C&quot; {
</span><del>-WK_EXPORT int PluginProcessMainUnix(int argc, char* argv[]);
-} // extern &quot;C&quot;
-#endif // __cplusplus
</del><ins>+WK_EXPORT int PluginProcessMainUnix(int argc, char** argv);
+}
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><del>-#endif // PluginProcessMain_h
</del><ins>+#endif // PluginProcessMainUnix_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedunixChildProcessMaincppfromrev169254trunkSourceWebKit2WebProcesseflWebProcessMainEflh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/unix/ChildProcessMain.cpp (from rev 169254, trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/unix/ChildProcessMain.cpp                                (rev 0)
+++ trunk/Source/WebKit2/Shared/unix/ChildProcessMain.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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;ChildProcessMain.h&quot;
+
+#include &lt;stdlib.h&gt;
+
+namespace WebKit {
+
+bool ChildProcessMainBase::parseCommandLine(int argc, char** argv)
+{
+    ASSERT(argc &gt;= 2);
+    if (argc &lt; 2)
+        return false;
+
+    m_parameters.connectionIdentifier = atoi(argv[1]);
+    return true;
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedunixChildProcessMainhfromrev169254trunkSourceWebKit2WebProcessgtkWebProcessMainGtkh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/unix/ChildProcessMain.h (from rev 169254, trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/unix/ChildProcessMain.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/unix/ChildProcessMain.h        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 ChildProcessMain_h
+#define ChildProcessMain_h
+
+#include &quot;ChildProcess.h&quot;
+#include &quot;WebKit2Initialize.h&quot;
+#include &lt;wtf/RunLoop.h&gt;
+
+namespace WebKit {
+
+class ChildProcessMainBase {
+public:
+    virtual bool platformInitialize() { return true; }
+    virtual bool parseCommandLine(int argc, char** argv);
+    virtual void platformFinalize() { }
+
+    const ChildProcessInitializationParameters&amp; initializationParameters() const { return m_parameters; }
+
+protected:
+    ChildProcessInitializationParameters m_parameters;
+};
+
+template&lt;typename ChildProcessType, typename ChildProcessMainType&gt;
+int ChildProcessMain(int argc, char** argv)
+{
+    ChildProcessMainType childMain;
+
+    if (!childMain.platformInitialize())
+        return EXIT_FAILURE;
+
+    InitializeWebKit2();
+
+    if (!childMain.parseCommandLine(argc, argv))
+        return EXIT_FAILURE;
+
+    ChildProcessType::shared().initialize(childMain.initializationParameters());
+    RunLoop::run();
+    childMain.platformFinalize();
+
+    return EXIT_SUCCESS;
+}
+
+} // namespace WebKit
+
+#endif // ChildProcessMain_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessEntryPointunixWebProcessMaincppfromrev169254trunkSourceWebKit2gtkMainGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/EntryPoint/unix/WebProcessMain.cpp (from rev 169254, trunk/Source/WebKit2/gtk/MainGtk.cpp) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/EntryPoint/unix/WebProcessMain.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/EntryPoint/unix/WebProcessMain.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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;WebProcessMainUnix.h&quot;
+
+using namespace WebKit;
+
+int main(int argc, char** argv)
+{
+    return WebProcessMainUnix(argc, argv);
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcesseflWebProcessMainEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -24,24 +24,16 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-#include &quot;WebProcessMainEfl.h&quot;
</del><ins>+#include &quot;WebProcessMainUnix.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;ProxyResolverSoup.h&quot;
-#include &quot;WKBase.h&quot;
-#include &quot;WebKit2Initialize.h&quot;
</del><ins>+#include &quot;ChildProcessMain.h&quot;
+#include &quot;WebProcess.h&quot;
</ins><span class="cx"> #include &lt;Ecore.h&gt;
</span><span class="cx"> #include &lt;Ecore_Evas.h&gt;
</span><span class="cx"> #include &lt;Edje.h&gt;
</span><span class="cx"> #include &lt;Efreet.h&gt;
</span><del>-#include &lt;WebCore/AuthenticationChallenge.h&gt;
-#include &lt;WebCore/NetworkingContext.h&gt;
</del><span class="cx"> #include &lt;WebCore/SoupNetworkSession.h&gt;
</span><del>-#include &lt;WebKit/WebProcess.h&gt;
</del><span class="cx"> #include &lt;libsoup/soup.h&gt;
</span><del>-#include &lt;runtime/JSCInlines.h&gt;
-#include &lt;unistd.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
-#include &lt;wtf/text/CString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #ifdef HAVE_ECORE_X
</span><span class="cx"> #include &lt;Ecore_X.h&gt;
</span><span class="lines">@@ -58,88 +50,82 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
-{
-    // WebProcess should be launched with an option.
-    if (argc != 2)
-        return 1;
</del><ins>+class WebProcessMain final: public ChildProcessMainBase {
+public:
+    bool platformInitialize() override
+    {
+        if (!eina_init())
+            return false;
</ins><span class="cx"> 
</span><del>-    if (!eina_init())
-        return 1;
</del><ins>+        if (!ecore_init()) {
+            // Could not init ecore.
+            eina_shutdown();
+            return false;
+        }
</ins><span class="cx"> 
</span><del>-    if (!ecore_init()) {
-        // Could not init ecore.
-        eina_shutdown();
-        return 1;
-    }
-
</del><span class="cx"> #ifdef HAVE_ECORE_X
</span><del>-    XSetExtensionErrorHandler(dummyExtensionErrorHandler);
</del><ins>+        XSetExtensionErrorHandler(dummyExtensionErrorHandler);
</ins><span class="cx"> 
</span><del>-    if (!ecore_x_init(0)) {
-        // Could not init ecore_x.
-        // PlatformScreenEfl and systemBeep() functions
-        // depend on ecore_x functionality.
-        ecore_shutdown();
-        eina_shutdown();
-        return 1;
-    }
</del><ins>+        if (!ecore_x_init(0)) {
+            // Could not init ecore_x.
+            // PlatformScreenEfl and systemBeep() functions
+            // depend on ecore_x functionality.
+            ecore_shutdown();
+            eina_shutdown();
+            return false;
+        }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (!ecore_evas_init()) {
</del><ins>+        if (!ecore_evas_init()) {
</ins><span class="cx"> #ifdef HAVE_ECORE_X
</span><del>-        ecore_x_shutdown();
</del><ins>+            ecore_x_shutdown();
</ins><span class="cx"> #endif
</span><del>-        ecore_shutdown();
-        eina_shutdown();
-        return 1;
-    }
</del><ins>+            ecore_shutdown();
+            eina_shutdown();
+            return false;
+        }
</ins><span class="cx"> 
</span><del>-    if (!edje_init()) {
-        ecore_evas_shutdown();
</del><ins>+        if (!edje_init()) {
+            ecore_evas_shutdown();
</ins><span class="cx"> #ifdef HAVE_ECORE_X
</span><del>-        ecore_x_shutdown();
</del><ins>+            ecore_x_shutdown();
</ins><span class="cx"> #endif
</span><del>-        ecore_shutdown();
-        eina_shutdown();
-        return 1;
-    }
</del><ins>+            ecore_shutdown();
+            eina_shutdown();
+            return false;
+        }
</ins><span class="cx"> 
</span><span class="cx"> #if !GLIB_CHECK_VERSION(2, 35, 0)
</span><del>-    g_type_init();
</del><ins>+        g_type_init();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if (!ecore_main_loop_glib_integrate())
-        return 1;
</del><ins>+        if (!ecore_main_loop_glib_integrate())
+            return false;
</ins><span class="cx"> 
</span><del>-    InitializeWebKit2();
-
-    SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
-
-    int socket = atoi(argv[1]);
-
-    ChildProcessInitializationParameters parameters;
-    parameters.connectionIdentifier = socket;
-
-    WebProcess::shared().initialize(parameters);
-
-    RunLoop::run();
-
-    if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
-        soup_cache_flush(soupCache);
-        soup_cache_dump(soupCache);
</del><ins>+        SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
+        return true;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    edje_shutdown();
-    ecore_evas_shutdown();
</del><ins>+    void platformFinalize() override
+    {
+        if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+            soup_cache_flush(soupCache);
+            soup_cache_dump(soupCache);
+        }
+
+        edje_shutdown();
+        ecore_evas_shutdown();
</ins><span class="cx"> #ifdef HAVE_ECORE_X
</span><del>-    ecore_x_shutdown();
</del><ins>+        ecore_x_shutdown();
</ins><span class="cx"> #endif
</span><del>-    ecore_shutdown();
-    eina_shutdown();
</del><ins>+        ecore_shutdown();
+        eina_shutdown();
+    }
+};
</ins><span class="cx"> 
</span><del>-    return 0;
-
</del><ins>+int WebProcessMainUnix(int argc, char** argv)
+{
+    return ChildProcessMain&lt;WebProcess, WebProcessMain&gt;(argc, argv);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesseflWebProcessMainEflh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,41 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Samsung Electronics. 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 WebProcessMainEfl_h
-#define WebProcessMainEfl_h
-
-#include &lt;WebKit/WKBase.h&gt;
-
-namespace WebKit {
-
-#ifdef __cplusplus
-extern &quot;C&quot; {
-WK_EXPORT int WebProcessMainEfl(int argc, char* argv[]);
-} // extern &quot;C&quot;
-#endif // __cplusplus
-
-} // namespace WebKit
-
-#endif // WebProcessMainEfl_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessgtkWebProcessMainGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -25,61 +25,52 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-#include &quot;WebProcessMainGtk.h&quot;
</del><ins>+#include &quot;WebProcessMainUnix.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;WKBase.h&quot;
-#include &quot;WebKit2Initialize.h&quot;
-#include &lt;WebCore/AuthenticationChallenge.h&gt;
-#include &lt;WebCore/NetworkingContext.h&gt;
</del><ins>+#include &quot;ChildProcessMain.h&quot;
+#include &quot;WebProcess.h&quot;
</ins><span class="cx"> #include &lt;WebCore/SoupNetworkSession.h&gt;
</span><del>-#include &lt;WebKit/WebProcess.h&gt;
</del><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><span class="cx"> #include &lt;libintl.h&gt;
</span><span class="cx"> #include &lt;libsoup/soup.h&gt;
</span><del>-#include &lt;unistd.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
-#include &lt;wtf/gobject/GRefPtr.h&gt;
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
-{
-    ASSERT(argc == 2);
-
</del><ins>+class WebProcessMain final: public ChildProcessMainBase {
+public:
+    bool platformInitialize() override
+    {
</ins><span class="cx"> #ifndef NDEBUG
</span><del>-    if (g_getenv(&quot;WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH&quot;))
-        sleep(30);
</del><ins>+        if (g_getenv(&quot;WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH&quot;))
+            sleep(30);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    gtk_init(&amp;argc, &amp;argv);
</del><ins>+        gtk_init(nullptr, nullptr);
</ins><span class="cx"> 
</span><del>-    bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
-    bind_textdomain_codeset(GETTEXT_PACKAGE, &quot;UTF-8&quot;);
</del><ins>+        bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+        bind_textdomain_codeset(GETTEXT_PACKAGE, &quot;UTF-8&quot;);
</ins><span class="cx"> 
</span><del>-    InitializeWebKit2();
</del><ins>+        // Despite using system CAs to validate certificates we're
+        // accepting invalid certificates by default. New API will be
+        // added later to let client accept/discard invalid certificates.
+        SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
+        return true;
+    }
</ins><span class="cx"> 
</span><del>-    int socket = atoi(argv[1]);
-
-    ChildProcessInitializationParameters parameters;
-    parameters.connectionIdentifier = socket;
-
-    WebProcess::shared().initialize(parameters);
-
-    // Despite using system CAs to validate certificates we're
-    // accepting invalid certificates by default. New API will be
-    // added later to let client accept/discard invalid certificates.
-    SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
-
-    RunLoop::run();
-
-    if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
-        soup_cache_flush(soupCache);
-        soup_cache_dump(soupCache);
</del><ins>+    void platformFinalize() override
+    {
+        if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
+            soup_cache_flush(soupCache);
+            soup_cache_dump(soupCache);
+        }
</ins><span class="cx">     }
</span><ins>+};
</ins><span class="cx"> 
</span><del>-    return 0;
</del><ins>+int WebProcessMainUnix(int argc, char** argv)
+{
+    return ChildProcessMain&lt;WebProcess, WebProcessMain&gt;(argc, argv);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessgtkWebProcessMainGtkh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.h        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,42 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Portions Copyright (c) 2010 Motorola Mobility, 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 WebProcessMainGtk_h
-#define WebProcessMainGtk_h
-
-#include &lt;WebKit/WKBase.h&gt;
-
-namespace WebKit {
-
-#ifdef __cplusplus
-extern &quot;C&quot; {
-WK_EXPORT int WebProcessMainGtk(int argc, char* argv[]);
-} // extern &quot;C&quot;
-#endif // __cplusplus
-
-} // namespace WebKit
-
-#endif // WebProcessMain_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessunixWebProcessMainUnixhfromrev169254trunkSourceWebKit2WebProcesseflWebProcessMainEflh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/unix/WebProcessMainUnix.h (from rev 169254, trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.h) (0 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/unix/WebProcessMainUnix.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/unix/WebProcessMainUnix.h        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 WebProcessMainUnix_h
+#define WebProcessMainUnix_h
+
+#include &lt;WebKit/WKBase.h&gt;
+
+namespace WebKit {
+
+extern &quot;C&quot; {
+WK_EXPORT int WebProcessMainUnix(int argc, char** argv);
+}
+
+} // namespace WebKit
+
+#endif // WebProcessMainUnix_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2eflMainEflcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/efl/MainEfl.cpp (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/efl/MainEfl.cpp        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/efl/MainEfl.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,31 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Samsung Electronics. 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;WebProcessMainEfl.h&quot;
-
-int main(int argc, char** argv)
-{
-    return WebKit::WebProcessMainEfl(argc, argv);
-}
</del></span></pre></div>
<a id="trunkSourceWebKit2gtkMainGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/gtk/MainGtk.cpp (169254 => 169255)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/gtk/MainGtk.cpp        2014-05-23 09:09:29 UTC (rev 169254)
+++ trunk/Source/WebKit2/gtk/MainGtk.cpp        2014-05-23 09:57:56 UTC (rev 169255)
</span><span class="lines">@@ -1,32 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Portions Copyright (c) 2010 Motorola Mobility, 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;WebProcessMainGtk.h&quot;
-
-int main(int argc, char** argv)
-{
-    return WebKit::WebProcessMainGtk(argc, argv);
-}
</del></span></pre>
</div>
</div>

</body>
</html>