<!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>[212394] trunk</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/212394">212394</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2017-02-15 14:31:07 -0800 (Wed, 15 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/212169">r212169</a>.
Broke iOS WebInspector
Reverted changeset:
"WebInspector: refactor RemoteInspector to move cocoa specific
code to their own files"
https://bugs.webkit.org/show_bug.cgi?id=166681
http://trac.webkit.org/changeset/212169</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSRemoteInspectorcpp">trunk/Source/JavaScriptCore/API/JSRemoteInspector.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorePlatformMaccmake">trunk/Source/JavaScriptCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteControllableTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectionTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargetmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm</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>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorcpp">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp</a></li>
<li>trunk/Source/JavaScriptCore/inspector/remote/cocoa/</li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#trunkToolsScriptswebkitpybenchmark_runnerdatapatchesAnimometerpatch">trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSRemoteInspectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSRemoteInspector.cpp (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSRemoteInspector.cpp        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/API/JSRemoteInspector.cpp        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void JSRemoteInspectorSetParentProcessInformation(pid_t pid, const uint8_t* auditData, size_t auditLength)
</del><ins>+void JSRemoteInspectorSetParentProcessInformation(pid_t pid, const UInt8* auditData, size_t auditLength)
</ins><span class="cx"> {
</span><del>-#if ENABLE(REMOTE_INSPECTOR) && PLATFORM(COCOA)
</del><ins>+#if ENABLE(REMOTE_INSPECTOR)
</ins><span class="cx"> RetainPtr<CFDataRef> auditDataRef = adoptCF(CFDataCreate(kCFAllocatorDefault, auditData, auditLength));
</span><span class="cx"> RemoteInspector::singleton().setParentProcessInformation(pid, auditDataRef);
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-02-15 Alex Christensen <achristensen@webkit.org>
+
+ Unreviewed, rolling out r212169.
+
+ Broke iOS WebInspector
+
+ Reverted changeset:
+
+ "WebInspector: refactor RemoteInspector to move cocoa specific
+ code to their own files"
+ https://bugs.webkit.org/show_bug.cgi?id=166681
+ http://trac.webkit.org/changeset/212169
+
</ins><span class="cx"> 2017-02-15 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Expose Symbol.toPrimitive / valueOf on Location instances
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -1603,11 +1603,6 @@
</span><span class="cx">                 9928FF3B18AC4AEC00B8CF12 /* JSReplayInputs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9928FF3918AC4AEC00B8CF12 /* JSReplayInputs.cpp */; };
</span><span class="cx">                 9928FF3C18AC4AEC00B8CF12 /* JSReplayInputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 9928FF3A18AC4AEC00B8CF12 /* JSReplayInputs.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 992ABCF91BEA9BD2006403A0 /* RemoteAutomationTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 992ABCF51BEA94CA006403A0 /* RemoteAutomationTarget.cpp */; };
</span><del>-                992F56B41E4E84A40035953B /* RemoteConnectionToTargetCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 992F56B31E4E847D0035953B /* RemoteConnectionToTargetCocoa.mm */; };
-                992F56B51E4E84A80035953B /* RemoteInspectorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 992F56B01E4E84790035953B /* RemoteInspectorCocoa.mm */; };
-                992F56B61E4E84AB0035953B /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 992F56B21E4E84790035953B /* RemoteInspectorXPCConnection.mm */; };
-                992F56B71E4E84B20035953B /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 992F56B11E4E84790035953B /* RemoteInspectorXPCConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                995566861E4E8B0F00AAE13C /* RemoteInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 995566851E4E8B0700AAE13C /* RemoteInspector.cpp */; };
</del><span class="cx">                 9959E92B1BD17FA4001AA413 /* cssmin.py in Headers */ = {isa = PBXBuildFile; fileRef = 9959E9271BD17FA0001AA413 /* cssmin.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9959E92D1BD17FA4001AA413 /* jsmin.py in Headers */ = {isa = PBXBuildFile; fileRef = 9959E9291BD17FA0001AA413 /* jsmin.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9959E92E1BD17FA4001AA413 /* xxd.pl in Headers */ = {isa = PBXBuildFile; fileRef = 9959E92A1BD17FA0001AA413 /* xxd.pl */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -1784,8 +1779,12 @@
</span><span class="cx">                 A5AB49DD1BEC8086007020FB /* PerGlobalObjectWrapperWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AB49DB1BEC8079007020FB /* PerGlobalObjectWrapperWorld.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A5B6A74D18C6DBA600F11E91 /* ConsoleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5B6A74C18C6DBA600F11E91 /* ConsoleClient.cpp */; };
</span><span class="cx">                 A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E1182340B300A82E69 /* RemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E2182340B300A82E69 /* RemoteInspector.mm */; };
</ins><span class="cx">                 A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A5BA15EB182340B400A82E69 /* RemoteConnectionToTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E4182340B300A82E69 /* RemoteConnectionToTarget.h */; };
</span><ins>+                A5BA15EC182340B400A82E69 /* RemoteConnectionToTarget.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E5182340B300A82E69 /* RemoteConnectionToTarget.mm */; };
+                A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */; };
</ins><span class="cx">                 A5BA15F0182345AF00A82E69 /* RemoteInspectionTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectionTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A5C3A1A518C0490200C9593A /* JSGlobalObjectConsoleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5C3A1A318C0490200C9593A /* JSGlobalObjectConsoleClient.cpp */; };
</span><span class="cx">                 A5C3A1A618C0490200C9593A /* JSGlobalObjectConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C3A1A418C0490200C9593A /* JSGlobalObjectConsoleClient.h */; };
</span><span class="lines">@@ -4121,11 +4120,6 @@
</span><span class="cx">                 9928FF3D18AC4B1C00B8CF12 /* JSInputs.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = JSInputs.json; sourceTree = "<group>"; };
</span><span class="cx">                 992ABCF51BEA94CA006403A0 /* RemoteAutomationTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteAutomationTarget.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 992ABCF61BEA94CA006403A0 /* RemoteAutomationTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteAutomationTarget.h; sourceTree = "<group>"; };
</span><del>-                992F56B01E4E84790035953B /* RemoteInspectorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspectorCocoa.mm; sourceTree = "<group>"; };
-                992F56B11E4E84790035953B /* RemoteInspectorXPCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorXPCConnection.h; sourceTree = "<group>"; };
-                992F56B21E4E84790035953B /* RemoteInspectorXPCConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspectorXPCConnection.mm; sourceTree = "<group>"; };
-                992F56B31E4E847D0035953B /* RemoteConnectionToTargetCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteConnectionToTargetCocoa.mm; sourceTree = "<group>"; };
-                995566851E4E8B0700AAE13C /* RemoteInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteInspector.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 9959E9271BD17FA0001AA413 /* cssmin.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = cssmin.py; sourceTree = "<group>"; };
</span><span class="cx">                 9959E9291BD17FA0001AA413 /* jsmin.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = jsmin.py; sourceTree = "<group>"; };
</span><span class="cx">                 9959E92A1BD17FA0001AA413 /* xxd.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = xxd.pl; sourceTree = "<group>"; };
</span><span class="lines">@@ -4303,8 +4297,12 @@
</span><span class="cx">                 A5AB49DB1BEC8079007020FB /* PerGlobalObjectWrapperWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerGlobalObjectWrapperWorld.h; sourceTree = "<group>"; };
</span><span class="cx">                 A5B6A74C18C6DBA600F11E91 /* ConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleClient.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 A5BA15E1182340B300A82E69 /* RemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspector.h; sourceTree = "<group>"; };
</span><ins>+                A5BA15E2182340B300A82E69 /* RemoteInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspector.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorConstants.h; sourceTree = "<group>"; };
</span><span class="cx">                 A5BA15E4182340B300A82E69 /* RemoteConnectionToTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteConnectionToTarget.h; sourceTree = "<group>"; };
</span><ins>+                A5BA15E5182340B300A82E69 /* RemoteConnectionToTarget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteConnectionToTarget.mm; sourceTree = "<group>"; };
+                A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorXPCConnection.h; sourceTree = "<group>"; };
+                A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspectorXPCConnection.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 A5BA15EF182345AF00A82E69 /* RemoteInspectionTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectionTarget.h; sourceTree = "<group>"; };
</span><span class="cx">                 A5C3A1A318C0490200C9593A /* JSGlobalObjectConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectConsoleClient.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 A5C3A1A418C0490200C9593A /* JSGlobalObjectConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectConsoleClient.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -5044,7 +5042,6 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 0F9327591C20BCBA00CF6564 /* dynbench */,
</span><del>-                                932F5BE10822A1C700736975 /* jsc */,
</del><span class="cx">                                 0FF922CF14F46B130041A24E /* JSCLLIntOffsetsExtractor */,
</span><span class="cx">                                 141211200A48793C00480255 /* minidom */,
</span><span class="cx">                                 0F6183431C45F62A0072450B /* testair */,
</span><span class="lines">@@ -5052,6 +5049,7 @@
</span><span class="cx">                                 0FEC85AD1BDB5CF10080FF74 /* testb3 */,
</span><span class="cx">                                 6511230514046A4C002B101D /* testRegExp */,
</span><span class="cx">                                 932F5BD90822A1C700736975 /* JavaScriptCore.framework */,
</span><ins>+                                932F5BE10822A1C700736975 /* jsc */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = Products;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -6110,17 +6108,6 @@
</span><span class="cx">                         path = disassembler/ARMv7;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><del>-                7ACDDECF1E252ACA0097AFEB /* cocoa */ = {
-                        isa = PBXGroup;
-                        children = (
-                                992F56B31E4E847D0035953B /* RemoteConnectionToTargetCocoa.mm */,
-                                992F56B01E4E84790035953B /* RemoteInspectorCocoa.mm */,
-                                992F56B11E4E84790035953B /* RemoteInspectorXPCConnection.h */,
-                                992F56B21E4E84790035953B /* RemoteInspectorXPCConnection.mm */,
-                        );
-                        path = cocoa;
-                        sourceTree = "<group>";
-                };
</del><span class="cx">                 7B98D1331B60CD1E0023B1A4 /* wasm */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -6837,9 +6824,9 @@
</span><span class="cx">                                 FE384EE21ADDB7AD0055DE2C /* JSDollarVM.h */,
</span><span class="cx">                                 FE384EE31ADDB7AD0055DE2C /* JSDollarVMPrototype.cpp */,
</span><span class="cx">                                 FE384EE41ADDB7AD0055DE2C /* JSDollarVMPrototype.h */,
</span><del>-                                86B5822C14D22F5F00A9C306 /* ProfileTreeNode.h */,
</del><span class="cx">                                 FE3022D01E3D739600BAC493 /* SigillCrashAnalyzer.cpp */,
</span><span class="cx">                                 FE3022D11E3D739600BAC493 /* SigillCrashAnalyzer.h */,
</span><ins>+                                86B5822C14D22F5F00A9C306 /* ProfileTreeNode.h */,
</ins><span class="cx">                                 86B5826A14D35D5100A9C306 /* TieredMMapArray.h */,
</span><span class="cx">                                 FE3022D41E42856700BAC493 /* VMInspector.cpp */,
</span><span class="cx">                                 FE3022D51E42856700BAC493 /* VMInspector.h */,
</span><span class="lines">@@ -7123,10 +7110,10 @@
</span><span class="cx">                                 0FB1765F196B8F9E0091052A /* DFGPureValue.h */,
</span><span class="cx">                                 0F3A1BF71A9ECB7D000DE01A /* DFGPutStackSinkingPhase.cpp */,
</span><span class="cx">                                 0F3A1BF81A9ECB7D000DE01A /* DFGPutStackSinkingPhase.h */,
</span><del>-                                86EC9DC11328DF82002B2AD7 /* DFGRegisterBank.h */,
</del><span class="cx">                                 79FC8A071E32E9F000D88F0E /* DFGRegisteredStructure.h */,
</span><span class="cx">                                 7980C16A1E3A940E00B71615 /* DFGRegisteredStructureSet.cpp */,
</span><span class="cx">                                 7980C16B1E3A940E00B71615 /* DFGRegisteredStructureSet.h */,
</span><ins>+                                86EC9DC11328DF82002B2AD7 /* DFGRegisterBank.h */,
</ins><span class="cx">                                 0F2FCCF418A60070001A27F8 /* DFGSafepoint.cpp */,
</span><span class="cx">                                 0F2FCCF518A60070001A27F8 /* DFGSafepoint.h */,
</span><span class="cx">                                 A77A423C17A0BBFD00A8DB81 /* DFGSafeToExecute.h */,
</span><span class="lines">@@ -7655,17 +7642,19 @@
</span><span class="cx">                 A5BA15E01823409D00A82E69 /* remote */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                7ACDDECF1E252ACA0097AFEB /* cocoa */,
</del><span class="cx">                                 992ABCF51BEA94CA006403A0 /* RemoteAutomationTarget.cpp */,
</span><span class="cx">                                 992ABCF61BEA94CA006403A0 /* RemoteAutomationTarget.h */,
</span><span class="cx">                                 A5BA15E4182340B300A82E69 /* RemoteConnectionToTarget.h */,
</span><ins>+                                A5BA15E5182340B300A82E69 /* RemoteConnectionToTarget.mm */,
</ins><span class="cx">                                 998ED6721BED659A00DD8017 /* RemoteControllableTarget.cpp */,
</span><span class="cx">                                 998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */,
</span><span class="cx">                                 A594558E18245EDE00CC3843 /* RemoteInspectionTarget.cpp */,
</span><span class="cx">                                 A5BA15EF182345AF00A82E69 /* RemoteInspectionTarget.h */,
</span><del>-                                995566851E4E8B0700AAE13C /* RemoteInspector.cpp */,
</del><span class="cx">                                 A5BA15E1182340B300A82E69 /* RemoteInspector.h */,
</span><ins>+                                A5BA15E2182340B300A82E69 /* RemoteInspector.mm */,
</ins><span class="cx">                                 A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */,
</span><ins>+                                A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */,
+                                A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = remote;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -8108,6 +8097,7 @@
</span><span class="cx">                                 0F21C27D14BE727A00ADC64B /* CodeSpecializationKind.h in Headers */,
</span><span class="cx">                                 0F0B83A714BCF50700885B4F /* CodeType.h in Headers */,
</span><span class="cx">                                 0FA762051DB9242900B7A2FD /* CollectionScope.h in Headers */,
</span><ins>+                                79FC8A081E32E9F000D88F0E /* DFGRegisteredStructure.h in Headers */,
</ins><span class="cx">                                 A53243981856A489002ED692 /* CombinedDomains.json in Headers */,
</span><span class="cx">                                 BC18C3F30E16F5CD00B34460 /* CommonIdentifiers.h in Headers */,
</span><span class="cx">                                 0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */,
</span><span class="lines">@@ -8302,8 +8292,6 @@
</span><span class="cx">                                 0FB17663196B8F9E0091052A /* DFGPureValue.h in Headers */,
</span><span class="cx">                                 0F3A1BFA1A9ECB7D000DE01A /* DFGPutStackSinkingPhase.h in Headers */,
</span><span class="cx">                                 86EC9DD11328DF82002B2AD7 /* DFGRegisterBank.h in Headers */,
</span><del>-                                79FC8A081E32E9F000D88F0E /* DFGRegisteredStructure.h in Headers */,
-                                7980C16D1E3A940E00B71615 /* DFGRegisteredStructureSet.h in Headers */,
</del><span class="cx">                                 0F2FCCFC18A60070001A27F8 /* DFGSafepoint.h in Headers */,
</span><span class="cx">                                 A77A424317A0BBFD00A8DB81 /* DFGSafeToExecute.h in Headers */,
</span><span class="cx">                                 A741017F179DAF80002EB8BA /* DFGSaneStringGetByValSlowPathGenerator.h in Headers */,
</span><span class="lines">@@ -8466,6 +8454,7 @@
</span><span class="cx">                                 0F86A26F1D6F7B3300CB0C92 /* GCTypeMap.h in Headers */,
</span><span class="cx">                                 9959E9311BD18272001AA413 /* generate-combined-inspector-json.py in Headers */,
</span><span class="cx">                                 C4703CC0192844960013FBEA /* generate-inspector-protocol-bindings.py in Headers */,
</span><ins>+                                FE3022D91E43C93400BAC493 /* JSVirtualMachinePrivate.h in Headers */,
</ins><span class="cx">                                 99DA00AF1BD5994E00F4575C /* generate-js-builtins.py in Headers */,
</span><span class="cx">                                 A5EA70EC19F5B3EA0098F5EC /* generate_cpp_alternate_backend_dispatcher_header.py in Headers */,
</span><span class="cx">                                 A5EF9B141A1D43F600702E90 /* generate_cpp_backend_dispatcher_header.py in Headers */,
</span><span class="lines">@@ -8702,6 +8691,7 @@
</span><span class="cx">                                 A50E4B6418809DD50068A46D /* JSGlobalObjectRuntimeAgent.h in Headers */,
</span><span class="cx">                                 A503FA2A188F105900110F14 /* JSGlobalObjectScriptDebugServer.h in Headers */,
</span><span class="cx">                                 A513E5C0185BFACC007E95AD /* JSInjectedScriptHost.h in Headers */,
</span><ins>+                                7980C16D1E3A940E00B71615 /* DFGRegisteredStructureSet.h in Headers */,
</ins><span class="cx">                                 A513E5C2185BFACC007E95AD /* JSInjectedScriptHostPrototype.h in Headers */,
</span><span class="cx">                                 C442CB251A6CDB8C005D3D7C /* JSInputs.json in Headers */,
</span><span class="cx">                                 0F2B66F817B6B5AB00A7AE3F /* JSInt16Array.h in Headers */,
</span><span class="lines">@@ -8781,7 +8771,6 @@
</span><span class="cx">                                 BC18C42C0E16F5CD00B34460 /* JSValueRef.h in Headers */,
</span><span class="cx">                                 86E3C615167BABD7006D760A /* JSVirtualMachine.h in Headers */,
</span><span class="cx">                                 86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */,
</span><del>-                                FE3022D91E43C93400BAC493 /* JSVirtualMachinePrivate.h in Headers */,
</del><span class="cx">                                 A7CA3AE817DA41AE006538AF /* JSWeakMap.h in Headers */,
</span><span class="cx">                                 A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
</span><span class="cx">                                 A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
</span><span class="lines">@@ -8819,6 +8808,7 @@
</span><span class="cx">                                 FE3913561B794F8F00EDAF71 /* LiveObjectList.h in Headers */,
</span><span class="cx">                                 70DE9A091BE7D69E005D89D9 /* LLIntAssembly.h in Headers */,
</span><span class="cx">                                 0F0FC45A14BD15F500B81154 /* LLIntCallLinkInfo.h in Headers */,
</span><ins>+                                FE3022D31E3D73A500BAC493 /* SigillCrashAnalyzer.h in Headers */,
</ins><span class="cx">                                 FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */,
</span><span class="cx">                                 0F4680CA14BBB16C00BFE272 /* LLIntCommon.h in Headers */,
</span><span class="cx">                                 0F4680D314BBD16700BFE272 /* LLIntData.h in Headers */,
</span><span class="lines">@@ -8878,6 +8868,7 @@
</span><span class="cx">                                 A79D3ED9C5064DD0A8466A3A /* ModuleScopeData.h in Headers */,
</span><span class="cx">                                 0F1FB3991E1F65FB00A9BE50 /* MutatorScheduler.h in Headers */,
</span><span class="cx">                                 0FA762071DB9243300B7A2FD /* MutatorState.h in Headers */,
</span><ins>+                                FE3022D71E42857300BAC493 /* VMInspector.h in Headers */,
</ins><span class="cx">                                 BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */,
</span><span class="cx">                                 BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */,
</span><span class="cx">                                 147341D01DC02DB400AA29BA /* NativeExecutable.h in Headers */,
</span><span class="lines">@@ -8987,7 +8978,7 @@
</span><span class="cx">                                 A5BA15F0182345AF00A82E69 /* RemoteInspectionTarget.h in Headers */,
</span><span class="cx">                                 A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */,
</span><span class="cx">                                 A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
</span><del>-                                992F56B71E4E84B20035953B /* RemoteInspectorXPCConnection.h in Headers */,
</del><ins>+                                A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
</ins><span class="cx">                                 0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
</span><span class="cx">                                 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
</span><span class="cx">                                 70B0A9D11A9B66460001306A /* RuntimeFlags.h in Headers */,
</span><span class="lines">@@ -9017,7 +9008,6 @@
</span><span class="cx">                                 0FEE98411A8865B700754E93 /* SetupVarargsFrame.h in Headers */,
</span><span class="cx">                                 DC17E8181C9C91D9008A6AB3 /* ShadowChicken.h in Headers */,
</span><span class="cx">                                 DC17E8191C9C91DB008A6AB3 /* ShadowChickenInlines.h in Headers */,
</span><del>-                                FE3022D31E3D73A500BAC493 /* SigillCrashAnalyzer.h in Headers */,
</del><span class="cx">                                 0F2B670517B6B5AB00A7AE3F /* SimpleTypedArrayController.h in Headers */,
</span><span class="cx">                                 14BA78F113AAB88F005B7C2C /* SlotVisitor.h in Headers */,
</span><span class="cx">                                 C2160FE715F7E95E00942DFC /* SlotVisitorInlines.h in Headers */,
</span><span class="lines">@@ -9136,7 +9126,6 @@
</span><span class="cx">                                 658D3A5619638268003C45D6 /* VMEntryRecord.h in Headers */,
</span><span class="cx">                                 FE5932A8183C5A2600A1ECCC /* VMEntryScope.h in Headers */,
</span><span class="cx">                                 0F5AE2C41DF4F2800066EFE1 /* VMInlines.h in Headers */,
</span><del>-                                FE3022D71E42857300BAC493 /* VMInspector.h in Headers */,
</del><span class="cx">                                 53F40E931D5A4AB30099A1B6 /* WasmB3IRGenerator.h in Headers */,
</span><span class="cx">                                 AD4B1DFA1DF244E20071AE32 /* WasmBinding.h in Headers */,
</span><span class="cx">                                 53FD04D41D7AB291003287D3 /* WasmCallingConvention.h in Headers */,
</span><span class="lines">@@ -9746,6 +9735,7 @@
</span><span class="cx">                                 0F9630391D4192C6005609D9 /* AllocatorAttributes.cpp in Sources */,
</span><span class="cx">                                 147F39BD107EC37600427A48 /* ArgList.cpp in Sources */,
</span><span class="cx">                                 79A228351D35D71E00D8E067 /* ArithProfile.cpp in Sources */,
</span><ins>+                                FE3022D61E42857300BAC493 /* VMInspector.cpp in Sources */,
</ins><span class="cx">                                 0F743BAA16B88249009F9277 /* ARM64Disassembler.cpp in Sources */,
</span><span class="cx">                                 86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */,
</span><span class="cx">                                 65C02850171795E200351E35 /* ARMv7Disassembler.cpp in Sources */,
</span><span class="lines">@@ -10015,7 +10005,6 @@
</span><span class="cx">                                 0F2B9CEC19D0BA7D00B1D1B5 /* DFGPromotedHeapLocation.cpp in Sources */,
</span><span class="cx">                                 0FB17662196B8F9E0091052A /* DFGPureValue.cpp in Sources */,
</span><span class="cx">                                 0F3A1BF91A9ECB7D000DE01A /* DFGPutStackSinkingPhase.cpp in Sources */,
</span><del>-                                7980C16C1E3A940E00B71615 /* DFGRegisteredStructureSet.cpp in Sources */,
</del><span class="cx">                                 0F2FCCFB18A60070001A27F8 /* DFGSafepoint.cpp in Sources */,
</span><span class="cx">                                 86EC9DD21328DF82002B2AD7 /* DFGSpeculativeJIT.cpp in Sources */,
</span><span class="cx">                                 86880F1F14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp in Sources */,
</span><span class="lines">@@ -10069,6 +10058,7 @@
</span><span class="cx">                                 14AD91171DCA97FD0014F9FE /* EvalCodeBlock.cpp in Sources */,
</span><span class="cx">                                 147341E21DC2CE9600AA29BA /* EvalExecutable.cpp in Sources */,
</span><span class="cx">                                 A54982031891D0B00081E5B8 /* EventLoop.cpp in Sources */,
</span><ins>+                                7980C16C1E3A940E00B71615 /* DFGRegisteredStructureSet.cpp in Sources */,
</ins><span class="cx">                                 FE1C0FFF1B194FD100B53FCA /* Exception.cpp in Sources */,
</span><span class="cx">                                 FE80C19B1D776A98008510C0 /* ExceptionEventLocation.cpp in Sources */,
</span><span class="cx">                                 0F12DE0F1979D5FD0006FF4E /* ExceptionFuzz.cpp in Sources */,
</span><span class="lines">@@ -10441,6 +10431,7 @@
</span><span class="cx">                                 79B00CBE1C6AB07E0088C65D /* ProxyObject.cpp in Sources */,
</span><span class="cx">                                 79160DBD1C8E3EC8008C085A /* ProxyRevoke.cpp in Sources */,
</span><span class="cx">                                 0F15CD221BA5F9860031FFD3 /* PutByIdFlags.cpp in Sources */,
</span><ins>+                                FE3022D21E3D73A500BAC493 /* SigillCrashAnalyzer.cpp in Sources */,
</ins><span class="cx">                                 0F9332A314CA7DD70085F3C6 /* PutByIdStatus.cpp in Sources */,
</span><span class="cx">                                 0F93B4A918B92C4D00178A3F /* PutByIdVariant.cpp in Sources */,
</span><span class="cx">                                 0FF60AC316740F8800029779 /* ReduceWhitespace.cpp in Sources */,
</span><span class="lines">@@ -10458,12 +10449,11 @@
</span><span class="cx">                                 0FC3141518146D7000033232 /* RegisterSet.cpp in Sources */,
</span><span class="cx">                                 A57D23ED1891B5540031C7FA /* RegularExpression.cpp in Sources */,
</span><span class="cx">                                 992ABCF91BEA9BD2006403A0 /* RemoteAutomationTarget.cpp in Sources */,
</span><del>-                                992F56B41E4E84A40035953B /* RemoteConnectionToTargetCocoa.mm in Sources */,
</del><ins>+                                A5BA15EC182340B400A82E69 /* RemoteConnectionToTarget.mm in Sources */,
</ins><span class="cx">                                 998ED6741BED70AC00DD8017 /* RemoteControllableTarget.cpp in Sources */,
</span><span class="cx">                                 A594558F18245EFD00CC3843 /* RemoteInspectionTarget.cpp in Sources */,
</span><del>-                                995566861E4E8B0F00AAE13C /* RemoteInspector.cpp in Sources */,
-                                992F56B51E4E84A80035953B /* RemoteInspectorCocoa.mm in Sources */,
-                                992F56B61E4E84AB0035953B /* RemoteInspectorXPCConnection.mm in Sources */,
</del><ins>+                                A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */,
+                                A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */,
</ins><span class="cx">                                 0F24E55017EE274900ABB217 /* Repatch.cpp in Sources */,
</span><span class="cx">                                 527773DE1AAF83AC00BDE7E8 /* RuntimeType.cpp in Sources */,
</span><span class="cx">                                 0F7700921402FF3C0078EB39 /* SamplingCounter.cpp in Sources */,
</span><span class="lines">@@ -10486,7 +10476,6 @@
</span><span class="cx">                                 A7299DA117D12848005F5FF9 /* SetPrototype.cpp in Sources */,
</span><span class="cx">                                 0FEE98431A89227500754E93 /* SetupVarargsFrame.cpp in Sources */,
</span><span class="cx">                                 DC17E8171C9C91D6008A6AB3 /* ShadowChicken.cpp in Sources */,
</span><del>-                                FE3022D21E3D73A500BAC493 /* SigillCrashAnalyzer.cpp in Sources */,
</del><span class="cx">                                 0F2B670417B6B5AB00A7AE3F /* SimpleTypedArrayController.cpp in Sources */,
</span><span class="cx">                                 C225494315F7DBAA0065E898 /* SlotVisitor.cpp in Sources */,
</span><span class="cx">                                 9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */,
</span><span class="lines">@@ -10561,7 +10550,6 @@
</span><span class="cx">                                 0F952AA21DF7860D00E06FBD /* VisitRaceKey.cpp in Sources */,
</span><span class="cx">                                 E18E3A590DF9278C00D90B34 /* VM.cpp in Sources */,
</span><span class="cx">                                 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */,
</span><del>-                                FE3022D61E42857300BAC493 /* VMInspector.cpp in Sources */,
</del><span class="cx">                                 53F40E8F1D5902820099A1B6 /* WasmB3IRGenerator.cpp in Sources */,
</span><span class="cx">                                 AD4B1DF91DF244E20071AE32 /* WasmBinding.cpp in Sources */,
</span><span class="cx">                                 53FD04D31D7AB277003287D3 /* WasmCallingConvention.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/PlatformMac.cmake (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/PlatformMac.cmake        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/PlatformMac.cmake        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -10,13 +10,10 @@
</span><span class="cx"> API/ObjCCallbackFunction.mm
</span><span class="cx">
</span><span class="cx"> inspector/remote/RemoteAutomationTarget.cpp
</span><ins>+ inspector/remote/RemoteConnectionToTarget.mm
</ins><span class="cx"> inspector/remote/RemoteControllableTarget.cpp
</span><span class="cx"> inspector/remote/RemoteInspectionTarget.cpp
</span><del>- inspector/remote/RemoteInspector.cpp
-
- inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm
- inspector/remote/cocoa/RemoteInspectorCocoa.mm
- inspector/remote/cocoa/RemoteInspectorXPCConnection.mm
</del><ins>+ inspector/remote/RemoteInspector.mm
</ins><span class="cx"> )
</span><span class="cx"> add_definitions(-DSTATICALLY_LINKED_WITH_WTF -D__STDC_WANT_LIB_EXT1__)
</span><span class="cx">
</span><span class="lines">@@ -28,7 +25,6 @@
</span><span class="cx"> list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
</span><span class="cx"> ${JAVASCRIPTCORE_DIR}/disassembler/udis86
</span><span class="cx"> ${JAVASCRIPTCORE_DIR}/icu
</span><del>- ${JAVASCRIPTCORE_DIR}/inspector/remote/cocoa
</del><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-compatibility_version 1 -current_version ${WEBKIT_MAC_VERSION}")
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -27,40 +27,33 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">
</span><del>-#include "InspectorFrontendChannel.h"
-#include <wtf/Lock.h>
-#include <wtf/ThreadSafeRefCounted.h>
</del><ins>+#import "InspectorFrontendChannel.h"
+#import "RemoteConnectionToTarget.h"
+#import "RemoteInspector.h"
+#import <mutex>
+#import <wtf/BlockPtr.h>
+#import <wtf/Lock.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/ThreadSafeRefCounted.h>
</ins><span class="cx">
</span><del>-#if PLATFORM(COCOA)
-#include <wtf/BlockPtr.h>
-#include <wtf/RetainPtr.h>
-
</del><span class="cx"> OBJC_CLASS NSString;
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> namespace Inspector {
</span><span class="cx">
</span><del>-class RemoteControllableTarget;
-
-#if PLATFORM(COCOA)
</del><span class="cx"> typedef Vector<BlockPtr<void ()>> RemoteTargetQueue;
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> class RemoteConnectionToTarget final : public ThreadSafeRefCounted<RemoteConnectionToTarget>, public FrontendChannel {
</span><span class="cx"> public:
</span><del>-#if PLATFORM(COCOA)
- RemoteConnectionToTarget(RemoteControllableTarget*, NSString* connectionIdentifier, NSString* destination);
-#endif
</del><ins>+ RemoteConnectionToTarget(RemoteControllableTarget*, NSString *connectionIdentifier, NSString *destination);
</ins><span class="cx"> virtual ~RemoteConnectionToTarget();
</span><span class="cx">
</span><span class="cx"> // Main API.
</span><span class="cx"> bool setup(bool isAutomaticInspection = false, bool automaticallyPause = false);
</span><del>- void sendMessageToTarget(const String&);
</del><ins>+ void sendMessageToTarget(NSString *);
</ins><span class="cx"> void close();
</span><span class="cx"> void targetClosed();
</span><span class="cx">
</span><span class="cx"> std::optional<unsigned> targetIdentifier() const;
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> NSString *connectionIdentifier() const;
</span><span class="cx"> NSString *destination() const;
</span><span class="cx">
</span><span class="lines">@@ -67,7 +60,6 @@
</span><span class="cx"> Lock& queueMutex() { return m_queueMutex; }
</span><span class="cx"> const RemoteTargetQueue& queue() const { return m_queue; }
</span><span class="cx"> void clearQueue() { m_queue.clear(); }
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> // FrontendChannel overrides.
</span><span class="cx"> ConnectionType connectionType() const override { return ConnectionType::Remote; }
</span><span class="lines">@@ -74,13 +66,11 @@
</span><span class="cx"> void sendMessageToFrontend(const String&) override;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> void dispatchAsyncOnTarget(void (^block)());
</span><span class="cx">
</span><span class="cx"> void setupRunLoop();
</span><span class="cx"> void teardownRunLoop();
</span><span class="cx"> void queueTaskOnPrivateRunLoop(void (^block)());
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> // This connection from the RemoteInspector singleton to the InspectionTarget
</span><span class="cx"> // can be used on multiple threads. So any access to the target
</span><span class="lines">@@ -87,7 +77,6 @@
</span><span class="cx"> // itself must take this mutex to ensure m_target is valid.
</span><span class="cx"> Lock m_targetMutex;
</span><span class="cx">
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> // If a target has a specific run loop it wants to evaluate on
</span><span class="cx"> // we setup our run loop sources on that specific run loop.
</span><span class="cx"> RetainPtr<CFRunLoopRef> m_runLoop;
</span><span class="lines">@@ -94,15 +83,11 @@
</span><span class="cx"> RetainPtr<CFRunLoopSourceRef> m_runLoopSource;
</span><span class="cx"> RemoteTargetQueue m_queue;
</span><span class="cx"> Lock m_queueMutex;
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> RemoteControllableTarget* m_target { nullptr };
</span><del>- bool m_connected { false };
-
-#if PLATFORM(COCOA)
</del><span class="cx"> RetainPtr<NSString> m_connectionIdentifier;
</span><span class="cx"> RetainPtr<NSString> m_destination;
</span><del>-#endif
</del><ins>+ bool m_connected { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargetmmfromrev212168trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargetmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm (from rev 212168, trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm) (0 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm         (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -0,0 +1,283 @@
</span><ins>+/*
+ * Copyright (C) 2013, 2015 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.
+ */
+
+#import "config.h"
+#import "RemoteConnectionToTarget.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import "EventLoop.h"
+#import "RemoteAutomationTarget.h"
+#import "RemoteInspectionTarget.h"
+#import <dispatch/dispatch.h>
+#import <wtf/Optional.h>
+
+#if PLATFORM(IOS)
+#import <wtf/ios/WebCoreThread.h>
+#endif
+
+namespace Inspector {
+
+static StaticLock rwiQueueMutex;
+static CFRunLoopSourceRef rwiRunLoopSource;
+static RemoteTargetQueue* rwiQueue;
+
+static void RemoteTargetHandleRunSourceGlobal(void*)
+{
+ ASSERT(CFRunLoopGetCurrent() == CFRunLoopGetMain());
+ ASSERT(rwiRunLoopSource);
+ ASSERT(rwiQueue);
+
+ RemoteTargetQueue queueCopy;
+ {
+ std::lock_guard<StaticLock> lock(rwiQueueMutex);
+ queueCopy = *rwiQueue;
+ rwiQueue->clear();
+ }
+
+ for (const auto& block : queueCopy)
+ block();
+}
+
+static void RemoteTargetQueueTaskOnGlobalQueue(void (^task)())
+{
+ ASSERT(rwiRunLoopSource);
+ ASSERT(rwiQueue);
+
+ {
+ std::lock_guard<StaticLock> lock(rwiQueueMutex);
+ rwiQueue->append(task);
+ }
+
+ CFRunLoopSourceSignal(rwiRunLoopSource);
+ CFRunLoopWakeUp(CFRunLoopGetMain());
+}
+
+static void RemoteTargetInitializeGlobalQueue()
+{
+ static dispatch_once_t pred;
+ dispatch_once(&pred, ^{
+ rwiQueue = new RemoteTargetQueue;
+
+ CFRunLoopSourceContext runLoopSourceContext = {0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, RemoteTargetHandleRunSourceGlobal};
+ rwiRunLoopSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 1, &runLoopSourceContext);
+
+ // Add to the default run loop mode for default handling, and the JSContext remote inspector run loop mode when paused.
+ CFRunLoopAddSource(CFRunLoopGetMain(), rwiRunLoopSource, kCFRunLoopDefaultMode);
+ CFRunLoopAddSource(CFRunLoopGetMain(), rwiRunLoopSource, EventLoop::remoteInspectorRunLoopMode());
+ });
+}
+
+static void RemoteTargetHandleRunSourceWithInfo(void* info)
+{
+ RemoteConnectionToTarget *connectionToTarget = static_cast<RemoteConnectionToTarget*>(info);
+
+ RemoteTargetQueue queueCopy;
+ {
+ std::lock_guard<Lock> lock(connectionToTarget->queueMutex());
+ queueCopy = connectionToTarget->queue();
+ connectionToTarget->clearQueue();
+ }
+
+ for (const auto& block : queueCopy)
+ block();
+}
+
+
+RemoteConnectionToTarget::RemoteConnectionToTarget(RemoteControllableTarget* target, NSString *connectionIdentifier, NSString *destination)
+ : m_target(target)
+ , m_connectionIdentifier(connectionIdentifier)
+ , m_destination(destination)
+{
+ setupRunLoop();
+}
+
+RemoteConnectionToTarget::~RemoteConnectionToTarget()
+{
+ teardownRunLoop();
+}
+
+std::optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const
+{
+ return m_target ? std::optional<unsigned>(m_target->targetIdentifier()) : std::nullopt;
+}
+
+NSString *RemoteConnectionToTarget::connectionIdentifier() const
+{
+ return [[m_connectionIdentifier copy] autorelease];
+}
+
+NSString *RemoteConnectionToTarget::destination() const
+{
+ return [[m_destination copy] autorelease];
+}
+
+void RemoteConnectionToTarget::dispatchAsyncOnTarget(void (^block)())
+{
+ if (m_runLoop) {
+ queueTaskOnPrivateRunLoop(block);
+ return;
+ }
+
+#if PLATFORM(IOS)
+ if (WebCoreWebThreadIsEnabled && WebCoreWebThreadIsEnabled()) {
+ WebCoreWebThreadRun(block);
+ return;
+ }
+#endif
+
+ RemoteTargetQueueTaskOnGlobalQueue(block);
+}
+
+bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automaticallyPause)
+{
+ std::lock_guard<Lock> lock(m_targetMutex);
+
+ if (!m_target)
+ return false;
+
+ ref();
+ dispatchAsyncOnTarget(^{
+ {
+ std::lock_guard<Lock> lock(m_targetMutex);
+ if (!m_target || !m_target->remoteControlAllowed()) {
+ RemoteInspector::singleton().setupFailed(targetIdentifier().value_or(0));
+ m_target = nullptr;
+ } else if (is<RemoteInspectionTarget>(m_target)) {
+ auto castedTarget = downcast<RemoteInspectionTarget>(m_target);
+ castedTarget->connect(this, isAutomaticInspection);
+ m_connected = true;
+
+ if (automaticallyPause)
+ castedTarget->pause();
+ } else if (is<RemoteAutomationTarget>(m_target)) {
+ auto castedTarget = downcast<RemoteAutomationTarget>(m_target);
+ castedTarget->connect(this);
+ m_connected = true;
+ }
+ }
+ deref();
+ });
+
+ return true;
+}
+
+void RemoteConnectionToTarget::targetClosed()
+{
+ std::lock_guard<Lock> lock(m_targetMutex);
+
+ m_target = nullptr;
+}
+
+void RemoteConnectionToTarget::close()
+{
+ ref();
+ dispatchAsyncOnTarget(^{
+ {
+ std::lock_guard<Lock> lock(m_targetMutex);
+
+ if (m_target) {
+ if (m_connected)
+ m_target->disconnect(this);
+
+ m_target = nullptr;
+ }
+ }
+ deref();
+ });
+}
+
+void RemoteConnectionToTarget::sendMessageToTarget(NSString *message)
+{
+ ref();
+ dispatchAsyncOnTarget(^{
+ {
+ RemoteControllableTarget* target = nullptr;
+ {
+ std::lock_guard<Lock> lock(m_targetMutex);
+ if (!m_target)
+ return;
+ target = m_target;
+ }
+
+ target->dispatchMessageFromRemote(message);
+ }
+ deref();
+ });
+}
+
+void RemoteConnectionToTarget::sendMessageToFrontend(const String& message)
+{
+ if (!targetIdentifier())
+ return;
+
+ RemoteInspector::singleton().sendMessageToRemote(targetIdentifier().value(), message);
+}
+
+void RemoteConnectionToTarget::setupRunLoop()
+{
+ CFRunLoopRef targetRunLoop = m_target->targetRunLoop();
+ if (!targetRunLoop) {
+ RemoteTargetInitializeGlobalQueue();
+ return;
+ }
+
+ m_runLoop = targetRunLoop;
+
+ CFRunLoopSourceContext runLoopSourceContext = {0, this, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, RemoteTargetHandleRunSourceWithInfo};
+ m_runLoopSource = adoptCF(CFRunLoopSourceCreate(kCFAllocatorDefault, 1, &runLoopSourceContext));
+
+ CFRunLoopAddSource(m_runLoop.get(), m_runLoopSource.get(), kCFRunLoopDefaultMode);
+ CFRunLoopAddSource(m_runLoop.get(), m_runLoopSource.get(), EventLoop::remoteInspectorRunLoopMode());
+}
+
+void RemoteConnectionToTarget::teardownRunLoop()
+{
+ if (!m_runLoop)
+ return;
+
+ CFRunLoopRemoveSource(m_runLoop.get(), m_runLoopSource.get(), kCFRunLoopDefaultMode);
+ CFRunLoopRemoveSource(m_runLoop.get(), m_runLoopSource.get(), EventLoop::remoteInspectorRunLoopMode());
+
+ m_runLoop = nullptr;
+ m_runLoopSource = nullptr;
+}
+
+void RemoteConnectionToTarget::queueTaskOnPrivateRunLoop(void (^block)())
+{
+ ASSERT(m_runLoop);
+
+ {
+ std::lock_guard<Lock> lock(m_queueMutex);
+ m_queue.append(block);
+ }
+
+ CFRunLoopSourceSignal(m_runLoopSource.get());
+ CFRunLoopWakeUp(m_runLoop.get());
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteControllableTargeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -27,13 +27,10 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">
</span><ins>+#include <CoreFoundation/CFRunLoop.h>
</ins><span class="cx"> #include <wtf/TypeCasts.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><del>-#if USE(CF)
-#include <CoreFoundation/CFRunLoop.h>
-#endif
-
</del><span class="cx"> namespace Inspector {
</span><span class="cx">
</span><span class="cx"> class FrontendChannel;
</span><span class="lines">@@ -56,10 +53,8 @@
</span><span class="cx"> virtual bool remoteControlAllowed() const = 0;
</span><span class="cx"> virtual void dispatchMessageFromRemote(const String& message) = 0;
</span><span class="cx">
</span><del>-#if USE(CF)
</del><span class="cx"> // The dispatch block will be scheduled on a global run loop if null is returned.
</span><span class="cx"> virtual CFRunLoopRef targetRunLoop() { return nullptr; }
</span><del>-#endif
</del><span class="cx"> private:
</span><span class="cx"> unsigned m_identifier {0};
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectionTargeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -41,10 +41,8 @@
</span><span class="cx"> bool remoteDebuggingAllowed() const { return m_allowed; }
</span><span class="cx"> void setRemoteDebuggingAllowed(bool);
</span><span class="cx">
</span><del>-#if USE(CF)
</del><span class="cx"> CFRunLoopRef targetRunLoop() override { return m_runLoop.get(); }
</span><span class="cx"> void setTargetRunLoop(CFRunLoopRef runLoop) { m_runLoop = runLoop; }
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> virtual String name() const { return String(); } // JavaScript and Web
</span><span class="cx"> virtual String url() const { return String(); } // Web
</span><span class="lines">@@ -61,9 +59,7 @@
</span><span class="cx"> bool remoteControlAllowed() const override;
</span><span class="cx"> private:
</span><span class="cx"> bool m_allowed {false};
</span><del>-#if USE(CF)
</del><span class="cx"> RetainPtr<CFRunLoopRef> m_runLoop;
</span><del>-#endif
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -1,224 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013-2016 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.
- */
-
-#include "config.h"
-#include "RemoteInspector.h"
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#include "RemoteAutomationTarget.h"
-#include "RemoteConnectionToTarget.h"
-#include "RemoteInspectionTarget.h"
-#include "RemoteInspectorConstants.h"
-#include <wtf/MainThread.h>
-#include <wtf/text/WTFString.h>
-
-namespace Inspector {
-
-bool RemoteInspector::startEnabled = true;
-
-void RemoteInspector::startDisabled()
-{
- RemoteInspector::startEnabled = false;
-}
-
-unsigned RemoteInspector::nextAvailableTargetIdentifier()
-{
- unsigned nextValidTargetIdentifier;
- do {
- nextValidTargetIdentifier = m_nextAvailableTargetIdentifier++;
- } while (!nextValidTargetIdentifier || nextValidTargetIdentifier == std::numeric_limits<unsigned>::max() || m_targetMap.contains(nextValidTargetIdentifier));
- return nextValidTargetIdentifier;
-}
-
-void RemoteInspector::registerTarget(RemoteControllableTarget* target)
-{
- ASSERT_ARG(target, target);
-
- std::lock_guard<Lock> lock(m_mutex);
-
- unsigned targetIdentifier = nextAvailableTargetIdentifier();
- target->setTargetIdentifier(targetIdentifier);
-
- {
- auto result = m_targetMap.set(targetIdentifier, target);
- ASSERT_UNUSED(result, result.isNewEntry);
- }
-
- // If remote control is not allowed, a null listing is returned.
- if (auto targetListing = listingForTarget(*target)) {
- auto result = m_targetListingMap.set(targetIdentifier, targetListing);
- ASSERT_UNUSED(result, result.isNewEntry);
- }
-
- pushListingsSoon();
-}
-
-void RemoteInspector::unregisterTarget(RemoteControllableTarget* target)
-{
- ASSERT_ARG(target, target);
-
- std::lock_guard<Lock> lock(m_mutex);
-
- unsigned targetIdentifier = target->targetIdentifier();
- if (!targetIdentifier)
- return;
-
- bool wasRemoved = m_targetMap.remove(targetIdentifier);
- ASSERT_UNUSED(wasRemoved, wasRemoved);
-
- // The listing may never have been added if remote control isn't allowed.
- m_targetListingMap.remove(targetIdentifier);
-
- if (auto connectionToTarget = m_targetConnectionMap.take(targetIdentifier))
- connectionToTarget->targetClosed();
-
- pushListingsSoon();
-}
-
-void RemoteInspector::updateTarget(RemoteControllableTarget* target)
-{
- ASSERT_ARG(target, target);
-
- std::lock_guard<Lock> lock(m_mutex);
-
- unsigned targetIdentifier = target->targetIdentifier();
- if (!targetIdentifier)
- return;
-
- {
- auto result = m_targetMap.set(targetIdentifier, target);
- ASSERT_UNUSED(result, !result.isNewEntry);
- }
-
- // If the target has just allowed remote control, then the listing won't exist yet.
- // If the target has no identifier remove the old listing.
- if (auto targetListing = listingForTarget(*target))
- m_targetListingMap.set(targetIdentifier, targetListing);
- else
- m_targetListingMap.remove(targetIdentifier);
-
- pushListingsSoon();
-}
-
-void RemoteInspector::updateClientCapabilities()
-{
- ASSERT(isMainThread());
-
- std::lock_guard<Lock> lock(m_mutex);
-
- if (!m_client)
- m_clientCapabilities = std::nullopt;
- else {
- RemoteInspector::Client::Capabilities updatedCapabilities = {
- m_client->remoteAutomationAllowed() // remoteAutomationAllowed
- };
-
- m_clientCapabilities = updatedCapabilities;
- }
-}
-
-void RemoteInspector::setRemoteInspectorClient(RemoteInspector::Client* client)
-{
- ASSERT_ARG(client, client);
- ASSERT(!m_client);
-
- {
- std::lock_guard<Lock> lock(m_mutex);
- m_client = client;
- }
-
- // Send an updated listing that includes whether the client allows remote automation.
- updateClientCapabilities();
- pushListingsSoon();
-}
-
-void RemoteInspector::setupFailed(unsigned targetIdentifier)
-{
- std::lock_guard<Lock> lock(m_mutex);
-
- m_targetConnectionMap.remove(targetIdentifier);
-
- if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier)
- m_automaticInspectionPaused = false;
-
- updateHasActiveDebugSession();
- updateTargetListing(targetIdentifier);
- pushListingsSoon();
-}
-
-void RemoteInspector::setupCompleted(unsigned targetIdentifier)
-{
- std::lock_guard<Lock> lock(m_mutex);
-
- if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier)
- m_automaticInspectionPaused = false;
-}
-
-bool RemoteInspector::waitingForAutomaticInspection(unsigned)
-{
- // We don't take the lock to check this because we assume it will be checked repeatedly.
- return m_automaticInspectionPaused;
-}
-
-void RemoteInspector::clientCapabilitiesDidChange()
-{
- updateClientCapabilities();
- pushListingsSoon();
-}
-
-void RemoteInspector::stop()
-{
- std::lock_guard<Lock> lock(m_mutex);
-
- stopInternal(StopSource::API);
-}
-
-TargetListing RemoteInspector::listingForTarget(const RemoteControllableTarget& target) const
-{
- if (is<RemoteInspectionTarget>(target))
- return listingForInspectionTarget(downcast<RemoteInspectionTarget>(target));
- if (is<RemoteAutomationTarget>(target))
- return listingForAutomationTarget(downcast<RemoteAutomationTarget>(target));
-
- ASSERT_NOT_REACHED();
- return nullptr;
-}
-
-void RemoteInspector::updateHasActiveDebugSession()
-{
- bool hasActiveDebuggerSession = !m_targetConnectionMap.isEmpty();
- if (hasActiveDebuggerSession == m_hasActiveDebugSession)
- return;
-
- m_hasActiveDebugSession = hasActiveDebuggerSession;
-
- // FIXME: Expose some way to access this state in an embedder.
- // Legacy iOS WebKit 1 had a notification. This will need to be smarter with WebKit2.
-}
-
-} // namespace Inspector
-
-#endif // ENABLE(REMOTE_INSPECTOR)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -27,18 +27,14 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx">
</span><del>-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/Lock.h>
</del><ins>+#import "RemoteInspectorXPCConnection.h"
+#import <wtf/Forward.h>
+#import <wtf/HashMap.h>
+#import <wtf/Lock.h>
+#import <wtf/RetainPtr.h>
</ins><span class="cx">
</span><del>-#if PLATFORM(COCOA)
-#include "RemoteInspectorXPCConnection.h"
-#include <wtf/RetainPtr.h>
-
</del><span class="cx"> OBJC_CLASS NSDictionary;
</span><span class="cx"> OBJC_CLASS NSString;
</span><del>-typedef RetainPtr<NSDictionary> TargetListing;
-#endif
</del><span class="cx">
</span><span class="cx"> namespace Inspector {
</span><span class="cx">
</span><span class="lines">@@ -48,11 +44,7 @@
</span><span class="cx"> class RemoteInspectionTarget;
</span><span class="cx"> class RemoteInspectorClient;
</span><span class="cx">
</span><del>-class JS_EXPORT_PRIVATE RemoteInspector final
-#if PLATFORM(COCOA)
- : public RemoteInspectorXPCConnection::Client
-#endif
-{
</del><ins>+class JS_EXPORT_PRIVATE RemoteInspector final : public RemoteInspectorXPCConnection::Client {
</ins><span class="cx"> public:
</span><span class="cx"> class Client {
</span><span class="cx"> public:
</span><span class="lines">@@ -88,13 +80,11 @@
</span><span class="cx"> void start();
</span><span class="cx"> void stop();
</span><span class="cx">
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> bool hasParentProcessInformation() const { return m_parentProcessIdentifier != 0; }
</span><span class="cx"> pid_t parentProcessIdentifier() const { return m_parentProcessIdentifier; }
</span><span class="cx"> RetainPtr<CFDataRef> parentProcessAuditData() const { return m_parentProcessAuditData; }
</span><span class="cx"> void setParentProcessInformation(pid_t, RetainPtr<CFDataRef> auditData);
</span><span class="cx"> void setParentProcessInfomationIsDelayed();
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> RemoteInspector();
</span><span class="lines">@@ -104,14 +94,11 @@
</span><span class="cx"> enum class StopSource { API, XPCMessage };
</span><span class="cx"> void stopInternal(StopSource);
</span><span class="cx">
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> void setupXPCConnectionIfNeeded();
</span><del>-#endif
</del><span class="cx">
</span><del>- TargetListing listingForTarget(const RemoteControllableTarget&) const;
- TargetListing listingForInspectionTarget(const RemoteInspectionTarget&) const;
- TargetListing listingForAutomationTarget(const RemoteAutomationTarget&) const;
-
</del><ins>+ RetainPtr<NSDictionary> listingForTarget(const RemoteControllableTarget&) const;
+ RetainPtr<NSDictionary> listingForInspectionTarget(const RemoteInspectionTarget&) const;
+ RetainPtr<NSDictionary> listingForAutomationTarget(const RemoteAutomationTarget&) const;
</ins><span class="cx"> void pushListingsNow();
</span><span class="cx"> void pushListingsSoon();
</span><span class="cx">
</span><span class="lines">@@ -123,7 +110,6 @@
</span><span class="cx">
</span><span class="cx"> void sendAutomaticInspectionCandidateMessage();
</span><span class="cx">
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) override;
</span><span class="cx"> void xpcConnectionFailed(RemoteInspectorXPCConnection*) override;
</span><span class="cx"> void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) override;
</span><span class="lines">@@ -138,7 +124,6 @@
</span><span class="cx"> void receivedAutomaticInspectionConfigurationMessage(NSDictionary *userInfo);
</span><span class="cx"> void receivedAutomaticInspectionRejectMessage(NSDictionary *userInfo);
</span><span class="cx"> void receivedAutomationSessionRequestMessage(NSDictionary *userInfo);
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> static bool startEnabled;
</span><span class="cx">
</span><span class="lines">@@ -149,19 +134,15 @@
</span><span class="cx"> Lock m_mutex;
</span><span class="cx">
</span><span class="cx"> HashMap<unsigned, RemoteControllableTarget*> m_targetMap;
</span><ins>+ HashMap<unsigned, RetainPtr<NSDictionary>> m_targetListingMap;
</ins><span class="cx"> HashMap<unsigned, RefPtr<RemoteConnectionToTarget>> m_targetConnectionMap;
</span><del>- HashMap<unsigned, TargetListing> m_targetListingMap;
</del><span class="cx">
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> RefPtr<RemoteInspectorXPCConnection> m_relayConnection;
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> RemoteInspector::Client* m_client { nullptr };
</span><span class="cx"> std::optional<RemoteInspector::Client::Capabilities> m_clientCapabilities;
</span><span class="cx">
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> dispatch_queue_t m_xpcQueue;
</span><del>-#endif
</del><span class="cx"> unsigned m_nextAvailableTargetIdentifier { 1 };
</span><span class="cx"> int m_notifyToken { 0 };
</span><span class="cx"> bool m_enabled { false };
</span><span class="lines">@@ -169,9 +150,7 @@
</span><span class="cx"> bool m_pushScheduled { false };
</span><span class="cx">
</span><span class="cx"> pid_t m_parentProcessIdentifier { 0 };
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> RetainPtr<CFDataRef> m_parentProcessAuditData;
</span><del>-#endif
</del><span class="cx"> bool m_shouldSendParentProcessInformation { false };
</span><span class="cx"> bool m_automaticInspectionEnabled { false };
</span><span class="cx"> bool m_automaticInspectionPaused { false };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormmfromrev212168trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (from rev 212168, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm) (0 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm         (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -0,0 +1,857 @@
</span><ins>+/*
+ * Copyright (C) 2013-2016 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.
+ */
+
+#import "config.h"
+#import "RemoteInspector.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import "InitializeThreading.h"
+#import "RemoteAutomationTarget.h"
+#import "RemoteConnectionToTarget.h"
+#import "RemoteInspectionTarget.h"
+#import "RemoteInspectorConstants.h"
+#import <Foundation/Foundation.h>
+#import <dispatch/dispatch.h>
+#import <notify.h>
+#import <wtf/Assertions.h>
+#import <wtf/MainThread.h>
+#import <wtf/NeverDestroyed.h>
+#import <wtf/spi/darwin/SandboxSPI.h>
+#import <wtf/spi/darwin/XPCSPI.h>
+#import <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+static bool canAccessWebInspectorMachPort()
+{
+ return sandbox_check(getpid(), "mach-lookup", static_cast<enum sandbox_filter_type>(SANDBOX_FILTER_GLOBAL_NAME | SANDBOX_CHECK_NO_REPORT), WIRXPCMachPortName) == 0;
+}
+
+static bool globalAutomaticInspectionState()
+{
+ int token = 0;
+ if (notify_register_check(WIRAutomaticInspectionEnabledState, &token) != NOTIFY_STATUS_OK)
+ return false;
+
+ uint64_t automaticInspectionEnabled = 0;
+ notify_get_state(token, &automaticInspectionEnabled);
+ return automaticInspectionEnabled == 1;
+}
+
+bool RemoteInspector::startEnabled = true;
+
+void RemoteInspector::startDisabled()
+{
+ RemoteInspector::startEnabled = false;
+}
+
+RemoteInspector& RemoteInspector::singleton()
+{
+ static NeverDestroyed<RemoteInspector> shared;
+
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ if (canAccessWebInspectorMachPort()) {
+ dispatch_block_t initialize = ^{
+ WTF::initializeMainThread();
+ JSC::initializeThreading();
+ if (RemoteInspector::startEnabled)
+ shared.get().start();
+ };
+
+ if ([NSThread isMainThread])
+ initialize();
+ else {
+ // FIXME: This means that we may miss an auto-attach to a JSContext created on a non-main thread.
+ // The main thread initialization is required for certain WTF values that need to be initialized
+ // on the "real" main thread. We should investigate a better way to handle this.
+ dispatch_async(dispatch_get_main_queue(), initialize);
+ }
+ }
+ });
+
+ return shared;
+}
+
+RemoteInspector::RemoteInspector()
+ : m_xpcQueue(dispatch_queue_create("com.apple.JavaScriptCore.remote-inspector-xpc", DISPATCH_QUEUE_SERIAL))
+{
+}
+
+unsigned RemoteInspector::nextAvailableTargetIdentifier()
+{
+ unsigned nextValidTargetIdentifier;
+ do {
+ nextValidTargetIdentifier = m_nextAvailableTargetIdentifier++;
+ } while (!nextValidTargetIdentifier || nextValidTargetIdentifier == std::numeric_limits<unsigned>::max() || m_targetMap.contains(nextValidTargetIdentifier));
+ return nextValidTargetIdentifier;
+}
+
+void RemoteInspector::registerTarget(RemoteControllableTarget* target)
+{
+ ASSERT_ARG(target, target);
+
+ std::lock_guard<Lock> lock(m_mutex);
+
+ unsigned targetIdentifier = nextAvailableTargetIdentifier();
+ target->setTargetIdentifier(targetIdentifier);
+
+ {
+ auto result = m_targetMap.set(targetIdentifier, target);
+ ASSERT_UNUSED(result, result.isNewEntry);
+ }
+
+ // If remote control is not allowed, a null listing is returned.
+ if (RetainPtr<NSDictionary> targetListing = listingForTarget(*target)) {
+ auto result = m_targetListingMap.set(targetIdentifier, targetListing);
+ ASSERT_UNUSED(result, result.isNewEntry);
+ }
+
+ pushListingsSoon();
+}
+
+void RemoteInspector::unregisterTarget(RemoteControllableTarget* target)
+{
+ ASSERT_ARG(target, target);
+
+ std::lock_guard<Lock> lock(m_mutex);
+
+ unsigned targetIdentifier = target->targetIdentifier();
+ if (!targetIdentifier)
+ return;
+
+ bool wasRemoved = m_targetMap.remove(targetIdentifier);
+ ASSERT_UNUSED(wasRemoved, wasRemoved);
+
+ // The listing may never have been added if remote control isn't allowed.
+ m_targetListingMap.remove(targetIdentifier);
+
+ if (auto connectionToTarget = m_targetConnectionMap.take(targetIdentifier))
+ connectionToTarget->targetClosed();
+
+ pushListingsSoon();
+}
+
+void RemoteInspector::updateTarget(RemoteControllableTarget* target)
+{
+ ASSERT_ARG(target, target);
+
+ std::lock_guard<Lock> lock(m_mutex);
+
+ unsigned targetIdentifier = target->targetIdentifier();
+ if (!targetIdentifier)
+ return;
+
+ {
+ auto result = m_targetMap.set(targetIdentifier, target);
+ ASSERT_UNUSED(result, !result.isNewEntry);
+ }
+
+ // If the target has just allowed remote control, then the listing won't exist yet.
+ // If the target has no identifier remove the old listing.
+ if (RetainPtr<NSDictionary> targetListing = listingForTarget(*target))
+ m_targetListingMap.set(targetIdentifier, targetListing);
+ else
+ m_targetListingMap.remove(targetIdentifier);
+
+ pushListingsSoon();
+}
+
+void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* target)
+{
+ ASSERT_ARG(target, target);
+ {
+ std::lock_guard<Lock> lock(m_mutex);
+
+ unsigned targetIdentifier = target->targetIdentifier();
+ if (!targetIdentifier)
+ return;
+
+ auto result = m_targetMap.set(targetIdentifier, target);
+ ASSERT_UNUSED(result, !result.isNewEntry);
+
+ // If the target has just allowed remote control, then the listing won't exist yet.
+ // If the target has no identifier remove the old listing.
+ if (RetainPtr<NSDictionary> targetListing = listingForTarget(*target))
+ m_targetListingMap.set(targetIdentifier, targetListing);
+ else
+ m_targetListingMap.remove(targetIdentifier);
+
+ // Don't allow automatic inspection unless it is allowed or we are stopped.
+ if (!m_automaticInspectionEnabled || !m_enabled) {
+ pushListingsSoon();
+ return;
+ }
+
+ // FIXME: We should handle multiple debuggables trying to pause at the same time on different threads.
+ // To make this work we will need to change m_automaticInspectionCandidateTargetIdentifier to be a per-thread value.
+ // Multiple attempts on the same thread should not be possible because our nested run loop is in a special RWI mode.
+ if (m_automaticInspectionPaused) {
+ LOG_ERROR("Skipping Automatic Inspection Candidate with pageId(%u) because we are already paused waiting for pageId(%u)", targetIdentifier, m_automaticInspectionCandidateTargetIdentifier);
+ pushListingsSoon();
+ return;
+ }
+
+ m_automaticInspectionPaused = true;
+ m_automaticInspectionCandidateTargetIdentifier = targetIdentifier;
+
+ // If we are pausing before we have connected to webinspectord the candidate message will be sent as soon as the connection is established.
+ if (m_relayConnection) {
+ pushListingsNow();
+ sendAutomaticInspectionCandidateMessage();
+ }
+
+ // In case debuggers fail to respond, or we cannot connect to webinspectord, automatically continue after a short period of time.
+#if PLATFORM(WATCHOS)
+ int64_t debuggerTimeoutDelay = 5;
+#else
+ int64_t debuggerTimeoutDelay = 1;
+#endif
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, debuggerTimeoutDelay * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ std::lock_guard<Lock> lock(m_mutex);
+ if (m_automaticInspectionCandidateTargetIdentifier == targetIdentifier) {
+ LOG_ERROR("Skipping Automatic Inspection Candidate with pageId(%u) because we failed to receive a response in time.", m_automaticInspectionCandidateTargetIdentifier);
+ m_automaticInspectionPaused = false;
+ }
+ });
+ }
+
+ target->pauseWaitingForAutomaticInspection();
+
+ {
+ std::lock_guard<Lock> lock(m_mutex);
+
+ ASSERT(m_automaticInspectionCandidateTargetIdentifier);
+ m_automaticInspectionCandidateTargetIdentifier = 0;
+ }
+}
+
+void RemoteInspector::updateClientCapabilities()
+{
+ ASSERT(isMainThread());
+
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if (!m_client)
+ m_clientCapabilities = std::nullopt;
+ else {
+ RemoteInspector::Client::Capabilities updatedCapabilities = {
+ m_client->remoteAutomationAllowed() // remoteAutomationAllowed
+ };
+
+ m_clientCapabilities = updatedCapabilities;
+ }
+}
+
+void RemoteInspector::setRemoteInspectorClient(RemoteInspector::Client* client)
+{
+ ASSERT_ARG(client, client);
+ ASSERT(!m_client);
+
+ {
+ std::lock_guard<Lock> lock(m_mutex);
+ m_client = client;
+ }
+
+ // Send an updated listing that includes whether the client allows remote automation.
+ updateClientCapabilities();
+ pushListingsSoon();
+}
+
+void RemoteInspector::sendAutomaticInspectionCandidateMessage()
+{
+ ASSERT(m_enabled);
+ ASSERT(m_automaticInspectionEnabled);
+ ASSERT(m_automaticInspectionPaused);
+ ASSERT(m_automaticInspectionCandidateTargetIdentifier);
+ ASSERT(m_relayConnection);
+
+ NSDictionary *details = @{WIRTargetIdentifierKey: @(m_automaticInspectionCandidateTargetIdentifier)};
+ m_relayConnection->sendMessage(WIRAutomaticInspectionCandidateMessage, details);
+}
+
+void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if (!m_relayConnection)
+ return;
+
+ auto targetConnection = m_targetConnectionMap.get(targetIdentifier);
+ if (!targetConnection)
+ return;
+
+ NSDictionary *userInfo = @{
+ WIRRawDataKey: [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding],
+ WIRConnectionIdentifierKey: targetConnection->connectionIdentifier(),
+ WIRDestinationKey: targetConnection->destination()
+ };
+
+ m_relayConnection->sendMessage(WIRRawDataMessage, userInfo);
+}
+
+void RemoteInspector::setupFailed(unsigned targetIdentifier)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ m_targetConnectionMap.remove(targetIdentifier);
+
+ if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier)
+ m_automaticInspectionPaused = false;
+
+ updateHasActiveDebugSession();
+ updateTargetListing(targetIdentifier);
+ pushListingsSoon();
+}
+
+void RemoteInspector::setupCompleted(unsigned targetIdentifier)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier)
+ m_automaticInspectionPaused = false;
+}
+
+bool RemoteInspector::waitingForAutomaticInspection(unsigned)
+{
+ // We don't take the lock to check this because we assume it will be checked repeatedly.
+ return m_automaticInspectionPaused;
+}
+
+void RemoteInspector::clientCapabilitiesDidChange()
+{
+ updateClientCapabilities();
+ pushListingsSoon();
+}
+
+void RemoteInspector::start()
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if (m_enabled)
+ return;
+
+ m_enabled = true;
+
+ // Load the initial automatic inspection state when first started, so we know it before we have even connected to webinspectord.
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ m_automaticInspectionEnabled = globalAutomaticInspectionState();
+ });
+
+ notify_register_dispatch(WIRServiceAvailableNotification, &m_notifyToken, m_xpcQueue, ^(int) {
+ RemoteInspector::singleton().setupXPCConnectionIfNeeded();
+ });
+
+ notify_post(WIRServiceAvailabilityCheckNotification);
+}
+
+void RemoteInspector::stop()
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ stopInternal(StopSource::API);
+}
+
+void RemoteInspector::stopInternal(StopSource source)
+{
+ if (!m_enabled)
+ return;
+
+ m_enabled = false;
+
+ m_pushScheduled = false;
+
+ for (auto targetConnection : m_targetConnectionMap.values())
+ targetConnection->close();
+ m_targetConnectionMap.clear();
+
+ updateHasActiveDebugSession();
+
+ m_automaticInspectionPaused = false;
+
+ if (m_relayConnection) {
+ switch (source) {
+ case StopSource::API:
+ m_relayConnection->close();
+ break;
+ case StopSource::XPCMessage:
+ m_relayConnection->closeFromMessage();
+ break;
+ }
+
+ m_relayConnection = nullptr;
+ }
+
+ notify_cancel(m_notifyToken);
+}
+
+void RemoteInspector::setupXPCConnectionIfNeeded()
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if (m_relayConnection)
+ return;
+
+ xpc_connection_t connection = xpc_connection_create_mach_service(WIRXPCMachPortName, m_xpcQueue, 0);
+ if (!connection)
+ return;
+
+ m_relayConnection = adoptRef(new RemoteInspectorXPCConnection(connection, m_xpcQueue, this));
+ m_relayConnection->sendMessage(@"syn", nil); // Send a simple message to initialize the XPC connection.
+ xpc_release(connection);
+
+ if (m_automaticInspectionCandidateTargetIdentifier) {
+ // We already have a debuggable waiting to be automatically inspected.
+ pushListingsNow();
+ sendAutomaticInspectionCandidateMessage();
+ } else
+ pushListingsSoon();
+}
+
+#pragma mark - Proxy Application Information
+
+void RemoteInspector::setParentProcessInformation(pid_t pid, RetainPtr<CFDataRef> auditData)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if (m_parentProcessIdentifier || m_parentProcessAuditData)
+ return;
+
+ m_parentProcessIdentifier = pid;
+ m_parentProcessAuditData = auditData;
+
+ if (m_shouldSendParentProcessInformation)
+ receivedProxyApplicationSetupMessage(nil);
+}
+
+#pragma mark - RemoteInspectorXPCConnection::Client
+
+void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ if ([messageName isEqualToString:WIRPermissionDenied]) {
+ stopInternal(StopSource::XPCMessage);
+ return;
+ }
+
+ if ([messageName isEqualToString:WIRSocketDataMessage])
+ receivedDataMessage(userInfo);
+ else if ([messageName isEqualToString:WIRSocketSetupMessage])
+ receivedSetupMessage(userInfo);
+ else if ([messageName isEqualToString:WIRWebPageCloseMessage])
+ receivedDidCloseMessage(userInfo);
+ else if ([messageName isEqualToString:WIRApplicationGetListingMessage])
+ receivedGetListingMessage(userInfo);
+ else if ([messageName isEqualToString:WIRIndicateMessage])
+ receivedIndicateMessage(userInfo);
+ else if ([messageName isEqualToString:WIRProxyApplicationSetupMessage])
+ receivedProxyApplicationSetupMessage(userInfo);
+ else if ([messageName isEqualToString:WIRConnectionDiedMessage])
+ receivedConnectionDiedMessage(userInfo);
+ else if ([messageName isEqualToString:WIRAutomaticInspectionConfigurationMessage])
+ receivedAutomaticInspectionConfigurationMessage(userInfo);
+ else if ([messageName isEqualToString:WIRAutomaticInspectionRejectMessage])
+ receivedAutomaticInspectionRejectMessage(userInfo);
+ else if ([messageName isEqualToString:WIRAutomationSessionRequestMessage])
+ receivedAutomationSessionRequestMessage(userInfo);
+ else
+ NSLog(@"Unrecognized RemoteInspector XPC Message: %@", messageName);
+}
+
+void RemoteInspector::xpcConnectionFailed(RemoteInspectorXPCConnection* relayConnection)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ ASSERT(relayConnection == m_relayConnection);
+ if (relayConnection != m_relayConnection)
+ return;
+
+ m_pushScheduled = false;
+
+ for (auto targetConnection : m_targetConnectionMap.values())
+ targetConnection->close();
+ m_targetConnectionMap.clear();
+
+ updateHasActiveDebugSession();
+
+ m_automaticInspectionPaused = false;
+
+ // The XPC connection will close itself.
+ m_relayConnection = nullptr;
+}
+
+void RemoteInspector::xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t)
+{
+ // Intentionally ignored.
+}
+
+#pragma mark - Listings
+
+RetainPtr<NSDictionary> RemoteInspector::listingForTarget(const RemoteControllableTarget& target) const
+{
+ if (is<RemoteInspectionTarget>(target))
+ return listingForInspectionTarget(downcast<RemoteInspectionTarget>(target));
+ if (is<RemoteAutomationTarget>(target))
+ return listingForAutomationTarget(downcast<RemoteAutomationTarget>(target));
+
+ ASSERT_NOT_REACHED();
+ return nil;
+}
+
+RetainPtr<NSDictionary> RemoteInspector::listingForInspectionTarget(const RemoteInspectionTarget& target) const
+{
+ // Must collect target information on the WebThread, Main, or Worker thread since RemoteTargets are
+ // implemented by non-threadsafe JSC / WebCore classes such as JSGlobalObject or WebCore::Page.
+
+ if (!target.remoteDebuggingAllowed())
+ return nil;
+
+ RetainPtr<NSMutableDictionary> listing = adoptNS([[NSMutableDictionary alloc] init]);
+ [listing setObject:@(target.targetIdentifier()) forKey:WIRTargetIdentifierKey];
+
+ switch (target.type()) {
+ case RemoteInspectionTarget::Type::JavaScript:
+ [listing setObject:target.name() forKey:WIRTitleKey];
+ [listing setObject:WIRTypeJavaScript forKey:WIRTypeKey];
+ break;
+ case RemoteInspectionTarget::Type::Web:
+ [listing setObject:target.url() forKey:WIRURLKey];
+ [listing setObject:target.name() forKey:WIRTitleKey];
+ [listing setObject:WIRTypeWeb forKey:WIRTypeKey];
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ if (auto* connectionToTarget = m_targetConnectionMap.get(target.targetIdentifier()))
+ [listing setObject:connectionToTarget->connectionIdentifier() forKey:WIRConnectionIdentifierKey];
+
+ if (target.hasLocalDebugger())
+ [listing setObject:@YES forKey:WIRHasLocalDebuggerKey];
+
+ return listing;
+}
+
+RetainPtr<NSDictionary> RemoteInspector::listingForAutomationTarget(const RemoteAutomationTarget& target) const
+{
+ // Must collect target information on the WebThread or Main thread since RemoteTargets are
+ // implemented by non-threadsafe JSC / WebCore classes such as JSGlobalObject or WebCore::Page.
+ ASSERT(isMainThread());
+
+ RetainPtr<NSMutableDictionary> listing = adoptNS([[NSMutableDictionary alloc] init]);
+ [listing setObject:@(target.targetIdentifier()) forKey:WIRTargetIdentifierKey];
+ [listing setObject:target.name() forKey:WIRSessionIdentifierKey];
+ [listing setObject:WIRTypeAutomation forKey:WIRTypeKey];
+ [listing setObject:@(target.isPaired()) forKey:WIRAutomationTargetIsPairedKey];
+
+ if (auto connectionToTarget = m_targetConnectionMap.get(target.targetIdentifier()))
+ [listing setObject:connectionToTarget->connectionIdentifier() forKey:WIRConnectionIdentifierKey];
+
+ return listing;
+}
+
+void RemoteInspector::pushListingsNow()
+{
+ ASSERT(m_relayConnection);
+ if (!m_relayConnection)
+ return;
+
+ m_pushScheduled = false;
+
+ RetainPtr<NSMutableDictionary> listings = adoptNS([[NSMutableDictionary alloc] init]);
+ for (RetainPtr<NSDictionary> listing : m_targetListingMap.values()) {
+ NSString *targetIdentifierString = [[listing.get() objectForKey:WIRTargetIdentifierKey] stringValue];
+ [listings setObject:listing.get() forKey:targetIdentifierString];
+ }
+
+ RetainPtr<NSMutableDictionary> message = adoptNS([[NSMutableDictionary alloc] init]);
+ [message setObject:listings.get() forKey:WIRListingKey];
+
+ BOOL isAllowed = m_clientCapabilities && m_clientCapabilities->remoteAutomationAllowed;
+ [message setObject:@(isAllowed) forKey:WIRRemoteAutomationEnabledKey];
+
+ m_relayConnection->sendMessage(WIRListingMessage, message.get());
+}
+
+void RemoteInspector::pushListingsSoon()
+{
+ if (!m_relayConnection)
+ return;
+
+ if (m_pushScheduled)
+ return;
+
+ m_pushScheduled = true;
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ std::lock_guard<Lock> lock(m_mutex);
+ if (m_pushScheduled)
+ pushListingsNow();
+ });
+}
+
+#pragma mark - Update Listing with lock
+
+void RemoteInspector::updateTargetListing(unsigned targetIdentifier)
+{
+ auto target = m_targetMap.get(targetIdentifier);
+ if (!target)
+ return;
+
+ updateTargetListing(*target);
+}
+
+void RemoteInspector::updateTargetListing(const RemoteControllableTarget& target)
+{
+ RetainPtr<NSDictionary> targetListing = listingForTarget(target);
+ if (!targetListing)
+ return;
+
+ m_targetListingMap.set(target.targetIdentifier(), targetListing);
+}
+
+#pragma mark - Active Debugger Sessions
+
+void RemoteInspector::updateHasActiveDebugSession()
+{
+ bool hasActiveDebuggerSession = !m_targetConnectionMap.isEmpty();
+ if (hasActiveDebuggerSession == m_hasActiveDebugSession)
+ return;
+
+ m_hasActiveDebugSession = hasActiveDebuggerSession;
+
+ // FIXME: Expose some way to access this state in an embedder.
+ // Legacy iOS WebKit 1 had a notification. This will need to be smarter with WebKit2.
+}
+
+#pragma mark - Received XPC Messages
+
+void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo)
+{
+ unsigned targetIdentifier = [[userInfo objectForKey:WIRTargetIdentifierKey] unsignedIntegerValue];
+ if (!targetIdentifier)
+ return;
+
+ NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
+ if (!connectionIdentifier)
+ return;
+
+ NSString *sender = [userInfo objectForKey:WIRSenderKey];
+ if (!sender)
+ return;
+
+ if (m_targetConnectionMap.contains(targetIdentifier))
+ return;
+
+ auto findResult = m_targetMap.find(targetIdentifier);
+ if (findResult == m_targetMap.end())
+ return;
+
+ // Attempt to create a connection. This may fail if the page already has an inspector or if it disallows inspection.
+ RemoteControllableTarget* target = findResult->value;
+ auto connectionToTarget = adoptRef(*new RemoteConnectionToTarget(target, connectionIdentifier, sender));
+
+ if (is<RemoteInspectionTarget>(target)) {
+ bool isAutomaticInspection = m_automaticInspectionCandidateTargetIdentifier == target->targetIdentifier();
+ bool automaticallyPause = [[userInfo objectForKey:WIRAutomaticallyPause] boolValue];
+
+ if (!connectionToTarget->setup(isAutomaticInspection, automaticallyPause)) {
+ connectionToTarget->close();
+ return;
+ }
+ m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
+ } else if (is<RemoteAutomationTarget>(target)) {
+ if (!connectionToTarget->setup()) {
+ connectionToTarget->close();
+ return;
+ }
+ m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
+ } else
+ ASSERT_NOT_REACHED();
+
+ updateHasActiveDebugSession();
+ updateTargetListing(*target);
+ pushListingsSoon();
+}
+
+void RemoteInspector::receivedDataMessage(NSDictionary *userInfo)
+{
+ unsigned targetIdentifier = [[userInfo objectForKey:WIRTargetIdentifierKey] unsignedIntegerValue];
+ if (!targetIdentifier)
+ return;
+
+ auto connectionToTarget = m_targetConnectionMap.get(targetIdentifier);
+ if (!connectionToTarget)
+ return;
+
+ NSData *data = [userInfo objectForKey:WIRSocketDataKey];
+ RetainPtr<NSString> message = adoptNS([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
+ connectionToTarget->sendMessageToTarget(message.get());
+}
+
+void RemoteInspector::receivedDidCloseMessage(NSDictionary *userInfo)
+{
+ unsigned targetIdentifier = [[userInfo objectForKey:WIRTargetIdentifierKey] unsignedIntegerValue];
+ if (!targetIdentifier)
+ return;
+
+ NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
+ if (!connectionIdentifier)
+ return;
+
+ auto connectionToTarget = m_targetConnectionMap.get(targetIdentifier);
+ if (!connectionToTarget)
+ return;
+
+ if (![connectionIdentifier isEqualToString:connectionToTarget->connectionIdentifier()])
+ return;
+
+ connectionToTarget->close();
+ m_targetConnectionMap.remove(targetIdentifier);
+
+ updateHasActiveDebugSession();
+ updateTargetListing(targetIdentifier);
+ pushListingsSoon();
+}
+
+void RemoteInspector::receivedGetListingMessage(NSDictionary *)
+{
+ pushListingsNow();
+}
+
+void RemoteInspector::receivedIndicateMessage(NSDictionary *userInfo)
+{
+ unsigned identifier = [[userInfo objectForKey:WIRTargetIdentifierKey] unsignedIntegerValue];
+ if (!identifier)
+ return;
+
+ BOOL indicateEnabled = [[userInfo objectForKey:WIRIndicateEnabledKey] boolValue];
+
+ callOnWebThreadOrDispatchAsyncOnMainThread(^{
+ RemoteControllableTarget* target = nullptr;
+ {
+ std::lock_guard<Lock> lock(m_mutex);
+
+ auto findResult = m_targetMap.find(identifier);
+ if (findResult == m_targetMap.end())
+ return;
+
+ target = findResult->value;
+ }
+ if (is<RemoteInspectionTarget>(target))
+ downcast<RemoteInspectionTarget>(target)->setIndicating(indicateEnabled);
+ });
+}
+
+void RemoteInspector::receivedProxyApplicationSetupMessage(NSDictionary *)
+{
+ ASSERT(m_relayConnection);
+ if (!m_relayConnection)
+ return;
+
+ if (!m_parentProcessIdentifier || !m_parentProcessAuditData) {
+ // We are a proxy application without parent process information.
+ // Wait a bit for the information, but give up after a second.
+ m_shouldSendParentProcessInformation = true;
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ std::lock_guard<Lock> lock(m_mutex);
+ if (m_shouldSendParentProcessInformation)
+ stopInternal(StopSource::XPCMessage);
+ });
+ return;
+ }
+
+ m_shouldSendParentProcessInformation = false;
+
+ m_relayConnection->sendMessage(WIRProxyApplicationSetupResponseMessage, @{
+ WIRProxyApplicationParentPIDKey: @(m_parentProcessIdentifier),
+ WIRProxyApplicationParentAuditDataKey: (NSData *)m_parentProcessAuditData.get(),
+ });
+}
+
+void RemoteInspector::receivedConnectionDiedMessage(NSDictionary *userInfo)
+{
+ NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
+ if (!connectionIdentifier)
+ return;
+
+ auto it = m_targetConnectionMap.begin();
+ auto end = m_targetConnectionMap.end();
+ for (; it != end; ++it) {
+ if ([connectionIdentifier isEqualToString:it->value->connectionIdentifier()])
+ break;
+ }
+
+ if (it == end)
+ return;
+
+ auto connection = it->value;
+ unsigned targetIdentifier = connection->targetIdentifier().value_or(0);
+ connection->close();
+ m_targetConnectionMap.remove(it);
+
+ updateHasActiveDebugSession();
+ updateTargetListing(targetIdentifier);
+ pushListingsSoon();
+}
+
+void RemoteInspector::receivedAutomaticInspectionConfigurationMessage(NSDictionary *userInfo)
+{
+ m_automaticInspectionEnabled = [[userInfo objectForKey:WIRAutomaticInspectionEnabledKey] boolValue];
+
+ if (!m_automaticInspectionEnabled && m_automaticInspectionPaused)
+ m_automaticInspectionPaused = false;
+}
+
+void RemoteInspector::receivedAutomaticInspectionRejectMessage(NSDictionary *userInfo)
+{
+ unsigned rejectionIdentifier = [[userInfo objectForKey:WIRTargetIdentifierKey] unsignedIntValue];
+
+ ASSERT(rejectionIdentifier == m_automaticInspectionCandidateTargetIdentifier);
+ if (rejectionIdentifier == m_automaticInspectionCandidateTargetIdentifier)
+ m_automaticInspectionPaused = false;
+}
+
+void RemoteInspector::receivedAutomationSessionRequestMessage(NSDictionary *userInfo)
+{
+ if (!m_client)
+ return;
+
+ if (!m_clientCapabilities || !m_clientCapabilities->remoteAutomationAllowed)
+ return;
+
+ NSString *suggestedSessionIdentifier = [userInfo objectForKey:WIRSessionIdentifierKey];
+ if (!suggestedSessionIdentifier)
+ return;
+
+ m_client->requestAutomationSession(suggestedSessionIdentifier);
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionhfromrev212168trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h (from rev 212168, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h) (0 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h         (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2013 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.
+ */
+
+#pragma once
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import <dispatch/dispatch.h>
+#import <wtf/Lock.h>
+#import <wtf/ThreadSafeRefCounted.h>
+#import <wtf/spi/darwin/XPCSPI.h>
+
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSString;
+
+namespace Inspector {
+
+class RemoteInspectorXPCConnection : public ThreadSafeRefCounted<RemoteInspectorXPCConnection> {
+public:
+ class Client {
+ public:
+ virtual ~Client() { }
+ virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) = 0;
+ virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) = 0;
+ virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) = 0;
+ };
+
+ RemoteInspectorXPCConnection(xpc_connection_t, dispatch_queue_t, Client*);
+ virtual ~RemoteInspectorXPCConnection();
+
+ void close();
+ void closeFromMessage();
+ void sendMessage(NSString *messageName, NSDictionary *userInfo);
+
+private:
+ NSDictionary *deserializeMessage(xpc_object_t);
+ void handleEvent(xpc_object_t);
+ void closeOnQueue();
+
+ // We handle XPC events on the queue, but a client may call close() on any queue.
+ // We make sure that m_client is thread safe and immediately cleared in close().
+ Lock m_mutex;
+
+ xpc_connection_t m_connection;
+ dispatch_queue_t m_queue;
+ Client* m_client;
+ bool m_closed { false };
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+ bool m_validated { false };
+#endif
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionmmfromrev212168trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorXPCConnectionmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm (from rev 212168, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm) (0 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm         (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.mm        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -0,0 +1,222 @@
</span><ins>+/*
+ * Copyright (C) 2013 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.
+ */
+
+#import "config.h"
+#import "RemoteInspectorXPCConnection.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import <Foundation/Foundation.h>
+#import <mutex>
+#import <wtf/Assertions.h>
+#import <wtf/Lock.h>
+#import <wtf/Ref.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/spi/cocoa/SecuritySPI.h>
+#import <wtf/spi/darwin/XPCSPI.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <CoreFoundation/CFXPCBridge.h>
+#else
+extern "C" {
+ xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef);
+ CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t);
+}
+#endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+static bool auditTokenHasEntitlement(audit_token_t token, NSString *entitlement)
+{
+ auto task = adoptCF(SecTaskCreateWithAuditToken(kCFAllocatorDefault, token));
+ if (!task)
+ return false;
+
+ auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), (CFStringRef)entitlement, nullptr));
+ if (!value)
+ return false;
+
+ if (CFGetTypeID(value.get()) != CFBooleanGetTypeID())
+ return false;
+
+ return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get()));
+}
+#endif
+
+namespace Inspector {
+
+// Constants private to this file for message serialization on both ends.
+#define RemoteInspectorXPCConnectionMessageNameKey @"messageName"
+#define RemoteInspectorXPCConnectionUserInfoKey @"userInfo"
+#define RemoteInspectorXPCConnectionSerializedMessageKey "msgData"
+
+RemoteInspectorXPCConnection::RemoteInspectorXPCConnection(xpc_connection_t connection, dispatch_queue_t queue, Client* client)
+ : m_connection(connection)
+ , m_queue(queue)
+ , m_client(client)
+{
+ dispatch_retain(m_queue);
+
+ xpc_retain(m_connection);
+ xpc_connection_set_target_queue(m_connection, m_queue);
+ xpc_connection_set_event_handler(m_connection, ^(xpc_object_t object) {
+ handleEvent(object);
+ });
+
+ // Balanced by deref when the xpc_connection receives XPC_ERROR_CONNECTION_INVALID.
+ ref();
+
+ xpc_connection_resume(m_connection);
+}
+
+RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection()
+{
+ ASSERT(!m_client);
+ ASSERT(!m_connection);
+ ASSERT(m_closed);
+}
+
+void RemoteInspectorXPCConnection::close()
+{
+ std::lock_guard<Lock> lock(m_mutex);
+ closeFromMessage();
+}
+
+void RemoteInspectorXPCConnection::closeFromMessage()
+{
+ m_closed = true;
+ m_client = nullptr;
+
+ dispatch_async(m_queue, ^{
+ std::lock_guard<Lock> lock(m_mutex);
+ // This will trigger one last XPC_ERROR_CONNECTION_INVALID event on the queue and deref us.
+ closeOnQueue();
+ });
+}
+
+void RemoteInspectorXPCConnection::closeOnQueue()
+{
+ if (m_connection) {
+ xpc_connection_cancel(m_connection);
+ xpc_release(m_connection);
+ m_connection = nullptr;
+ }
+
+ if (m_queue) {
+ dispatch_release(m_queue);
+ m_queue = nullptr;
+ }
+}
+
+NSDictionary *RemoteInspectorXPCConnection::deserializeMessage(xpc_object_t object)
+{
+ if (xpc_get_type(object) != XPC_TYPE_DICTIONARY)
+ return nil;
+
+ xpc_object_t xpcDictionary = xpc_dictionary_get_value(object, RemoteInspectorXPCConnectionSerializedMessageKey);
+ if (!xpcDictionary || xpc_get_type(xpcDictionary) != XPC_TYPE_DICTIONARY) {
+ std::lock_guard<Lock> lock(m_mutex);
+ if (m_client)
+ m_client->xpcConnectionUnhandledMessage(this, object);
+ return nil;
+ }
+
+ RetainPtr<CFDictionaryRef> dictionary = adoptCF((CFDictionaryRef)_CFXPCCreateCFObjectFromXPCMessage(xpcDictionary));
+ ASSERT_WITH_MESSAGE(dictionary, "Unable to deserialize xpc message");
+ return (NSDictionary *)dictionary.autorelease();
+}
+
+void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object)
+{
+ if (xpc_get_type(object) == XPC_TYPE_ERROR) {
+ {
+ std::lock_guard<Lock> lock(m_mutex);
+ if (m_client)
+ m_client->xpcConnectionFailed(this);
+
+ m_closed = true;
+ m_client = nullptr;
+ closeOnQueue();
+ }
+
+ if (object == XPC_ERROR_CONNECTION_INVALID) {
+ // This is the last event we will ever receive from the connection.
+ // This balances the ref() in the constructor.
+ deref();
+ }
+ return;
+ }
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+ if (!m_validated) {
+ audit_token_t token;
+ xpc_connection_get_audit_token(m_connection, &token);
+ if (!auditTokenHasEntitlement(token, @"com.apple.private.webinspector.webinspectord")) {
+ std::lock_guard<Lock> lock(m_mutex);
+ // This will trigger one last XPC_ERROR_CONNECTION_INVALID event on the queue and deref us.
+ closeOnQueue();
+ return;
+ }
+ m_validated = true;
+ }
+#endif
+
+ NSDictionary *dataDictionary = deserializeMessage(object);
+ if (!dataDictionary)
+ return;
+
+ NSString *message = [dataDictionary objectForKey:RemoteInspectorXPCConnectionMessageNameKey];
+ NSDictionary *userInfo = [dataDictionary objectForKey:RemoteInspectorXPCConnectionUserInfoKey];
+ std::lock_guard<Lock> lock(m_mutex);
+ if (m_client)
+ m_client->xpcConnectionReceivedMessage(this, message, userInfo);
+}
+
+void RemoteInspectorXPCConnection::sendMessage(NSString *messageName, NSDictionary *userInfo)
+{
+ ASSERT(!m_closed);
+ if (m_closed)
+ return;
+
+ NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObject:messageName forKey:RemoteInspectorXPCConnectionMessageNameKey];
+ if (userInfo)
+ [dictionary setObject:userInfo forKey:RemoteInspectorXPCConnectionUserInfoKey];
+
+ xpc_object_t xpcDictionary = _CFXPCCreateXPCMessageWithCFObject((CFDictionaryRef)dictionary);
+ ASSERT_WITH_MESSAGE(xpcDictionary && xpc_get_type(xpcDictionary) == XPC_TYPE_DICTIONARY, "Unable to serialize xpc message");
+ if (!xpcDictionary)
+ return;
+
+ xpc_object_t msg = xpc_dictionary_create(nullptr, nullptr, 0);
+ xpc_dictionary_set_value(msg, RemoteInspectorXPCConnectionSerializedMessageKey, xpcDictionary);
+ xpc_release(xpcDictionary);
+
+ xpc_connection_send_message(m_connection, msg);
+
+ xpc_release(msg);
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-02-15 Alex Christensen <achristensen@webkit.org>
+
+ Unreviewed, rolling out r212169.
+
+ Broke iOS WebInspector
+
+ Reverted changeset:
+
+ "WebInspector: refactor RemoteInspector to move cocoa specific
+ code to their own files"
+ https://bugs.webkit.org/show_bug.cgi?id=166681
+ http://trac.webkit.org/changeset/212169
+
</ins><span class="cx"> 2017-02-15 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Modernize DragClient::startDrag somewhat
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -370,7 +370,7 @@
</span><span class="cx"> setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices, parameters.hasRichContentServices);
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if ENABLE(REMOTE_INSPECTOR) && PLATFORM(COCOA)
</del><ins>+#if ENABLE(REMOTE_INSPECTOR)
</ins><span class="cx"> audit_token_t auditToken;
</span><span class="cx"> if (parentProcessConnection()->getAuditToken(auditToken)) {
</span><span class="cx"> RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (212393 => 212394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-15 21:50:10 UTC (rev 212393)
+++ trunk/Tools/ChangeLog        2017-02-15 22:31:07 UTC (rev 212394)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-02-15 Alex Christensen <achristensen@webkit.org>
+
+ Unreviewed, rolling out r212169.
+
+ Broke iOS WebInspector
+
+ Reverted changeset:
+
+ "WebInspector: refactor RemoteInspector to move cocoa specific
+ code to their own files"
+ https://bugs.webkit.org/show_bug.cgi?id=166681
+ http://trac.webkit.org/changeset/212169
+
</ins><span class="cx"> 2017-02-15 Jonathan Bedard <jbedard@apple.com>
</span><span class="cx">
</span><span class="cx"> webkitpy: Fix DarwinPort._get_crash_log()
</span><span class="cx">Index: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch
</span><span class="cx">===================================================================
</span><del>--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch        2017-02-15 21:50:10 UTC (rev 212393)
</del><ins>+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch        2017-02-15 22:31:07 UTC (rev 212394)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpybenchmark_runnerdatapatchesAnimometerpatch"></a>
<div class="propset"><h4>Property changes: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="delfile"><h4>Deleted: svn:mergeinfo</h4></div>
<del>-/trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch:53455
</del><span class="cx">\ No newline at end of property
</span></div>
</body>
</html>