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

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

<h3>Log Message</h3>
<pre>Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header
https://bugs.webkit.org/show_bug.cgi?id=137277

Reviewed by Alexey Proskuryakov.

Source/JavaScriptCore:

Use wtf/spi/darwin/XPCSPI.h instead of including the corresponding XPC headers/
forward declaring XPC functions.

* inspector/remote/RemoteInspector.mm:
* inspector/remote/RemoteInspectorXPCConnection.h:
* inspector/remote/RemoteInspectorXPCConnection.mm:

Source/WebKit2:

Use wtf/spi/darwin/XPCSPI.h instead of including the corresponding XPC headers/
forward declaring XPC functions.

* Platform/IPC/Connection.h:
* Platform/IPC/mac/ConnectionMac.mm:
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:

Source/WTF:

Towards centralizing the declarations of XPC functions used in JavaScriptCore
and WebKit2, add a header that wraps these function declarations called XPCSPI.h
and use it instead of including the corresponding XPC API/SPI headers/forward
declaring XPC functions. This will also aid in the effort to make WebKit2 build
for iOS with the public iOS SDK.

* WTF.xcodeproj/project.pbxproj:
* wtf/spi/darwin/XPCSPI.h: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectionh">trunk/Source/WebKit2/Platform/IPC/Connection.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCmacConnectionMacmm">trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainDevelopmentmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessLaunchermacProcessLauncherMacmm">trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WTF/wtf/spi/darwin/</li>
<li><a href="#trunkSourceWTFwtfspidarwinXPCSPIh">trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-10-01  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header
+        https://bugs.webkit.org/show_bug.cgi?id=137277
+
+        Reviewed by Alexey Proskuryakov.
+
+        Use wtf/spi/darwin/XPCSPI.h instead of including the corresponding XPC headers/
+        forward declaring XPC functions.
+
+        * inspector/remote/RemoteInspector.mm:
+        * inspector/remote/RemoteInspectorXPCConnection.h:
+        * inspector/remote/RemoteInspectorXPCConnection.mm:
+
</ins><span class="cx"> 2014-10-01  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Unreviewed build gardening.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -36,16 +36,9 @@
</span><span class="cx"> #import &lt;notify.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><ins>+#import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><del>-#if __has_include(&lt;xpc/xpc.h&gt;)
-#import &lt;xpc/xpc.h&gt;
-#endif
-extern &quot;C&quot; {
-    xpc_connection_t xpc_connection_create_mach_service(const char* name, dispatch_queue_t, uint64_t flags);
-    void xpc_release(xpc_object_t);
-}
-
</del><span class="cx"> #if __has_include(&lt;sandbox/private.h&gt;)
</span><span class="cx"> #import &lt;sandbox/private.h&gt;
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -31,14 +31,8 @@
</span><span class="cx"> #import &lt;dispatch/dispatch.h&gt;
</span><span class="cx"> #import &lt;mutex&gt;
</span><span class="cx"> #import &lt;wtf/ThreadSafeRefCounted.h&gt;
</span><ins>+#import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> 
</span><del>-#if __has_include(&lt;xpc/xpc.h&gt;)
-#import &lt;xpc/xpc.h&gt;
-#else
-typedef void* xpc_connection_t;
-typedef void* xpc_object_t;
-#endif
-
</del><span class="cx"> OBJC_CLASS NSDictionary;
</span><span class="cx"> OBJC_CLASS NSString;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -31,32 +31,8 @@
</span><span class="cx"> #import &lt;Foundation/Foundation.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #import &lt;wtf/Ref.h&gt;
</span><ins>+#import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> 
</span><del>-#if !__has_include(&lt;xpc/xpc.h&gt;)
-extern &quot;C&quot; {
-    typedef void (^xpc_handler_t)(xpc_object_t);
-    void xpc_connection_cancel(xpc_connection_t);
-    void xpc_connection_resume(xpc_connection_t);
-    void xpc_connection_send_message(xpc_connection_t, xpc_object_t message);
-    void xpc_connection_set_event_handler(xpc_connection_t, xpc_handler_t);
-    void xpc_connection_set_target_queue(xpc_connection_t, dispatch_queue_t);
-
-    xpc_object_t xpc_retain(xpc_object_t);
-    void xpc_release(xpc_object_t);
-
-    typedef void* xpc_type_t;
-    xpc_type_t xpc_get_type(xpc_object_t);
-
-    void* XPC_ERROR_CONNECTION_INVALID;
-    void* XPC_TYPE_DICTIONARY;
-    void* XPC_TYPE_ERROR;
-
-    xpc_object_t xpc_dictionary_create(const char* const* keys, const xpc_object_t* values, size_t count);
-    xpc_object_t xpc_dictionary_get_value(xpc_object_t, const char* key);
-    void xpc_dictionary_set_value(xpc_object_t, const char* key, xpc_object_t value);
-}
-#endif
-
</del><span class="cx"> #if __has_include(&lt;CoreFoundation/CFXPCBridge.h&gt;)
</span><span class="cx"> #import &lt;CoreFoundation/CFXPCBridge.h&gt;
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WTF/ChangeLog        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-10-01  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header
+        https://bugs.webkit.org/show_bug.cgi?id=137277
+
+        Reviewed by Alexey Proskuryakov.
+
+        Towards centralizing the declarations of XPC functions used in JavaScriptCore
+        and WebKit2, add a header that wraps these function declarations called XPCSPI.h
+        and use it instead of including the corresponding XPC API/SPI headers/forward
+        declaring XPC functions. This will also aid in the effort to make WebKit2 build
+        for iOS with the public iOS SDK.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/spi/darwin/XPCSPI.h: Added.
+
</ins><span class="cx"> 2014-10-01  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] 32-bit JavaScriptCore should limit itself to the C loop
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -275,6 +275,7 @@
</span><span class="cx">                 CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
</span><span class="cx">                 CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5497AB15857D0300B5BC30 /* MediaTime.h */; };
</span><span class="cx">                 CE46516E19DB1FB4003ECA05 /* NSMapTableSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */; };
</span><ins>+                CE73E02519DCB7AB00580D5C /* XPCSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE73E02419DCB7AB00580D5C /* XPCSPI.h */; };
</ins><span class="cx">                 E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */; };
</span><span class="cx">                 E15556F618A0CC18006F48FB /* CryptographicUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E15556F418A0CC18006F48FB /* CryptographicUtilities.h */; };
</span><span class="cx">                 EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB95E1EF161A72410089A2F5 /* ByteOrder.h */; };
</span><span class="lines">@@ -566,6 +567,7 @@
</span><span class="cx">                 CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMapTableSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CE73E02419DCB7AB00580D5C /* XPCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptographicUtilities.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E15556F418A0CC18006F48FB /* CryptographicUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptographicUtilities.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 EB95E1EF161A72410089A2F5 /* ByteOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteOrder.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1000,10 +1002,19 @@
</span><span class="cx">                         path = cocoa;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                CE73E02319DCB7AB00580D5C /* darwin */ = {
+                        isa = PBXGroup;
+                        children = (
+                                CE73E02419DCB7AB00580D5C /* XPCSPI.h */,
+                        );
+                        path = darwin;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 CEF4820C19DA347600CC04B8 /* spi */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 CE46516C19DB1FB4003ECA05 /* cocoa */,
</span><ins>+                                CE73E02319DCB7AB00580D5C /* darwin */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = spi;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1199,6 +1210,7 @@
</span><span class="cx">                                 1FA47C8B152502DA00568D1B /* WebCoreThread.h in Headers */,
</span><span class="cx">                                 A8A47446151A825B004123FF /* WTFString.h in Headers */,
</span><span class="cx">                                 A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
</span><ins>+                                CE73E02519DCB7AB00580D5C /* XPCSPI.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkSourceWTFwtfspidarwinXPCSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h (0 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h                                (rev 0)
+++ trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -0,0 +1,154 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. ``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
+ * 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 XPCSPI_h
+#define XPCSPI_h
+
+#include &lt;dispatch/dispatch.h&gt;
+#include &lt;os/object.h&gt;
+
+#if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK)
+#include &lt;xpc/xpc.h&gt;
+#else
+
+#if OS_OBJECT_USE_OBJC
+OS_OBJECT_DECL(xpc_object);
+typedef xpc_object_t xpc_connection_t;
+
+static ALWAYS_INLINE void _xpc_object_validate(xpc_object_t object)
+{
+    void *isa = *(void * volatile *)(OS_OBJECT_BRIDGE void *)object;
+    (void)isa;
+}
+
+#define XPC_GLOBAL_OBJECT(object) ((OS_OBJECT_BRIDGE xpc_object_t)&amp;(object))
+
+#else // OS_OBJECT_USE_OBJC
+
+typedef void* xpc_object_t;
+typedef void* xpc_connection_t;
+
+#define XPC_GLOBAL_OBJECT(object) (&amp;(object))
+
+#endif // OS_OBJECT_USE_OBJC
+
+typedef const struct _xpc_type_s* xpc_type_t;
+
+#if COMPILER_SUPPORTS(BLOCKS)
+typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t);
+typedef void (^xpc_handler_t)(xpc_object_t);
+#endif
+
+typedef void (*xpc_connection_handler_t)(xpc_connection_t connection);
+
+#define XPC_ARRAY_APPEND ((size_t)(-1))
+#define XPC_ERROR_CONNECTION_INVALID XPC_GLOBAL_OBJECT(_xpc_error_connection_invalid)
+#define XPC_ERROR_TERMINATION_IMMINENT XPC_GLOBAL_OBJECT(_xpc_error_termination_imminent)
+#define XPC_TYPE_ARRAY (&amp;_xpc_type_array)
+#define XPC_TYPE_BOOL (&amp;_xpc_type_bool)
+#define XPC_TYPE_DICTIONARY (&amp;_xpc_type_dictionary)
+#define XPC_TYPE_ERROR (&amp;_xpc_type_error)
+#define XPC_TYPE_STRING (&amp;_xpc_type_string)
+
+#endif // PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK)
+
+#if USE(APPLE_INTERNAL_SDK)
+#include &lt;xpc/private.h&gt;
+#endif
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
+#define CONST_ON_OR_AFTER_MAC_OS_X_VERSION_1090 const
+#else
+#define CONST_ON_OR_AFTER_MAC_OS_X_VERSION_1090
+#endif
+
+EXTERN_C CONST_ON_OR_AFTER_MAC_OS_X_VERSION_1090 struct _xpc_dictionary_s _xpc_error_connection_invalid;
+EXTERN_C CONST_ON_OR_AFTER_MAC_OS_X_VERSION_1090 struct _xpc_dictionary_s _xpc_error_termination_imminent;
+
+#undef CONST_ON_OR_AFTER_MAC_OS_X_VERSION_1090
+
+EXTERN_C const struct _xpc_type_s _xpc_type_array;
+EXTERN_C const struct _xpc_type_s _xpc_type_bool;
+EXTERN_C const struct _xpc_type_s _xpc_type_dictionary;
+EXTERN_C const struct _xpc_type_s _xpc_type_error;
+EXTERN_C const struct _xpc_type_s _xpc_type_string;
+
+EXTERN_C xpc_object_t xpc_array_create(const xpc_object_t*, size_t count);
+#if COMPILER_SUPPORTS(BLOCKS)
+EXTERN_C bool xpc_array_apply(xpc_object_t, xpc_array_applier_t);
+#endif
+EXTERN_C size_t xpc_array_get_count(xpc_object_t);
+EXTERN_C const char* xpc_array_get_string(xpc_object_t, size_t index);
+EXTERN_C void xpc_array_set_string(xpc_object_t, size_t index, const char* string);
+EXTERN_C bool xpc_bool_get_value(xpc_object_t);
+EXTERN_C void xpc_connection_cancel(xpc_connection_t);
+EXTERN_C xpc_connection_t xpc_connection_create(const char* name, dispatch_queue_t);
+EXTERN_C xpc_connection_t xpc_connection_create_mach_service(const char* name, dispatch_queue_t, uint64_t flags);
+EXTERN_C pid_t xpc_connection_get_pid(xpc_connection_t);
+EXTERN_C void xpc_connection_resume(xpc_connection_t);
+EXTERN_C void xpc_connection_send_message(xpc_connection_t, xpc_object_t);
+EXTERN_C void xpc_connection_send_message_with_reply(xpc_connection_t, xpc_object_t, dispatch_queue_t, xpc_handler_t);
+EXTERN_C void xpc_connection_set_event_handler(xpc_connection_t, xpc_handler_t);
+EXTERN_C void xpc_connection_set_target_queue(xpc_connection_t, dispatch_queue_t);
+EXTERN_C xpc_object_t xpc_dictionary_create(const char*  const* keys, const xpc_object_t*, size_t count);
+EXTERN_C xpc_object_t xpc_dictionary_create_reply(xpc_object_t);
+EXTERN_C int xpc_dictionary_dup_fd(xpc_object_t, const char* key);
+EXTERN_C xpc_connection_t xpc_dictionary_get_remote_connection(xpc_object_t);
+EXTERN_C bool xpc_dictionary_get_bool(xpc_object_t, const char* key);
+EXTERN_C const char* xpc_dictionary_get_string(xpc_object_t, const char* key);
+EXTERN_C uint64_t xpc_dictionary_get_uint64(xpc_object_t, const char* key);
+EXTERN_C xpc_object_t xpc_dictionary_get_value(xpc_object_t, const char* key);
+EXTERN_C void xpc_dictionary_set_bool(xpc_object_t, const char* key, bool value);
+EXTERN_C void xpc_dictionary_set_fd(xpc_object_t, const char* key, int fd);
+EXTERN_C void xpc_dictionary_set_string(xpc_object_t, const char* key, const char* string);
+EXTERN_C void xpc_dictionary_set_uint64(xpc_object_t, const char* key, uint64_t value);
+EXTERN_C void xpc_dictionary_set_value(xpc_object_t, const char*key, xpc_object_t value);
+EXTERN_C xpc_type_t xpc_get_type(xpc_object_t);
+EXTERN_C void xpc_main(xpc_connection_handler_t);
+EXTERN_C xpc_object_t xpc_retain(xpc_object_t);
+EXTERN_C void xpc_release(xpc_object_t);
+EXTERN_C const char* xpc_string_get_string_ptr(xpc_object_t);
+EXTERN_C void xpc_transaction_begin(void);
+
+EXTERN_C xpc_object_t xpc_connection_copy_entitlement_value(xpc_connection_t, const char* entitlement);
+EXTERN_C void xpc_connection_get_audit_token(xpc_connection_t, audit_token_t*);
+EXTERN_C void xpc_connection_kill(xpc_connection_t, int);
+EXTERN_C void xpc_connection_set_instance(xpc_connection_t, uuid_t);
+EXTERN_C mach_port_t xpc_dictionary_copy_mach_send(xpc_object_t, const char*);
+EXTERN_C void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_t);
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+EXTERN_C void xpc_connection_set_bootstrap(xpc_connection_t, xpc_object_t bootstrap);
+#endif
+
+#if !defined(xpc_retain) &amp;&amp; OS_OBJECT_USE_OBJC_RETAIN_RELEASE
+#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
+#endif
+
+#if !defined(xpc_release) &amp;&amp; OS_OBJECT_USE_OBJC_RETAIN_RELEASE
+#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
+#endif
+
+#endif // XPCSPI_h
</ins><span class="cx">Property changes on: trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WebKit2/ChangeLog        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-10-01  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Clean up: Move XPC forward declarations in JavaScriptCore to WTF SPI wrapper header
+        https://bugs.webkit.org/show_bug.cgi?id=137277
+
+        Reviewed by Alexey Proskuryakov.
+
+        Use wtf/spi/darwin/XPCSPI.h instead of including the corresponding XPC headers/
+        forward declaring XPC functions.
+
+        * Platform/IPC/Connection.h:
+        * Platform/IPC/mac/ConnectionMac.mm:
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+
</ins><span class="cx"> 2014-10-01  Christophe Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use is&lt;&gt;() / downcast&lt;&gt;() for Event classes
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.h        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -42,8 +42,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if OS(DARWIN)
</span><span class="cx"> #include &lt;mach/mach_port.h&gt;
</span><del>-#include &lt;xpc/xpc.h&gt;
</del><span class="cx"> #include &lt;wtf/OSObjectPtr.h&gt;
</span><ins>+#include &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK) || PLATFORM(EFL)
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCmacConnectionMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -34,19 +34,12 @@
</span><span class="cx"> #include &lt;mach/mach_error.h&gt;
</span><span class="cx"> #include &lt;mach/vm_map.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><del>-#include &lt;xpc/xpc.h&gt;
</del><ins>+#include &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include &quot;ProcessAssertion.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if __has_include(&lt;xpc/private.h&gt;)
-#include &lt;xpc/private.h&gt;
-#else
-extern &quot;C&quot; void xpc_connection_get_audit_token(xpc_connection_t, audit_token_t*);
-extern &quot;C&quot; void xpc_connection_kill(xpc_connection_t, int);
-#endif
-
</del><span class="cx"> #if __has_include(&lt;HIServices/AccessibilityPriv.h&gt;)
</span><span class="cx"> #include &lt;HIServices/AccessibilityPriv.h&gt;
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainDevelopmentmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> #import &lt;stdio.h&gt;
</span><span class="cx"> #import &lt;stdlib.h&gt;
</span><span class="cx"> #import &lt;wtf/OSObjectPtr.h&gt;
</span><del>-#import &lt;xpc/xpc.h&gt;
</del><ins>+#import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &lt;CoreFoundation/CoreFoundation.h&gt;
</span><span class="cx"> #import &lt;wtf/OSObjectPtr.h&gt;
</span><del>-#import &lt;xpc/xpc.h&gt;
</del><ins>+#import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessLaunchermacProcessLauncherMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (174179 => 174180)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm        2014-10-01 22:35:25 UTC (rev 174179)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm        2014-10-01 22:38:18 UTC (rev 174180)
</span><span class="lines">@@ -41,27 +41,17 @@
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #import &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> #import &lt;wtf/Threading.h&gt;
</span><ins>+#import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</ins><span class="cx"> #import &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><del>-#import &lt;xpc/xpc.h&gt;
</del><span class="cx"> 
</span><del>-#if __has_include(&lt;xpc/private.h&gt;)
-#import &lt;xpc/private.h&gt;
-#endif
-
</del><span class="cx"> // FIXME: We should be doing this another way.
</span><span class="cx"> extern &quot;C&quot; kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, uint64_t);
</span><span class="cx"> 
</span><del>-extern &quot;C&quot; void xpc_connection_set_instance(xpc_connection_t, uuid_t);
-extern &quot;C&quot; void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_t);
-
</del><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><del>-extern &quot;C&quot; void xpc_connection_set_bootstrap(xpc_connection_t connection, xpc_object_t bootstrap);
-
</del><span class="cx"> // FIXME: Soft linking is temporary, make this into a regular function call once this function is available everywhere we need.
</span><span class="cx"> SOFT_LINK_FRAMEWORK(CoreFoundation)
</span><span class="cx"> SOFT_LINK_OPTIONAL(CoreFoundation, _CFBundleSetupXPCBootstrap, void, unused, (xpc_object_t))
</span><del>-
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span></span></pre>
</div>
</div>

</body>
</html>