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

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

<h3>Log Message</h3>
<pre>Web Inspector: RemoteInspector should track targets and connections for remote automation
https://bugs.webkit.org/show_bug.cgi?id=151042

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Refactor RemoteInspector so it can be used to send listings of different target types.
First, rename Debuggable to RemoteInspectionTarget, and pull things not specific to
remote inspection into the base class RemoteControllableTarget and its Connection class.

Add a new RemoteControllableTarget called RemoteAutomationTarget, used by UIProcess
to support remote UI automation via webinspectord. On the protocol side, this target
uses a new WIRTypeKey called WIRTypeAutomation to distiguish the listing from
Web and JavaScript listings and avoid inventing a new listing mechanism.

* API/JSContextRef.cpp:
(JSGlobalContextGetDebuggerRunLoop):
(JSGlobalContextSetDebuggerRunLoop):
* JavaScriptCore.xcodeproj/project.pbxproj:
* inspector/InspectorFrontendChannel.h:
* inspector/remote/RemoteAutomationTarget.cpp: Added.
(Inspector::RemoteAutomationTarget::setAutomationAllowed): Added.
* inspector/remote/RemoteAutomationTarget.h: Added.
* inspector/remote/RemoteConnectionToTarget.h: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h.
(Inspector::RemoteTargetBlock::RemoteTargetBlock):
(Inspector::RemoteTargetBlock::~RemoteTargetBlock):
(Inspector::RemoteTargetBlock::operator=):
(Inspector::RemoteTargetBlock::operator()):
* inspector/remote/RemoteConnectionToTarget.mm: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm.
(Inspector::RemoteTargetHandleRunSourceGlobal):
(Inspector::RemoteTargetQueueTaskOnGlobalQueue):
(Inspector::RemoteTargetInitializeGlobalQueue):
(Inspector::RemoteTargetHandleRunSourceWithInfo):
(Inspector::RemoteConnectionToTarget::RemoteConnectionToTarget):
(Inspector::RemoteConnectionToTarget::~RemoteConnectionToTarget):
(Inspector::RemoteConnectionToTarget::destination):
(Inspector::RemoteConnectionToTarget::connectionIdentifier):
(Inspector::RemoteConnectionToTarget::dispatchAsyncOnTarget):
(Inspector::RemoteConnectionToTarget::setup):
(Inspector::RemoteConnectionToTarget::targetClosed):
(Inspector::RemoteConnectionToTarget::close):
(Inspector::RemoteConnectionToTarget::sendMessageToTarget):
(Inspector::RemoteConnectionToTarget::sendMessageToFrontend):
(Inspector::RemoteConnectionToTarget::setupRunLoop):
(Inspector::RemoteConnectionToTarget::teardownRunLoop):
(Inspector::RemoteConnectionToTarget::queueTaskOnPrivateRunLoop):
* inspector/remote/RemoteControllableTarget.cpp: Added.
(Inspector::RemoteControllableTarget::~RemoteControllableTarget):
(Inspector::RemoteControllableTarget::init):
(Inspector::RemoteControllableTarget::update):
* inspector/remote/RemoteControllableTarget.h: Added.
* inspector/remote/RemoteInspectionTarget.cpp: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp.
(Inspector::RemoteInspectionTarget::remoteControlAllowed):
(Inspector::RemoteInspectionTarget::setRemoteDebuggingAllowed):
(Inspector::RemoteInspectionTarget::pauseWaitingForAutomaticInspection):
(Inspector::RemoteInspectionTarget::unpauseForInitializedInspector):
* inspector/remote/RemoteInspectionTarget.h: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h.
(isType):
* inspector/remote/RemoteInspector.h:

    Code to manage Debuggables now works with RemoteControllableTargets and doesn't
    care whether the target is for Inspection or Automation. Listing data with target-
    and type-specific information are captured when clients call into RemoteInspector
    since that's the easiest time to gather this information on the right thread.
    Use the is&lt;&gt; / downcast&lt;&gt; machinery when we need a concrete Target type.

* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::nextAvailableIdentifier):
(Inspector::RemoteInspector::registerTarget): renamed from registerDebuggable.
(Inspector::RemoteInspector::unregisterTarget): renamed from unregisterDebuggable.
(Inspector::RemoteInspector::updateTarget): renamed from updateDebuggable.
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
(Inspector::RemoteInspector::sendMessageToRemote):
(Inspector::RemoteInspector::setupFailed):
(Inspector::RemoteInspector::stopInternal):
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
(Inspector::RemoteInspector::xpcConnectionFailed):
(Inspector::RemoteInspector::listingForTarget):
(Inspector::RemoteInspector::listingForInspectionTarget):
(Inspector::RemoteInspector::listingForAutomationTarget):
(Inspector::RemoteInspector::pushListingsNow):
(Inspector::RemoteInspector::pushListingsSoon):
(Inspector::RemoteInspector::receivedSetupMessage):
(Inspector::RemoteInspector::receivedDataMessage):
(Inspector::RemoteInspector::receivedDidCloseMessage):
(Inspector::RemoteInspector::receivedGetListingMessage):
(Inspector::RemoteInspector::receivedIndicateMessage):
(Inspector::RemoteInspector::receivedConnectionDiedMessage):
(Inspector::RemoteInspector::RemoteInspector): Deleted.
(Inspector::RemoteInspector::registerDebuggable): Deleted.
(Inspector::RemoteInspector::unregisterDebuggable): Deleted.
(Inspector::RemoteInspector::updateDebuggable): Deleted.
(Inspector::RemoteInspector::updateDebuggableAutomaticInspectCandidate): Deleted.
(Inspector::RemoteInspector::sendMessageToRemoteFrontend): Deleted.
(Inspector::RemoteInspector::listingForDebuggable): Deleted.
(Inspector::RemoteInspector::pushListingNow): Deleted.
(Inspector::RemoteInspector::pushListingSoon): Deleted.
* inspector/remote/RemoteInspectorConstants.h:
* runtime/JSGlobalObjectDebuggable.cpp:
(JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemote):
(JSC::JSGlobalObjectDebuggable::pauseWaitingForAutomaticInspection):
(JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend): Deleted.
* runtime/JSGlobalObjectDebuggable.h:

Source/WebCore:

Use the new RemoteControllableTarget API method names.

No new tests, no behavior change.

* page/PageDebuggable.cpp:
(WebCore::PageDebuggable::connect):
(WebCore::PageDebuggable::dispatchMessageFromRemote):
(WebCore::PageDebuggable::dispatchMessageFromRemoteFrontend): Deleted.
* page/PageDebuggable.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSContextRefcpp">trunk/Source/JavaScriptCore/API/JSContextRef.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="#trunkSourceJavaScriptCoreinspectorInspectorFrontendChannelh">trunk/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorConstantsh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggablecpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggableh">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagePageDebuggablecpp">trunk/Source/WebCore/page/PageDebuggable.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageDebuggableh">trunk/Source/WebCore/page/PageDebuggable.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteAutomationTargetcpp">trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteAutomationTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargetmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteControllableTargetcpp">trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteControllableTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectionTargetcpp">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectionTargeth">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSContextRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSContextRef.cpp (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSContextRef.cpp        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/API/JSContextRef.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx">     ExecState* exec = toJS(ctx);
</span><span class="cx">     JSLockHolder lock(exec);
</span><span class="cx"> 
</span><del>-    return exec-&gt;vmEntryGlobalObject()-&gt;inspectorDebuggable().debuggerRunLoop();
</del><ins>+    return exec-&gt;vmEntryGlobalObject()-&gt;inspectorDebuggable().targetRunLoop();
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(ctx);
</span><span class="cx">     return nullptr;
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx">     ExecState* exec = toJS(ctx);
</span><span class="cx">     JSLockHolder lock(exec);
</span><span class="cx"> 
</span><del>-    exec-&gt;vmEntryGlobalObject()-&gt;inspectorDebuggable().setDebuggerRunLoop(runLoop);
</del><ins>+    exec-&gt;vmEntryGlobalObject()-&gt;inspectorDebuggable().setTargetRunLoop(runLoop);
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(ctx);
</span><span class="cx">     UNUSED_PARAM(runLoop);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,3 +1,108 @@
</span><ins>+2015-11-20  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Inspector: RemoteInspector should track targets and connections for remote automation
+        https://bugs.webkit.org/show_bug.cgi?id=151042
+
+        Reviewed by Joseph Pecoraro.
+
+        Refactor RemoteInspector so it can be used to send listings of different target types.
+        First, rename Debuggable to RemoteInspectionTarget, and pull things not specific to
+        remote inspection into the base class RemoteControllableTarget and its Connection class.
+
+        Add a new RemoteControllableTarget called RemoteAutomationTarget, used by UIProcess
+        to support remote UI automation via webinspectord. On the protocol side, this target
+        uses a new WIRTypeKey called WIRTypeAutomation to distiguish the listing from
+        Web and JavaScript listings and avoid inventing a new listing mechanism.
+
+        * API/JSContextRef.cpp:
+        (JSGlobalContextGetDebuggerRunLoop):
+        (JSGlobalContextSetDebuggerRunLoop):
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorFrontendChannel.h:
+        * inspector/remote/RemoteAutomationTarget.cpp: Added.
+        (Inspector::RemoteAutomationTarget::setAutomationAllowed): Added.
+        * inspector/remote/RemoteAutomationTarget.h: Added.
+        * inspector/remote/RemoteConnectionToTarget.h: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h.
+        (Inspector::RemoteTargetBlock::RemoteTargetBlock):
+        (Inspector::RemoteTargetBlock::~RemoteTargetBlock):
+        (Inspector::RemoteTargetBlock::operator=):
+        (Inspector::RemoteTargetBlock::operator()):
+        * inspector/remote/RemoteConnectionToTarget.mm: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm.
+        (Inspector::RemoteTargetHandleRunSourceGlobal):
+        (Inspector::RemoteTargetQueueTaskOnGlobalQueue):
+        (Inspector::RemoteTargetInitializeGlobalQueue):
+        (Inspector::RemoteTargetHandleRunSourceWithInfo):
+        (Inspector::RemoteConnectionToTarget::RemoteConnectionToTarget):
+        (Inspector::RemoteConnectionToTarget::~RemoteConnectionToTarget):
+        (Inspector::RemoteConnectionToTarget::destination):
+        (Inspector::RemoteConnectionToTarget::connectionIdentifier):
+        (Inspector::RemoteConnectionToTarget::dispatchAsyncOnTarget):
+        (Inspector::RemoteConnectionToTarget::setup):
+        (Inspector::RemoteConnectionToTarget::targetClosed):
+        (Inspector::RemoteConnectionToTarget::close):
+        (Inspector::RemoteConnectionToTarget::sendMessageToTarget):
+        (Inspector::RemoteConnectionToTarget::sendMessageToFrontend):
+        (Inspector::RemoteConnectionToTarget::setupRunLoop):
+        (Inspector::RemoteConnectionToTarget::teardownRunLoop):
+        (Inspector::RemoteConnectionToTarget::queueTaskOnPrivateRunLoop):
+        * inspector/remote/RemoteControllableTarget.cpp: Added.
+        (Inspector::RemoteControllableTarget::~RemoteControllableTarget):
+        (Inspector::RemoteControllableTarget::init):
+        (Inspector::RemoteControllableTarget::update):
+        * inspector/remote/RemoteControllableTarget.h: Added.
+        * inspector/remote/RemoteInspectionTarget.cpp: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp.
+        (Inspector::RemoteInspectionTarget::remoteControlAllowed):
+        (Inspector::RemoteInspectionTarget::setRemoteDebuggingAllowed):
+        (Inspector::RemoteInspectionTarget::pauseWaitingForAutomaticInspection):
+        (Inspector::RemoteInspectionTarget::unpauseForInitializedInspector):
+        * inspector/remote/RemoteInspectionTarget.h: Renamed from Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h.
+        (isType):
+        * inspector/remote/RemoteInspector.h:
+
+            Code to manage Debuggables now works with RemoteControllableTargets and doesn't
+            care whether the target is for Inspection or Automation. Listing data with target-
+            and type-specific information are captured when clients call into RemoteInspector
+            since that's the easiest time to gather this information on the right thread.
+            Use the is&lt;&gt; / downcast&lt;&gt; machinery when we need a concrete Target type.
+
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::nextAvailableIdentifier):
+        (Inspector::RemoteInspector::registerTarget): renamed from registerDebuggable.
+        (Inspector::RemoteInspector::unregisterTarget): renamed from unregisterDebuggable.
+        (Inspector::RemoteInspector::updateTarget): renamed from updateDebuggable.
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
+        (Inspector::RemoteInspector::sendMessageToRemote):
+        (Inspector::RemoteInspector::setupFailed):
+        (Inspector::RemoteInspector::stopInternal):
+        (Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
+        (Inspector::RemoteInspector::xpcConnectionFailed):
+        (Inspector::RemoteInspector::listingForTarget):
+        (Inspector::RemoteInspector::listingForInspectionTarget):
+        (Inspector::RemoteInspector::listingForAutomationTarget):
+        (Inspector::RemoteInspector::pushListingsNow):
+        (Inspector::RemoteInspector::pushListingsSoon):
+        (Inspector::RemoteInspector::receivedSetupMessage):
+        (Inspector::RemoteInspector::receivedDataMessage):
+        (Inspector::RemoteInspector::receivedDidCloseMessage):
+        (Inspector::RemoteInspector::receivedGetListingMessage):
+        (Inspector::RemoteInspector::receivedIndicateMessage):
+        (Inspector::RemoteInspector::receivedConnectionDiedMessage):
+        (Inspector::RemoteInspector::RemoteInspector): Deleted.
+        (Inspector::RemoteInspector::registerDebuggable): Deleted.
+        (Inspector::RemoteInspector::unregisterDebuggable): Deleted.
+        (Inspector::RemoteInspector::updateDebuggable): Deleted.
+        (Inspector::RemoteInspector::updateDebuggableAutomaticInspectCandidate): Deleted.
+        (Inspector::RemoteInspector::sendMessageToRemoteFrontend): Deleted.
+        (Inspector::RemoteInspector::listingForDebuggable): Deleted.
+        (Inspector::RemoteInspector::pushListingNow): Deleted.
+        (Inspector::RemoteInspector::pushListingSoon): Deleted.
+        * inspector/remote/RemoteInspectorConstants.h:
+        * runtime/JSGlobalObjectDebuggable.cpp:
+        (JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemote):
+        (JSC::JSGlobalObjectDebuggable::pauseWaitingForAutomaticInspection):
+        (JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend): Deleted.
+        * runtime/JSGlobalObjectDebuggable.h:
+
</ins><span class="cx"> 2015-11-23  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename JavaScriptCore builtins files to match exposed object names
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1376,6 +1376,7 @@
</span><span class="cx">                 978801411471AD920041B016 /* JSDateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 9788FC231471AD0C0068CE2D /* JSDateMath.h */; settings = {ATTRIBUTES = (Private, ); }; };
</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><ins>+                992ABCF91BEA9BD2006403A0 /* RemoteAutomationTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 992ABCF51BEA94CA006403A0 /* RemoteAutomationTarget.cpp */; };
</ins><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">@@ -1400,8 +1401,11 @@
</span><span class="cx">                 996B73261BDA08EF00331B84 /* StringIteratorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */; };
</span><span class="cx">                 996B73271BDA08EF00331B84 /* SymbolConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */; };
</span><span class="cx">                 996B73281BDA08EF00331B84 /* SymbolPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */; };
</span><ins>+                998ED6741BED70AC00DD8017 /* RemoteControllableTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 998ED6721BED659A00DD8017 /* RemoteControllableTarget.cpp */; };
+                998ED6751BED768C00DD8017 /* RemoteControllableTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 99CC0B6218BE9946006CEBCC /* CodeGeneratorReplayInputsTemplates.py in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1E18A1B1E70026D88F /* CodeGeneratorReplayInputsTemplates.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 99CC0B6318BE9950006CEBCC /* CodeGeneratorReplayInputs.py in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1D18A1B1E70026D88F /* CodeGeneratorReplayInputs.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                99D6A1161BEAD34D00E25C37 /* RemoteAutomationTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 992ABCF61BEA94CA006403A0 /* RemoteAutomationTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 99DA00A31BD5993100F4575C /* builtins_generator.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009A1BD5992700F4575C /* builtins_generator.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 99DA00A41BD5993100F4575C /* builtins_model.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009B1BD5992700F4575C /* builtins_model.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 99DA00A51BD5993100F4575C /* builtins_templates.py in Headers */ = {isa = PBXBuildFile; fileRef = 99DA009C1BD5992700F4575C /* builtins_templates.py */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -1534,7 +1538,7 @@
</span><span class="cx">                 A593CF831840377100BFCE27 /* InspectorValues.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF811840377100BFCE27 /* InspectorValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A593CF86184038CA00BFCE27 /* InspectorAgentRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A593CF84184038CA00BFCE27 /* InspectorAgentRegistry.cpp */; };
</span><span class="cx">                 A593CF87184038CA00BFCE27 /* InspectorAgentRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF85184038CA00BFCE27 /* InspectorAgentRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */; };
</del><ins>+                A594558F18245EFD00CC3843 /* RemoteInspectionTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A594558E18245EDE00CC3843 /* RemoteInspectionTarget.cpp */; };
</ins><span class="cx">                 A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */; };
</span><span class="cx">                 A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */; };
</span><span class="cx">                 A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -1544,11 +1548,11 @@
</span><span class="cx">                 A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E1182340B300A82E69 /* RemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E2182340B300A82E69 /* RemoteInspector.mm */; };
</span><span class="cx">                 A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */; };
-                A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */; };
</del><ins>+                A5BA15EB182340B400A82E69 /* RemoteConnectionToTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E4182340B300A82E69 /* RemoteConnectionToTarget.h */; };
+                A5BA15EC182340B400A82E69 /* RemoteConnectionToTarget.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E5182340B300A82E69 /* RemoteConnectionToTarget.mm */; };
</ins><span class="cx">                 A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */; };
</span><del>-                A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                A5BA15F0182345AF00A82E69 /* RemoteInspectionTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectionTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><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="cx">                 A5CEEE14187F3BAD00E55C99 /* InspectorAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */; };
</span><span class="lines">@@ -3482,6 +3486,8 @@
</span><span class="cx">                 9928FF3918AC4AEC00B8CF12 /* JSReplayInputs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReplayInputs.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9928FF3A18AC4AEC00B8CF12 /* JSReplayInputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReplayInputs.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9928FF3D18AC4B1C00B8CF12 /* JSInputs.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = JSInputs.json; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                992ABCF51BEA94CA006403A0 /* RemoteAutomationTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteAutomationTarget.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                992ABCF61BEA94CA006403A0 /* RemoteAutomationTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteAutomationTarget.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 9959E9271BD17FA0001AA413 /* cssmin.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = cssmin.py; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9959E9291BD17FA0001AA413 /* jsmin.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = jsmin.py; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9959E92A1BD17FA0001AA413 /* xxd.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = xxd.pl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3503,6 +3509,8 @@
</span><span class="cx">                 996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayConstructor.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayIteratorPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                998ED6721BED659A00DD8017 /* RemoteControllableTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteControllableTarget.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteControllableTarget.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 99DA00991BD5992700F4575C /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 99DA009A1BD5992700F4575C /* builtins_generator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generator.py; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 99DA009B1BD5992700F4575C /* builtins_model.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_model.py; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3636,7 +3644,7 @@
</span><span class="cx">                 A593CF811840377100BFCE27 /* InspectorValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorValues.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A593CF84184038CA00BFCE27 /* InspectorAgentRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAgentRegistry.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A593CF85184038CA00BFCE27 /* InspectorAgentRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAgentRegistry.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteInspectorDebuggable.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                A594558E18245EDE00CC3843 /* RemoteInspectionTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteInspectionTarget.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectDebuggable.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectDebuggable.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendChannel.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3646,11 +3654,11 @@
</span><span class="cx">                 A5BA15E1182340B300A82E69 /* RemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5BA15E2182340B300A82E69 /* RemoteInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspector.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorConstants.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorDebuggableConnection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspectorDebuggableConnection.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                A5BA15E4182340B300A82E69 /* RemoteConnectionToTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteConnectionToTarget.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A5BA15E5182340B300A82E69 /* RemoteConnectionToTarget.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteConnectionToTarget.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorXPCConnection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteInspectorXPCConnection.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectorDebuggable.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                A5BA15EF182345AF00A82E69 /* RemoteInspectionTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteInspectionTarget.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A5C3A1A318C0490200C9593A /* JSGlobalObjectConsoleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectConsoleClient.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5C3A1A418C0490200C9593A /* JSGlobalObjectConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectConsoleClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5CEEE12187F3BAD00E55C99 /* InspectorAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAgent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6507,13 +6515,17 @@
</span><span class="cx">                 A5BA15E01823409D00A82E69 /* remote */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                992ABCF51BEA94CA006403A0 /* RemoteAutomationTarget.cpp */,
+                                992ABCF61BEA94CA006403A0 /* RemoteAutomationTarget.h */,
+                                A5BA15E4182340B300A82E69 /* RemoteConnectionToTarget.h */,
+                                A5BA15E5182340B300A82E69 /* RemoteConnectionToTarget.mm */,
+                                998ED6721BED659A00DD8017 /* RemoteControllableTarget.cpp */,
+                                998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */,
</ins><span class="cx">                                 A5BA15E1182340B300A82E69 /* RemoteInspector.h */,
</span><span class="cx">                                 A5BA15E2182340B300A82E69 /* RemoteInspector.mm */,
</span><span class="cx">                                 A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */,
</span><del>-                                A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */,
-                                A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */,
-                                A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */,
-                                A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */,
</del><ins>+                                A594558E18245EDE00CC3843 /* RemoteInspectionTarget.cpp */,
+                                A5BA15EF182345AF00A82E69 /* RemoteInspectionTarget.h */,
</ins><span class="cx">                                 A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */,
</span><span class="cx">                                 A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */,
</span><span class="cx">                         );
</span><span class="lines">@@ -6850,6 +6862,7 @@
</span><span class="cx">                                 0F620177143FCD3F0068B77C /* DFGAbstractValue.h in Headers */,
</span><span class="cx">                                 0FD3E4021B618AAF00C80E1E /* DFGAdaptiveInferredPropertyValueWatchpoint.h in Headers */,
</span><span class="cx">                                 0F18D3D01B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.h in Headers */,
</span><ins>+                                998ED6751BED768C00DD8017 /* RemoteControllableTarget.h in Headers */,
</ins><span class="cx">                                 0F66E16B14DF3F1600B7B2E4 /* DFGAdjacencyList.h in Headers */,
</span><span class="cx">                                 0FFB921816D02EB20055A5DB /* DFGAllocator.h in Headers */,
</span><span class="cx">                                 0F1E3A461534CBAF000F9456 /* DFGArgumentPosition.h in Headers */,
</span><span class="lines">@@ -6937,6 +6950,7 @@
</span><span class="cx">                                 A73A535B1799CD5D00170C19 /* DFGLazyJSValue.h in Headers */,
</span><span class="cx">                                 62F2AA381B0BEDE300610C7A /* DFGLazyNode.h in Headers */,
</span><span class="cx">                                 A7D9A29817A0BC7400EE2618 /* DFGLICMPhase.h in Headers */,
</span><ins>+                                99D6A1161BEAD34D00E25C37 /* RemoteAutomationTarget.h in Headers */,
</ins><span class="cx">                                 79C4B15E1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.h in Headers */,
</span><span class="cx">                                 A7D89CFC17A0B8CC00773AD8 /* DFGLivenessAnalysisPhase.h in Headers */,
</span><span class="cx">                                 0FF0F19B16B729FA005DF95B /* DFGLongLivedState.h in Headers */,
</span><span class="lines">@@ -7575,8 +7589,8 @@
</span><span class="cx">                                 0FB7F39D15ED8E4600F167B2 /* Reject.h in Headers */,
</span><span class="cx">                                 A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */,
</span><span class="cx">                                 A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
</span><del>-                                A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */,
-                                A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */,
</del><ins>+                                A5BA15F0182345AF00A82E69 /* RemoteInspectionTarget.h in Headers */,
+                                A5BA15EB182340B400A82E69 /* RemoteConnectionToTarget.h in Headers */,
</ins><span class="cx">                                 A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
</span><span class="cx">                                 0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
</span><span class="cx">                                 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
</span><span class="lines">@@ -8465,6 +8479,7 @@
</span><span class="cx">                                 0F2B9CE619D0BA7D00B1D1B5 /* DFGObjectAllocationSinkingPhase.cpp in Sources */,
</span><span class="cx">                                 0F2B9CE819D0BA7D00B1D1B5 /* DFGObjectMaterializationData.cpp in Sources */,
</span><span class="cx">                                 86EC9DCF1328DF82002B2AD7 /* DFGOperations.cpp in Sources */,
</span><ins>+                                998ED6741BED70AC00DD8017 /* RemoteControllableTarget.cpp in Sources */,
</ins><span class="cx">                                 A7D89CFD17A0B8CC00773AD8 /* DFGOSRAvailabilityAnalysisPhase.cpp in Sources */,
</span><span class="cx">                                 0FD82E56141DAF0800179C94 /* DFGOSREntry.cpp in Sources */,
</span><span class="cx">                                 0FD8A32517D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.cpp in Sources */,
</span><span class="lines">@@ -8884,8 +8899,8 @@
</span><span class="cx">                                 0FC3141518146D7000033232 /* RegisterSet.cpp in Sources */,
</span><span class="cx">                                 A57D23ED1891B5540031C7FA /* RegularExpression.cpp in Sources */,
</span><span class="cx">                                 A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */,
</span><del>-                                A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */,
-                                A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */,
</del><ins>+                                A594558F18245EFD00CC3843 /* RemoteInspectionTarget.cpp in Sources */,
+                                A5BA15EC182340B400A82E69 /* RemoteConnectionToTarget.mm in Sources */,
</ins><span class="cx">                                 A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */,
</span><span class="cx">                                 0F24E55017EE274900ABB217 /* Repatch.cpp in Sources */,
</span><span class="cx">                                 527773DE1AAF83AC00BDE7E8 /* RuntimeType.cpp in Sources */,
</span><span class="lines">@@ -8893,6 +8908,7 @@
</span><span class="cx">                                 1429D8850ED21C3D00B89619 /* SamplingTool.cpp in Sources */,
</span><span class="cx">                                 0FE050271AA9095600D33B33 /* ScopedArguments.cpp in Sources */,
</span><span class="cx">                                 0FE0502F1AAA806900D33B33 /* ScopedArgumentsTable.cpp in Sources */,
</span><ins>+                                992ABCF91BEA9BD2006403A0 /* RemoteAutomationTarget.cpp in Sources */,
</ins><span class="cx">                                 0FE0502A1AA9095600D33B33 /* ScopeOffset.cpp in Sources */,
</span><span class="cx">                                 0FA7A8EE18CE4FD80052371D /* ScratchRegisterAllocator.cpp in Sources */,
</span><span class="cx">                                 A5FD0067189AFE9C00633231 /* ScriptArguments.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInspectorFrontendChannelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -30,6 +30,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><ins>+// Represents a one-way connection from an Inspection or Automation target to
+// a local or remote controller (such as a debugger or UI automation script).
+
</ins><span class="cx"> class FrontendChannel {
</span><span class="cx"> public:
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteAutomationTargetcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;RemoteAutomationTarget.h&quot;
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include &quot;RemoteInspector.h&quot;
+
+namespace Inspector {
+
+void RemoteAutomationTarget::setAutomationAllowed(bool allowed)
+{
+    if (m_allowed == allowed)
+        return;
+
+    m_allowed = allowed;
+
+    update();
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteAutomationTargeth"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteAutomationTarget_h
+#define RemoteAutomationTarget_h
+
+#include &quot;RemoteControllableTarget.h&quot;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE RemoteAutomationTarget : public RemoteControllableTarget {
+public:
+    virtual ~RemoteAutomationTarget() { }
+
+    bool automationAllowed() const { return m_allowed; }
+    void setAutomationAllowed(bool);
+
+    virtual String name() const = 0;
+    virtual RemoteControllableTarget::Type type() const override { return RemoteControllableTarget::Type::Automation; }
+    virtual bool remoteControlAllowed() const override { return automationAllowed(); };
+
+private:
+    bool m_allowed { false };
+};
+
+} // namespace Inspector
+
+SPECIALIZE_TYPE_TRAITS_CONTROLLABLE_TARGET(Inspector::RemoteAutomationTarget, Automation)
+
+#endif // RemoteAutomationTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargethfromrev192752trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h (from rev 192752, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h) (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,132 @@
</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.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteConnectionToTarget_h
+#define RemoteConnectionToTarget_h
+
+#import &quot;InspectorFrontendChannel.h&quot;
+#import &quot;RemoteConnectionToTarget.h&quot;
+#import &quot;RemoteInspector.h&quot;
+#import &lt;mutex&gt;
+#import &lt;wtf/Lock.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+#import &lt;wtf/ThreadSafeRefCounted.h&gt;
+
+OBJC_CLASS NSString;
+
+namespace Inspector {
+
+class RemoteTargetBlock {
+public:
+    RemoteTargetBlock(void (^task)())
+        : m_task(Block_copy(task))
+    {
+    }
+
+    RemoteTargetBlock(const RemoteTargetBlock&amp; other)
+        : m_task(Block_copy(other.m_task))
+    {
+    }
+
+    ~RemoteTargetBlock()
+    {
+        Block_release(m_task);
+    }
+
+    RemoteTargetBlock&amp; operator=(const RemoteTargetBlock&amp; other)
+    {
+        void (^oldTask)() = m_task;
+        m_task = Block_copy(other.m_task);
+        Block_release(oldTask);
+        return *this;
+    }
+
+    void operator()() const
+    {
+        m_task();
+    }
+
+private:
+    void (^m_task)();
+};
+
+typedef Vector&lt;RemoteTargetBlock&gt; RemoteTargetQueue;
+
+class RemoteConnectionToTarget final : public ThreadSafeRefCounted&lt;RemoteConnectionToTarget&gt;, public FrontendChannel {
+public:
+    RemoteConnectionToTarget(RemoteControllableTarget*, NSString *connectionIdentifier, NSString *destination);
+    virtual ~RemoteConnectionToTarget();
+
+    // Main API.
+    bool setup(bool isAutomaticInspection = false, bool automaticallyPause = false);
+    virtual void sendMessageToTarget(NSString *);
+    virtual void close();
+    virtual void targetClosed();
+
+    unsigned identifier() const { return m_identifier; }
+    NSString *connectionIdentifier() const;
+    NSString *destination() const;
+
+    Lock&amp; queueMutex() { return m_queueMutex; }
+    RemoteTargetQueue queue() const { return m_queue; }
+    void clearQueue() { m_queue.clear(); }
+
+    // FrontendChannel overrides.
+    virtual ConnectionType connectionType() const override { return ConnectionType::Remote; }
+    virtual bool sendMessageToFrontend(const String&amp;) override;
+
+private:
+    void dispatchAsyncOnTarget(void (^block)());
+
+    void setupRunLoop();
+    void teardownRunLoop();
+    void queueTaskOnPrivateRunLoop(void (^block)());
+
+    // This connection from the RemoteInspector singleton to the InspectionTarget
+    // can be used on multiple threads. So any access to the target
+    // itself must take this mutex to ensure m_target is valid.
+    Lock m_targetMutex;
+
+    // If a target has a specific run loop it wants to evaluate on
+    // we setup our run loop sources on that specific run loop.
+    RetainPtr&lt;CFRunLoopRef&gt; m_runLoop;
+    RetainPtr&lt;CFRunLoopSourceRef&gt; m_runLoopSource;
+    RemoteTargetQueue m_queue;
+    Lock m_queueMutex;
+
+    RemoteControllableTarget* m_target { nullptr };
+    unsigned m_identifier { 0 };
+    RetainPtr&lt;NSString&gt; m_connectionIdentifier;
+    RetainPtr&lt;NSString&gt; m_destination;
+    bool m_connected { false };
+};
+
+} // namespace Inspector
+
+#endif // RemoteConnectionToTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteConnectionToTargetmmfromrev192752trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm (from rev 192752, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm) (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.mm        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,278 @@
</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 &quot;config.h&quot;
+#import &quot;RemoteConnectionToTarget.h&quot;
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import &quot;EventLoop.h&quot;
+#import &quot;RemoteAutomationTarget.h&quot;
+#import &quot;RemoteInspectionTarget.h&quot;
+#import &lt;dispatch/dispatch.h&gt;
+#import &lt;wtf/Vector.h&gt;
+
+#if PLATFORM(IOS)
+#import &lt;wtf/ios/WebCoreThread.h&gt;
+#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&lt;StaticLock&gt; lock(rwiQueueMutex);
+        queueCopy = *rwiQueue;
+        rwiQueue-&gt;clear();
+    }
+
+    for (const auto&amp; block : queueCopy)
+        block();
+}
+
+static void RemoteTargetQueueTaskOnGlobalQueue(void (^task)())
+{
+    ASSERT(rwiRunLoopSource);
+    ASSERT(rwiQueue);
+
+    {
+        std::lock_guard&lt;StaticLock&gt; lock(rwiQueueMutex);
+        rwiQueue-&gt;append(RemoteTargetBlock(task));
+    }
+
+    CFRunLoopSourceSignal(rwiRunLoopSource);
+    CFRunLoopWakeUp(CFRunLoopGetMain());
+}
+
+static void RemoteTargetInitializeGlobalQueue()
+{
+    static dispatch_once_t pred;
+    dispatch_once(&amp;pred, ^{
+        rwiQueue = new RemoteTargetQueue;
+
+        CFRunLoopSourceContext runLoopSourceContext = {0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, RemoteTargetHandleRunSourceGlobal};
+        rwiRunLoopSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 1, &amp;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 *connection = static_cast&lt;RemoteConnectionToTarget*&gt;(info);
+
+    RemoteTargetQueue queueCopy;
+    {
+        std::lock_guard&lt;Lock&gt; lock(connection-&gt;queueMutex());
+        queueCopy = connection-&gt;queue();
+        connection-&gt;clearQueue();
+    }
+
+    for (const auto&amp; block : queueCopy)
+        block();
+}
+
+
+RemoteConnectionToTarget::RemoteConnectionToTarget(RemoteControllableTarget* target, NSString *connectionIdentifier, NSString *destination)
+    : m_target(target)
+    , m_identifier(target-&gt;identifier())
+    , m_connectionIdentifier(connectionIdentifier)
+    , m_destination(destination)
+{
+    setupRunLoop();
+}
+
+RemoteConnectionToTarget::~RemoteConnectionToTarget()
+{
+    teardownRunLoop();
+}
+
+NSString *RemoteConnectionToTarget::destination() const
+{
+    return [[m_destination copy] autorelease];
+}
+
+NSString *RemoteConnectionToTarget::connectionIdentifier() const
+{
+    return [[m_connectionIdentifier copy] autorelease];
+}
+
+void RemoteConnectionToTarget::dispatchAsyncOnTarget(void (^block)())
+{
+    if (m_runLoop) {
+        queueTaskOnPrivateRunLoop(block);
+        return;
+    }
+
+#if PLATFORM(IOS)
+    if (WebCoreWebThreadIsEnabled &amp;&amp; WebCoreWebThreadIsEnabled()) {
+        WebCoreWebThreadRun(block);
+        return;
+    }
+#endif
+
+    RemoteTargetQueueTaskOnGlobalQueue(block);
+}
+
+bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automaticallyPause)
+{
+    std::lock_guard&lt;Lock&gt; lock(m_targetMutex);
+
+    if (!m_target)
+        return false;
+
+    ref();
+    dispatchAsyncOnTarget(^{
+        {
+            std::lock_guard&lt;Lock&gt; lock(m_targetMutex);
+            if (!m_target || !m_target-&gt;remoteControlAllowed()) {
+                RemoteInspector::singleton().setupFailed(m_identifier);
+                m_target = nullptr;
+            } else if (is&lt;RemoteInspectionTarget&gt;(m_target)) {
+                auto castedTarget = downcast&lt;RemoteInspectionTarget&gt;(m_target);
+                castedTarget-&gt;connect(this, isAutomaticInspection);
+                m_connected = true;
+
+                if (automaticallyPause)
+                    castedTarget-&gt;pause();
+            } else if (is&lt;RemoteAutomationTarget&gt;(m_target)) {
+                auto castedTarget = downcast&lt;RemoteAutomationTarget&gt;(m_target);
+                castedTarget-&gt;connect(this);
+                m_connected = true;
+            }
+        }
+        deref();
+    });
+
+    return true;
+}
+
+void RemoteConnectionToTarget::targetClosed()
+{
+    std::lock_guard&lt;Lock&gt; lock(m_targetMutex);
+
+    m_target = nullptr;
+}
+
+void RemoteConnectionToTarget::close()
+{
+    ref();
+    dispatchAsyncOnTarget(^{
+        {
+            std::lock_guard&lt;Lock&gt; lock(m_targetMutex);
+
+            if (m_target) {
+                if (m_connected)
+                    m_target-&gt;disconnect(this);
+
+                m_target = nullptr;
+            }
+        }
+        deref();
+    });
+}
+
+void RemoteConnectionToTarget::sendMessageToTarget(NSString *message)
+{
+    ref();
+    dispatchAsyncOnTarget(^{
+        {
+            RemoteControllableTarget* target = nullptr;
+            {
+                std::lock_guard&lt;Lock&gt; lock(m_targetMutex);
+                if (!m_target)
+                    return;
+                target = m_target;
+            }
+
+            target-&gt;dispatchMessageFromRemote(message);
+        }
+        deref();
+    });
+}
+
+bool RemoteConnectionToTarget::sendMessageToFrontend(const String&amp; message)
+{
+    RemoteInspector::singleton().sendMessageToRemote(identifier(), message);
+
+    return true;
+}
+
+void RemoteConnectionToTarget::setupRunLoop()
+{
+    CFRunLoopRef targetRunLoop = m_target-&gt;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, &amp;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&lt;Lock&gt; lock(m_queueMutex);
+        m_queue.append(RemoteTargetBlock(block));
+    }
+
+    CFRunLoopSourceSignal(m_runLoopSource.get());
+    CFRunLoopWakeUp(m_runLoop.get());
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteControllableTargetcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+/*
+ * Copyright (C) 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;RemoteControllableTarget.h&quot;
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include &quot;RemoteInspector.h&quot;
+
+namespace Inspector {
+
+RemoteControllableTarget::~RemoteControllableTarget()
+{
+    RemoteInspector::singleton().unregisterTarget(this);
+}
+
+void RemoteControllableTarget::init()
+{
+    RemoteInspector::singleton().registerTarget(this);
+}
+
+void RemoteControllableTarget::update()
+{
+    RemoteInspector::singleton().updateTarget(this);
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteControllableTargeth"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+/*
+ * Copyright (C) 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteControllableTarget_h
+#define RemoteControllableTarget_h
+
+#include &lt;CoreFoundation/CFRunLoop.h&gt;
+#include &lt;wtf/TypeCasts.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE RemoteControllableTarget {
+public:
+    virtual ~RemoteControllableTarget();
+
+    void init();
+    void update();
+
+    virtual void connect(FrontendChannel*, bool isAutomaticConnection = false) = 0;
+    virtual void disconnect(FrontendChannel*) = 0;
+
+    unsigned identifier() const { return m_identifier; }
+    void setIdentifier(unsigned identifier) { m_identifier = identifier; }
+
+    enum class Type { JavaScript, Web, Automation };
+    virtual Type type() const = 0;
+    virtual bool remoteControlAllowed() const = 0;
+    virtual void dispatchMessageFromRemote(const String&amp; message) = 0;
+
+    // The dispatch block will be scheduled on a global run loop if null is returned.
+    virtual CFRunLoopRef targetRunLoop() { return nullptr; }
+private:
+    unsigned m_identifier {0};
+};
+
+} // namespace Inspector
+
+#define SPECIALIZE_TYPE_TRAITS_CONTROLLABLE_TARGET(ToClassName, ToClassType) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(ToClassName) \
+    static bool isType(const Inspector::RemoteControllableTarget&amp; target) { return target.type() == Inspector::RemoteControllableTarget::Type::ToClassType; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // RemoteControllableTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectionTargetcppfromrev192752trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp (from rev 192752, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp) (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,72 @@
</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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;RemoteInspectionTarget.h&quot;
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include &quot;EventLoop.h&quot;
+#include &quot;RemoteInspector.h&quot;
+
+namespace Inspector {
+
+bool RemoteInspectionTarget::remoteControlAllowed() const
+{
+    return remoteDebuggingAllowed() || hasLocalDebugger();
+}
+
+void RemoteInspectionTarget::setRemoteDebuggingAllowed(bool allowed)
+{
+    if (m_allowed == allowed)
+        return;
+
+    m_allowed = allowed;
+
+    if (m_allowed &amp;&amp; automaticInspectionAllowed())
+        RemoteInspector::singleton().updateAutomaticInspectionCandidate(this);
+    else
+        RemoteInspector::singleton().updateTarget(this);
+}
+
+void RemoteInspectionTarget::pauseWaitingForAutomaticInspection()
+{
+    ASSERT(identifier());
+    ASSERT(m_allowed);
+    ASSERT(automaticInspectionAllowed());
+
+    EventLoop loop;
+    while (RemoteInspector::singleton().waitingForAutomaticInspection(identifier()) &amp;&amp; !loop.ended())
+        loop.cycle();
+}
+
+void RemoteInspectionTarget::unpauseForInitializedInspector()
+{
+    RemoteInspector::singleton().setupCompleted(identifier());
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectionTargethfromrev192752trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h (from rev 192752, trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h) (0 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -0,0 +1,78 @@
</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.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspectionTarget_h
+#define RemoteInspectionTarget_h
+
+#include &quot;RemoteControllableTarget.h&quot;
+#include &lt;wtf/RetainPtr.h&gt;
+#include &lt;wtf/TypeCasts.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE RemoteInspectionTarget : public RemoteControllableTarget {
+public:
+    bool remoteDebuggingAllowed() const { return m_allowed; }
+    void setRemoteDebuggingAllowed(bool);
+
+    CFRunLoopRef targetRunLoop() override { return m_runLoop.get(); }
+    void setTargetRunLoop(CFRunLoopRef runLoop) { m_runLoop = runLoop; }
+
+    virtual String name() const { return String(); } // JavaScript and Web
+    virtual String url() const { return String(); } // Web
+    virtual bool hasLocalDebugger() const = 0;
+
+    virtual void setIndicating(bool) { } // Default is to do nothing.
+    virtual void pause() { };
+
+    virtual bool automaticInspectionAllowed() const { return false; }
+    virtual void pauseWaitingForAutomaticInspection();
+    virtual void unpauseForInitializedInspector();
+
+    // RemoteControllableTarget overrides.
+    virtual bool remoteControlAllowed() const override;
+private:
+    bool m_allowed {false};
+    RetainPtr&lt;CFRunLoopRef&gt; m_runLoop;
+};
+
+} // namespace Inspector
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(Inspector::RemoteInspectionTarget) \
+    static bool isType(const Inspector::RemoteControllableTarget&amp; target) \
+    { \
+        return target.type() == Inspector::RemoteControllableTarget::Type::JavaScript \
+            || target.type() == Inspector::RemoteControllableTarget::Type::Web; \
+    }
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // RemoteInspectionTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All Rights Reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -33,16 +33,18 @@
</span><span class="cx"> #import &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #import &lt;wtf/Lock.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><ins>+#import &lt;wtf/Vector.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> OBJC_CLASS NSDictionary;
</span><span class="cx"> OBJC_CLASS NSString;
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><ins>+class RemoteAutomationTarget;
+class RemoteConnectionToTarget;
+class RemoteControllableTarget;
+class RemoteInspectionTarget;
</ins><span class="cx"> class RemoteInspectorClient;
</span><del>-class RemoteInspectorDebuggable;
-class RemoteInspectorDebuggableConnection;
-struct RemoteInspectorDebuggableInfo;
</del><span class="cx"> 
</span><span class="cx"> class JS_EXPORT_PRIVATE RemoteInspector final : public RemoteInspectorXPCConnection::Client {
</span><span class="cx"> public:
</span><span class="lines">@@ -50,11 +52,13 @@
</span><span class="cx">     static RemoteInspector&amp; singleton();
</span><span class="cx">     friend class NeverDestroyed&lt;RemoteInspector&gt;;
</span><span class="cx"> 
</span><del>-    void registerDebuggable(RemoteInspectorDebuggable*);
-    void unregisterDebuggable(RemoteInspectorDebuggable*);
-    void updateDebuggable(RemoteInspectorDebuggable*);
-    void updateDebuggableAutomaticInspectCandidate(RemoteInspectorDebuggable*);
-    void sendMessageToRemoteFrontend(unsigned identifier, const String&amp; message);
</del><ins>+    void registerTarget(RemoteControllableTarget*);
+    void unregisterTarget(RemoteControllableTarget*);
+    void updateTarget(RemoteControllableTarget*);
+    void sendMessageToRemote(unsigned identifier, const String&amp; message);
+
+    void updateAutomaticInspectionCandidate(RemoteInspectionTarget*);
+
</ins><span class="cx">     void setupFailed(unsigned identifier);
</span><span class="cx">     void setupCompleted(unsigned identifier);
</span><span class="cx">     bool waitingForAutomaticInspection(unsigned identifier);
</span><span class="lines">@@ -81,9 +85,11 @@
</span><span class="cx"> 
</span><span class="cx">     void setupXPCConnectionIfNeeded();
</span><span class="cx"> 
</span><del>-    NSDictionary *listingForDebuggable(const RemoteInspectorDebuggableInfo&amp;) const;
-    void pushListingNow();
-    void pushListingSoon();
</del><ins>+    RetainPtr&lt;NSDictionary&gt; listingForTarget(const RemoteControllableTarget&amp;) const;
+    RetainPtr&lt;NSDictionary&gt; listingForInspectionTarget(const RemoteInspectionTarget&amp;) const;
+    RetainPtr&lt;NSDictionary&gt; listingForAutomationTarget(const RemoteAutomationTarget&amp;) const;
+    void pushListingsNow();
+    void pushListingsSoon();
</ins><span class="cx"> 
</span><span class="cx">     void updateHasActiveDebugSession();
</span><span class="cx"> 
</span><span class="lines">@@ -105,29 +111,31 @@
</span><span class="cx"> 
</span><span class="cx">     static bool startEnabled;
</span><span class="cx"> 
</span><del>-    // Debuggables can be registered from any thread at any time.
-    // Any debuggable can send messages over the XPC connection.
</del><ins>+    // Targets can be registered from any thread at any time.
+    // Any target can send messages over the XPC connection.
</ins><span class="cx">     // So lock access to all maps and state as they can change
</span><span class="cx">     // from any thread.
</span><span class="cx">     Lock m_mutex;
</span><span class="cx"> 
</span><del>-    HashMap&lt;unsigned, std::pair&lt;RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo&gt;&gt; m_debuggableMap;
-    HashMap&lt;unsigned, RefPtr&lt;RemoteInspectorDebuggableConnection&gt;&gt; m_connectionMap;
</del><ins>+    HashMap&lt;unsigned, RemoteControllableTarget*&gt; m_targetMap;
+    HashMap&lt;unsigned, RetainPtr&lt;NSDictionary&gt;&gt; m_listingMap;
+    HashMap&lt;unsigned, RefPtr&lt;RemoteConnectionToTarget&gt;&gt; m_connectionMap;
+
</ins><span class="cx">     RefPtr&lt;RemoteInspectorXPCConnection&gt; m_xpcConnection;
</span><span class="cx"> 
</span><span class="cx">     dispatch_queue_t m_xpcQueue;
</span><del>-    unsigned m_nextAvailableIdentifier;
-    int m_notifyToken;
-    bool m_enabled;
-    bool m_hasActiveDebugSession;
-    bool m_pushScheduled;
</del><ins>+    unsigned m_nextAvailableIdentifier { 1 };
+    int m_notifyToken { 0 };
+    bool m_enabled { false };
+    bool m_hasActiveDebugSession { false };
+    bool m_pushScheduled { false };
</ins><span class="cx"> 
</span><del>-    pid_t m_parentProcessIdentifier;
</del><ins>+    pid_t m_parentProcessIdentifier { 0 };
</ins><span class="cx">     RetainPtr&lt;CFDataRef&gt; m_parentProcessAuditData;
</span><del>-    bool m_shouldSendParentProcessInformation;
-    bool m_automaticInspectionEnabled;
-    bool m_automaticInspectionPaused;
-    unsigned m_automaticInspectionCandidateIdentifier;
</del><ins>+    bool m_shouldSendParentProcessInformation { false };
+    bool m_automaticInspectionEnabled { false };
+    bool m_automaticInspectionPaused { false };
+    unsigned m_automaticInspectionCandidateIdentifier { 0 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc. All Rights Reserved.
</del><ins>+ * Copyright (C) 2013-2015 Apple Inc. All Rights Reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,9 +29,10 @@
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;InitializeThreading.h&quot;
</span><ins>+#import &quot;RemoteAutomationTarget.h&quot;
+#import &quot;RemoteConnectionToTarget.h&quot;
+#import &quot;RemoteInspectionTarget.h&quot;
</ins><span class="cx"> #import &quot;RemoteInspectorConstants.h&quot;
</span><del>-#import &quot;RemoteInspectorDebuggable.h&quot;
-#import &quot;RemoteInspectorDebuggableConnection.h&quot;
</del><span class="cx"> #import &lt;Foundation/Foundation.h&gt;
</span><span class="cx"> #import &lt;dispatch/dispatch.h&gt;
</span><span class="cx"> #import &lt;notify.h&gt;
</span><span class="lines">@@ -107,16 +108,6 @@
</span><span class="cx"> 
</span><span class="cx"> RemoteInspector::RemoteInspector()
</span><span class="cx">     : m_xpcQueue(dispatch_queue_create(&quot;com.apple.JavaScriptCore.remote-inspector-xpc&quot;, DISPATCH_QUEUE_SERIAL))
</span><del>-    , m_nextAvailableIdentifier(1)
-    , m_notifyToken(0)
-    , m_enabled(false)
-    , m_hasActiveDebugSession(false)
-    , m_pushScheduled(false)
-    , m_parentProcessIdentifier(0)
-    , m_shouldSendParentProcessInformation(false)
-    , m_automaticInspectionEnabled(false)
-    , m_automaticInspectionPaused(false)
-    , m_automaticInspectionCandidateIdentifier(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -125,71 +116,93 @@
</span><span class="cx">     unsigned nextValidIdentifier;
</span><span class="cx">     do {
</span><span class="cx">         nextValidIdentifier = m_nextAvailableIdentifier++;
</span><del>-    } while (!nextValidIdentifier || nextValidIdentifier == std::numeric_limits&lt;unsigned&gt;::max() || m_debuggableMap.contains(nextValidIdentifier));
</del><ins>+    } while (!nextValidIdentifier || nextValidIdentifier == std::numeric_limits&lt;unsigned&gt;::max() || m_targetMap.contains(nextValidIdentifier));
</ins><span class="cx">     return nextValidIdentifier;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::registerDebuggable(RemoteInspectorDebuggable* debuggable)
</del><ins>+void RemoteInspector::registerTarget(RemoteControllableTarget* target)
</ins><span class="cx"> {
</span><ins>+    ASSERT_ARG(target, target);
+
</ins><span class="cx">     std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx"> 
</span><span class="cx">     unsigned identifier = nextAvailableIdentifier();
</span><del>-    debuggable-&gt;setIdentifier(identifier);
</del><ins>+    target-&gt;setIdentifier(identifier);
</ins><span class="cx"> 
</span><del>-    auto result = m_debuggableMap.set(identifier, std::make_pair(debuggable, debuggable-&gt;info()));
-    ASSERT_UNUSED(result, result.isNewEntry);
</del><ins>+    {
+        auto result = m_targetMap.set(identifier, target);
+        ASSERT_UNUSED(result, result.isNewEntry);
+    }
+    
+    // If remote control is not allowed, a null listing is returned.
+    if (RetainPtr&lt;NSDictionary&gt; listing = listingForTarget(*target)) {
+        auto result = m_listingMap.set(identifier, listing);
+        ASSERT_UNUSED(result, result.isNewEntry);
+    }
</ins><span class="cx"> 
</span><del>-    if (debuggable-&gt;remoteDebuggingAllowed())
-        pushListingSoon();
</del><ins>+    pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::unregisterDebuggable(RemoteInspectorDebuggable* debuggable)
</del><ins>+void RemoteInspector::unregisterTarget(RemoteControllableTarget* target)
</ins><span class="cx"> {
</span><ins>+    ASSERT_ARG(target, target);
+
</ins><span class="cx">     std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx"> 
</span><del>-    unsigned identifier = debuggable-&gt;identifier();
</del><ins>+    unsigned identifier = target-&gt;identifier();
</ins><span class="cx">     if (!identifier)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    bool wasRemoved = m_debuggableMap.remove(identifier);
</del><ins>+    bool wasRemoved = m_targetMap.remove(identifier);
</ins><span class="cx">     ASSERT_UNUSED(wasRemoved, wasRemoved);
</span><span class="cx"> 
</span><del>-    if (RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = m_connectionMap.take(identifier))
-        connection-&gt;closeFromDebuggable();
</del><ins>+    // The listing may never have been added if remote control isn't allowed.
+    m_listingMap.remove(identifier);
</ins><span class="cx"> 
</span><del>-    if (debuggable-&gt;remoteDebuggingAllowed())
-        pushListingSoon();
</del><ins>+    if (auto connection = m_connectionMap.take(identifier))
+        connection-&gt;targetClosed();
+
+    pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::updateDebuggable(RemoteInspectorDebuggable* debuggable)
</del><ins>+void RemoteInspector::updateTarget(RemoteControllableTarget* target)
</ins><span class="cx"> {
</span><ins>+    ASSERT_ARG(target, target);
+
</ins><span class="cx">     std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx"> 
</span><del>-    unsigned identifier = debuggable-&gt;identifier();
</del><ins>+    unsigned identifier = target-&gt;identifier();
</ins><span class="cx">     if (!identifier)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto result = m_debuggableMap.set(identifier, std::make_pair(debuggable, debuggable-&gt;info()));
-    ASSERT_UNUSED(result, !result.isNewEntry);
</del><ins>+    {
+        auto result = m_targetMap.set(identifier, target);
+        ASSERT_UNUSED(result, !result.isNewEntry);
+    }
</ins><span class="cx"> 
</span><del>-    pushListingSoon();
</del><ins>+    // If the target has just allowed remote control, then the listing won't exist yet.
+    if (RetainPtr&lt;NSDictionary&gt; listing = listingForTarget(*target))
+        m_listingMap.set(identifier, listing);
+
+    pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::updateDebuggableAutomaticInspectCandidate(RemoteInspectorDebuggable* debuggable)
</del><ins>+void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* target)
</ins><span class="cx"> {
</span><ins>+    ASSERT_ARG(target, target);
</ins><span class="cx">     {
</span><span class="cx">         std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx"> 
</span><del>-        unsigned identifier = debuggable-&gt;identifier();
</del><ins>+        unsigned identifier = target-&gt;identifier();
</ins><span class="cx">         if (!identifier)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        auto result = m_debuggableMap.set(identifier, std::make_pair(debuggable, debuggable-&gt;info()));
</del><ins>+        auto result = m_targetMap.set(identifier, target);
</ins><span class="cx">         ASSERT_UNUSED(result, !result.isNewEntry);
</span><span class="cx"> 
</span><span class="cx">         // Don't allow automatic inspection unless it is allowed or we are stopped.
</span><span class="cx">         if (!m_automaticInspectionEnabled || !m_enabled) {
</span><del>-            pushListingSoon();
</del><ins>+            pushListingsSoon();
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -198,7 +211,7 @@
</span><span class="cx">         // Multiple attempts on the same thread should not be possible because our nested run loop is in a special RWI mode.
</span><span class="cx">         if (m_automaticInspectionPaused) {
</span><span class="cx">             LOG_ERROR(&quot;Skipping Automatic Inspection Candidate with pageId(%u) because we are already paused waiting for pageId(%u)&quot;, identifier, m_automaticInspectionCandidateIdentifier);
</span><del>-            pushListingSoon();
</del><ins>+            pushListingsSoon();
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -207,7 +220,7 @@
</span><span class="cx"> 
</span><span class="cx">         // If we are pausing before we have connected to webinspectord the candidate message will be sent as soon as the connection is established.
</span><span class="cx">         if (m_xpcConnection) {
</span><del>-            pushListingNow();
</del><ins>+            pushListingsNow();
</ins><span class="cx">             sendAutomaticInspectionCandidateMessage();
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -221,7 +234,7 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    debuggable-&gt;pauseWaitingForAutomaticInspection();
</del><ins>+    target-&gt;pauseWaitingForAutomaticInspection();
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="lines">@@ -243,16 +256,14 @@
</span><span class="cx">     m_xpcConnection-&gt;sendMessage(WIRAutomaticInspectionCandidateMessage, details);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::sendMessageToRemoteFrontend(unsigned identifier, const String&amp; message)
</del><ins>+void RemoteInspector::sendMessageToRemote(unsigned identifier, const String&amp; message)
</ins><span class="cx"> {
</span><span class="cx">     std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx"> 
</span><span class="cx">     if (!m_xpcConnection)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = m_connectionMap.get(identifier);
-    if (!connection)
-        return;
</del><ins>+    auto connection = m_connectionMap.get(identifier);
</ins><span class="cx"> 
</span><span class="cx">     NSDictionary *userInfo = @{
</span><span class="cx">         WIRRawDataKey: [static_cast&lt;NSString *&gt;(message) dataUsingEncoding:NSUTF8StringEncoding],
</span><span class="lines">@@ -274,7 +285,7 @@
</span><span class="cx">     if (identifier == m_automaticInspectionCandidateIdentifier)
</span><span class="cx">         m_automaticInspectionPaused = false;
</span><span class="cx"> 
</span><del>-    pushListingSoon();
</del><ins>+    pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::setupCompleted(unsigned identifier)
</span><span class="lines">@@ -329,8 +340,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_pushScheduled = false;
</span><span class="cx"> 
</span><del>-    for (auto it = m_connectionMap.begin(), end = m_connectionMap.end(); it != end; ++it)
-        it-&gt;value-&gt;close();
</del><ins>+    for (auto connection : m_connectionMap.values())
+        connection-&gt;close();
</ins><span class="cx">     m_connectionMap.clear();
</span><span class="cx"> 
</span><span class="cx">     updateHasActiveDebugSession();
</span><span class="lines">@@ -370,10 +381,10 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_automaticInspectionCandidateIdentifier) {
</span><span class="cx">         // We already have a debuggable waiting to be automatically inspected.
</span><del>-        pushListingNow();
</del><ins>+        pushListingsNow();
</ins><span class="cx">         sendAutomaticInspectionCandidateMessage();
</span><span class="cx">     } else
</span><del>-        pushListingSoon();
</del><ins>+        pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #pragma mark - Proxy Application Information
</span><span class="lines">@@ -435,8 +446,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_pushScheduled = false;
</span><span class="cx"> 
</span><del>-    for (auto it = m_connectionMap.begin(), end = m_connectionMap.end(); it != end; ++it)
-        it-&gt;value-&gt;close();
</del><ins>+    for (auto connection : m_connectionMap.values())
+        connection-&gt;close();
</ins><span class="cx">     m_connectionMap.clear();
</span><span class="cx"> 
</span><span class="cx">     updateHasActiveDebugSession();
</span><span class="lines">@@ -454,65 +465,93 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma mark - Listings
</span><span class="cx"> 
</span><del>-NSDictionary *RemoteInspector::listingForDebuggable(const RemoteInspectorDebuggableInfo&amp; debuggableInfo) const
</del><ins>+RetainPtr&lt;NSDictionary&gt; RemoteInspector::listingForTarget(const RemoteControllableTarget&amp; target) const
</ins><span class="cx"> {
</span><del>-    NSMutableDictionary *debuggableDetails = [NSMutableDictionary dictionary];
</del><ins>+    if (is&lt;RemoteInspectionTarget&gt;(target))
+        return listingForInspectionTarget(downcast&lt;RemoteInspectionTarget&gt;(target));
+    if (is&lt;RemoteAutomationTarget&gt;(target))
+        return listingForAutomationTarget(downcast&lt;RemoteAutomationTarget&gt;(target));
</ins><span class="cx"> 
</span><del>-    [debuggableDetails setObject:@(debuggableInfo.identifier) forKey:WIRPageIdentifierKey];
</del><ins>+    ASSERT_NOT_REACHED();
+    return nil;
+}
</ins><span class="cx"> 
</span><del>-    switch (debuggableInfo.type) {
-    case RemoteInspectorDebuggable::JavaScript: {
-        NSString *name = debuggableInfo.name;
-        [debuggableDetails setObject:name forKey:WIRTitleKey];
-        [debuggableDetails setObject:WIRTypeJavaScript forKey:WIRTypeKey];
</del><ins>+RetainPtr&lt;NSDictionary&gt; RemoteInspector::listingForInspectionTarget(const RemoteInspectionTarget&amp; 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&lt;NSMutableDictionary&gt; listing = adoptNS([[NSMutableDictionary alloc] init]);
+    [listing setObject:@(target.identifier()) forKey:WIRPageIdentifierKey];
+
+    switch (target.type()) {
+    case RemoteInspectionTarget::Type::JavaScript:
+        [listing setObject:target.name() forKey:WIRTitleKey];
+        [listing setObject:WIRTypeJavaScript forKey:WIRTypeKey];
</ins><span class="cx">         break;
</span><del>-    }
-    case RemoteInspectorDebuggable::Web: {
-        NSString *url = debuggableInfo.url;
-        NSString *title = debuggableInfo.name;
-        [debuggableDetails setObject:url forKey:WIRURLKey];
-        [debuggableDetails setObject:title forKey:WIRTitleKey];
-        [debuggableDetails setObject:WIRTypeWeb forKey:WIRTypeKey];
</del><ins>+    case RemoteInspectionTarget::Type::Web:
+        [listing setObject:target.url() forKey:WIRURLKey];
+        [listing setObject:target.name() forKey:WIRTitleKey];
+        [listing setObject:WIRTypeWeb forKey:WIRTypeKey];
</ins><span class="cx">         break;
</span><del>-    }
</del><span class="cx">     default:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = m_connectionMap.get(debuggableInfo.identifier))
-        [debuggableDetails setObject:connection-&gt;connectionIdentifier() forKey:WIRConnectionIdentifierKey];
</del><ins>+    if (auto* connection = m_connectionMap.get(target.identifier()))
+        [listing setObject:connection-&gt;connectionIdentifier() forKey:WIRConnectionIdentifierKey];
</ins><span class="cx"> 
</span><del>-    if (debuggableInfo.hasLocalDebugger)
-        [debuggableDetails setObject:@YES forKey:WIRHasLocalDebuggerKey];
</del><ins>+    if (target.hasLocalDebugger())
+        [listing setObject:@YES forKey:WIRHasLocalDebuggerKey];
</ins><span class="cx"> 
</span><del>-    return debuggableDetails;
</del><ins>+    return listing;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::pushListingNow()
</del><ins>+RetainPtr&lt;NSDictionary&gt; RemoteInspector::listingForAutomationTarget(const RemoteAutomationTarget&amp; target) const
</ins><span class="cx"> {
</span><ins>+    // 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());
+
+    if (!target.automationAllowed())
+        return nil;
+
+    RetainPtr&lt;NSMutableDictionary&gt; listing = adoptNS([[NSMutableDictionary alloc] init]);
+    [listing setObject:@(target.identifier()) forKey:WIRPageIdentifierKey];
+    [listing setObject:target.name() forKey:WIRTitleKey];
+    [listing setObject:WIRTypeAutomation forKey:WIRTypeKey];
+
+    if (auto connection = m_connectionMap.get(target.identifier()))
+        [listing setObject:connection-&gt;connectionIdentifier() forKey:WIRConnectionIdentifierKey];
+
+    return listing;
+}
+
+void RemoteInspector::pushListingsNow()
+{
</ins><span class="cx">     ASSERT(m_xpcConnection);
</span><span class="cx">     if (!m_xpcConnection)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_pushScheduled = false;
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;NSMutableDictionary&gt; response = adoptNS([[NSMutableDictionary alloc] init]);
-    for (auto it = m_debuggableMap.begin(), end = m_debuggableMap.end(); it != end; ++it) {
-        const RemoteInspectorDebuggableInfo&amp; debuggableInfo = it-&gt;value.second;
-        if (debuggableInfo.remoteDebuggingAllowed) {
-            NSDictionary *details = listingForDebuggable(debuggableInfo);
-            [response setObject:details forKey:[NSString stringWithFormat:@&quot;%u&quot;, debuggableInfo.identifier]];
-        }
</del><ins>+    RetainPtr&lt;NSMutableDictionary&gt; listings = adoptNS([[NSMutableDictionary alloc] init]);
+    for (RetainPtr&lt;NSDictionary&gt; listing : m_listingMap.values()) {
+        NSString *identifier = [listing.get() objectForKey:WIRPageIdentifierKey];
+        [listings setObject:listing.get() forKey:identifier];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;NSMutableDictionary&gt; outgoing = adoptNS([[NSMutableDictionary alloc] init]);
-    [outgoing setObject:response.get() forKey:WIRListingKey];
</del><ins>+    RetainPtr&lt;NSMutableDictionary&gt; message = adoptNS([[NSMutableDictionary alloc] init]);
+    [message setObject:listings.get() forKey:WIRListingKey];
</ins><span class="cx"> 
</span><del>-    m_xpcConnection-&gt;sendMessage(WIRListingMessage, outgoing.get());
</del><ins>+    m_xpcConnection-&gt;sendMessage(WIRListingMessage, message.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteInspector::pushListingSoon()
</del><ins>+void RemoteInspector::pushListingsSoon()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_xpcConnection)
</span><span class="cx">         return;
</span><span class="lines">@@ -524,7 +563,7 @@
</span><span class="cx">     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
</span><span class="cx">         std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx">         if (m_pushScheduled)
</span><del>-            pushListingNow();
</del><ins>+            pushListingsNow();
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -547,8 +586,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo)
</span><span class="cx"> {
</span><del>-    NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
-    if (!pageId)
</del><ins>+    unsigned identifier = [[userInfo objectForKey:WIRPageIdentifierKey] unsignedIntegerValue];
+    if (!identifier)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
</span><span class="lines">@@ -559,65 +598,66 @@
</span><span class="cx">     if (!sender)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned identifier = [pageId unsignedIntValue];
</del><span class="cx">     if (m_connectionMap.contains(identifier))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto it = m_debuggableMap.find(identifier);
-    if (it == m_debuggableMap.end())
</del><ins>+    auto findResult = m_targetMap.find(identifier);
+    if (findResult == m_targetMap.end())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Attempt to create a connection. This may fail if the page already has an inspector or if it disallows inspection.
</span><del>-    RemoteInspectorDebuggable* debuggable = it-&gt;value.first;
-    RemoteInspectorDebuggableInfo debuggableInfo = it-&gt;value.second;
-    RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = adoptRef(new RemoteInspectorDebuggableConnection(debuggable, connectionIdentifier, sender, debuggableInfo.type));
-    bool isAutomaticInspection = m_automaticInspectionCandidateIdentifier == debuggable-&gt;identifier();
</del><ins>+    RemoteControllableTarget* target = findResult-&gt;value;
+    RefPtr&lt;RemoteConnectionToTarget&gt; connection = adoptRef(new RemoteConnectionToTarget(downcast&lt;RemoteInspectionTarget&gt;(target), connectionIdentifier, sender));
</ins><span class="cx"> 
</span><del>-    bool automaticallyPause = false;
-    NSNumber *automaticallyPauseObject = [userInfo objectForKey:WIRAutomaticallyPause];
-    if ([automaticallyPauseObject isKindOfClass:[NSNumber class]])
-        automaticallyPause = [automaticallyPauseObject boolValue];
</del><ins>+    if (is&lt;RemoteInspectionTarget&gt;(target)) {
+        bool isAutomaticInspection = m_automaticInspectionCandidateIdentifier == target-&gt;identifier();
+        bool automaticallyPause = [[userInfo objectForKey:WIRAutomaticallyPause] boolValue];
</ins><span class="cx"> 
</span><del>-    if (!connection-&gt;setup(isAutomaticInspection, automaticallyPause)) {
-        connection-&gt;close();
-        return;
-    }
</del><ins>+        if (!connection-&gt;setup(isAutomaticInspection, automaticallyPause)) {
+            connection-&gt;close();
+            return;
+        }
+        m_connectionMap.set(identifier, connection.release());
+        updateHasActiveDebugSession();
+    } else if (is&lt;RemoteAutomationTarget&gt;(target)) {
+        if (!connection-&gt;setup()) {
+            connection-&gt;close();
+            return;
+        }
+        m_connectionMap.set(identifier, connection.release());
+        updateHasActiveDebugSession();
+    } else
+        ASSERT_NOT_REACHED();
</ins><span class="cx"> 
</span><del>-    m_connectionMap.set(identifier, connection.release());
-
-    updateHasActiveDebugSession();
-
-    pushListingSoon();
</del><ins>+    pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::receivedDataMessage(NSDictionary *userInfo)
</span><span class="cx"> {
</span><del>-    NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
-    if (!pageId)
</del><ins>+    unsigned identifier = [[userInfo objectForKey:WIRPageIdentifierKey] unsignedIntegerValue];
+    if (!identifier)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned pageIdentifier = [pageId unsignedIntValue];
-    RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = m_connectionMap.get(pageIdentifier);
</del><ins>+    auto connection = m_connectionMap.get(identifier);
</ins><span class="cx">     if (!connection)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     NSData *data = [userInfo objectForKey:WIRSocketDataKey];
</span><span class="cx">     RetainPtr&lt;NSString&gt; message = adoptNS([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
</span><del>-    connection-&gt;sendMessageToBackend(message.get());
</del><ins>+    connection-&gt;sendMessageToTarget(message.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::receivedDidCloseMessage(NSDictionary *userInfo)
</span><span class="cx"> {
</span><del>-    NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
-    if (!pageId)
</del><ins>+    unsigned identifier = [[userInfo objectForKey:WIRPageIdentifierKey] unsignedIntegerValue];
+    if (!identifier)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
</span><span class="cx">     if (!connectionIdentifier)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned identifier = [pageId unsignedIntValue];
-    RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = m_connectionMap.get(identifier);
</del><ins>+    auto connection = m_connectionMap.get(identifier);
</ins><span class="cx">     if (!connection)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -629,35 +669,37 @@
</span><span class="cx"> 
</span><span class="cx">     updateHasActiveDebugSession();
</span><span class="cx"> 
</span><del>-    pushListingSoon();
</del><ins>+    pushListingsSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::receivedGetListingMessage(NSDictionary *)
</span><span class="cx"> {
</span><del>-    pushListingNow();
</del><ins>+    pushListingsNow();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::receivedIndicateMessage(NSDictionary *userInfo)
</span><span class="cx"> {
</span><del>-    NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
-    if (!pageId)
</del><ins>+    unsigned identifier = [[userInfo objectForKey:WIRPageIdentifierKey] unsignedIntegerValue];
+    if (!identifier)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned identifier = [pageId unsignedIntValue];
</del><span class="cx">     BOOL indicateEnabled = [[userInfo objectForKey:WIRIndicateEnabledKey] boolValue];
</span><span class="cx"> 
</span><ins>+    std::lock_guard&lt;Lock&gt; lock(m_mutex);
+
</ins><span class="cx">     callOnWebThreadOrDispatchAsyncOnMainThread(^{
</span><del>-        RemoteInspectorDebuggable* debuggable = nullptr;
</del><ins>+        RemoteControllableTarget* target = nullptr;
</ins><span class="cx">         {
</span><span class="cx">             std::lock_guard&lt;Lock&gt; lock(m_mutex);
</span><span class="cx"> 
</span><del>-            auto it = m_debuggableMap.find(identifier);
-            if (it == m_debuggableMap.end())
</del><ins>+            auto findResult = m_targetMap.find(identifier);
+            if (findResult == m_targetMap.end())
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-            debuggable = it-&gt;value.first;
</del><ins>+            target = findResult-&gt;value;
</ins><span class="cx">         }
</span><del>-        debuggable-&gt;setIndicating(indicateEnabled);
</del><ins>+        if (is&lt;RemoteInspectionTarget&gt;(target))
+            downcast&lt;RemoteInspectionTarget&gt;(target)-&gt;setIndicating(indicateEnabled);
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -703,7 +745,7 @@
</span><span class="cx">     if (it == end)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;RemoteInspectorDebuggableConnection&gt; connection = it-&gt;value;
</del><ins>+    auto connection = it-&gt;value;
</ins><span class="cx">     connection-&gt;close();
</span><span class="cx">     m_connectionMap.remove(it);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorConstantsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx"> #define WIRTypeKey                              @&quot;WIRTypeKey&quot;
</span><span class="cx"> #define WIRTypeJavaScript                       @&quot;WIRTypeJavaScript&quot;
</span><span class="cx"> #define WIRTypeWeb                              @&quot;WIRTypeWeb&quot;
</span><ins>+#define WIRTypeAutomation                       @&quot;WIRTypeAutomation&quot;
</ins><span class="cx"> #define WIRAutomaticallyPause                   @&quot;WIRAutomaticallyPause&quot;
</span><span class="cx"> 
</span><span class="cx"> #define WIRAutomaticInspectionEnabledKey           @&quot;WIRAutomaticInspectionEnabledKey&quot;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,100 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#include &quot;config.h&quot;
-#include &quot;RemoteInspectorDebuggable.h&quot;
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#include &quot;EventLoop.h&quot;
-#include &quot;RemoteInspector.h&quot;
-
-namespace Inspector {
-
-RemoteInspectorDebuggable::RemoteInspectorDebuggable()
-    : m_identifier(0)
-    , m_allowed(false)
-{
-}
-
-RemoteInspectorDebuggable::~RemoteInspectorDebuggable()
-{
-    RemoteInspector::singleton().unregisterDebuggable(this);
-}
-
-void RemoteInspectorDebuggable::init()
-{
-    RemoteInspector::singleton().registerDebuggable(this);
-}
-
-void RemoteInspectorDebuggable::update()
-{
-    RemoteInspector::singleton().updateDebuggable(this);
-}
-
-void RemoteInspectorDebuggable::setRemoteDebuggingAllowed(bool allowed)
-{
-    if (m_allowed == allowed)
-        return;
-
-    m_allowed = allowed;
-
-    if (m_allowed &amp;&amp; automaticInspectionAllowed())
-        RemoteInspector::singleton().updateDebuggableAutomaticInspectCandidate(this);
-    else
-        RemoteInspector::singleton().updateDebuggable(this);
-}
-
-RemoteInspectorDebuggableInfo RemoteInspectorDebuggable::info() const
-{
-    RemoteInspectorDebuggableInfo info;
-    info.identifier = identifier();
-    info.type = type();
-    info.name = name();
-    info.url = url();
-    info.hasLocalDebugger = hasLocalDebugger();
-    info.remoteDebuggingAllowed = remoteDebuggingAllowed();
-    return info;
-}
-
-void RemoteInspectorDebuggable::pauseWaitingForAutomaticInspection()
-{
-    ASSERT(m_identifier);
-    ASSERT(m_allowed);
-    ASSERT(automaticInspectionAllowed());
-
-    EventLoop loop;
-    while (RemoteInspector::singleton().waitingForAutomaticInspection(identifier()) &amp;&amp; !loop.ended())
-        loop.cycle();
-}
-
-void RemoteInspectorDebuggable::unpauseForInitializedInspector()
-{
-    RemoteInspector::singleton().setupCompleted(identifier());
-}
-
-} // namespace Inspector
-
-#endif // ENABLE(REMOTE_INSPECTOR)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,103 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#ifndef RemoteInspectorDebuggable_h
-#define RemoteInspectorDebuggable_h
-
-#include &lt;CoreFoundation/CFRunLoop.h&gt;
-#include &lt;wtf/RetainPtr.h&gt;
-#include &lt;wtf/text/WTFString.h&gt;
-
-namespace Inspector {
-
-class FrontendChannel;
-
-struct RemoteInspectorDebuggableInfo;
-
-class JS_EXPORT_PRIVATE RemoteInspectorDebuggable {
-public:
-    RemoteInspectorDebuggable();
-    virtual ~RemoteInspectorDebuggable();
-
-    void init();
-    void update();
-
-    unsigned identifier() const { return m_identifier; }
-    void setIdentifier(unsigned identifier) { m_identifier = identifier; }
-
-    bool remoteDebuggingAllowed() const { return m_allowed; }
-    void setRemoteDebuggingAllowed(bool);
-
-    CFRunLoopRef debuggerRunLoop() { return m_runLoop.get(); }
-    void setDebuggerRunLoop(CFRunLoopRef runLoop) { m_runLoop = runLoop; }
-
-    RemoteInspectorDebuggableInfo info() const;
-
-    enum DebuggableType { JavaScript, Web };
-    virtual DebuggableType type() const = 0;
-    virtual String name() const { return String(); } // JavaScript and Web
-    virtual String url() const { return String(); } // Web
-    virtual bool hasLocalDebugger() const = 0;
-
-    virtual void connect(FrontendChannel*, bool isAutomaticInspection) = 0;
-    virtual void disconnect(FrontendChannel*) = 0;
-    virtual void dispatchMessageFromRemoteFrontend(const String&amp; message) = 0;
-    virtual void setIndicating(bool) { } // Default is to do nothing.
-    virtual void pause() { };
-
-    virtual bool automaticInspectionAllowed() const { return false; }
-    virtual void pauseWaitingForAutomaticInspection();
-    virtual void unpauseForInitializedInspector();
-
-private:
-    unsigned m_identifier;
-    bool m_allowed;
-    RetainPtr&lt;CFRunLoopRef&gt; m_runLoop;
-};
-
-struct RemoteInspectorDebuggableInfo {
-    RemoteInspectorDebuggableInfo()
-        : identifier(0)
-        , type(RemoteInspectorDebuggable::JavaScript)
-        , hasLocalDebugger(false)
-        , remoteDebuggingAllowed(false)
-    {
-    }
-
-    unsigned identifier;
-    RemoteInspectorDebuggable::DebuggableType type;
-    String name;
-    String url;
-    bool hasLocalDebugger;
-    bool remoteDebuggingAllowed;
-};
-
-} // namespace Inspector
-
-#endif // RemoteInspectorDebuggable_h
-
-#endif // ENABLE(REMOTE_INSPECTOR)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,131 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#ifndef RemoteInspectorDebuggableConnection_h
-#define RemoteInspectorDebuggableConnection_h
-
-#import &quot;InspectorFrontendChannel.h&quot;
-#import &quot;RemoteInspectorDebuggable.h&quot;
-#import &lt;mutex&gt;
-#import &lt;wtf/Lock.h&gt;
-#import &lt;wtf/RetainPtr.h&gt;
-#import &lt;wtf/ThreadSafeRefCounted.h&gt;
-
-OBJC_CLASS NSString;
-
-namespace Inspector {
-    
-class RemoteInspectorBlock {
-public:
-    RemoteInspectorBlock(void (^task)())
-        : m_task(Block_copy(task))
-    {
-    }
-
-    RemoteInspectorBlock(const RemoteInspectorBlock&amp; other)
-        : m_task(Block_copy(other.m_task))
-    {
-    }
-
-    ~RemoteInspectorBlock()
-    {
-        Block_release(m_task);
-    }
-
-    RemoteInspectorBlock&amp; operator=(const RemoteInspectorBlock&amp; other)
-    {
-        void (^oldTask)() = m_task;
-        m_task = Block_copy(other.m_task);
-        Block_release(oldTask);
-        return *this;
-    }
-
-    void operator()() const
-    {
-        m_task();
-    }
-
-private:
-    void (^m_task)();
-};
-
-typedef Vector&lt;RemoteInspectorBlock&gt; RemoteInspectorQueue;
-
-class RemoteInspectorDebuggableConnection final : public ThreadSafeRefCounted&lt;RemoteInspectorDebuggableConnection&gt;, public FrontendChannel {
-public:
-    RemoteInspectorDebuggableConnection(RemoteInspectorDebuggable*, NSString *connectionIdentifier, NSString *destination, RemoteInspectorDebuggable::DebuggableType);
-    virtual ~RemoteInspectorDebuggableConnection();
-
-    NSString *destination() const;
-    NSString *connectionIdentifier() const;
-    unsigned identifier() const { return m_identifier; }
-
-    bool setup(bool isAutomaticInspection, bool automaticallyPause);
-
-    void close();
-    void closeFromDebuggable();
-
-    void sendMessageToBackend(NSString *);
-    virtual bool sendMessageToFrontend(const String&amp;) override;
-
-    virtual ConnectionType connectionType() const override { return ConnectionType::Remote; }
-
-    Lock&amp; queueMutex() { return m_queueMutex; }
-    RemoteInspectorQueue queue() const { return m_queue; }
-    void clearQueue() { m_queue.clear(); }
-
-private:
-    void dispatchAsyncOnDebuggable(void (^block)());
-
-    void setupRunLoop();
-    void teardownRunLoop();
-    void queueTaskOnPrivateRunLoop(void (^block)());
-
-    // This connection from the RemoteInspector singleton to the Debuggable
-    // can be used on multiple threads. So any access to the debuggable
-    // itself must take this mutex to ensure m_debuggable is valid.
-    Lock m_debuggableMutex;
-
-    // If a debuggable has a specific run loop it wants to evaluate on
-    // we setup our run loop sources on that specific run loop.
-    RetainPtr&lt;CFRunLoopRef&gt; m_runLoop;
-    RetainPtr&lt;CFRunLoopSourceRef&gt; m_runLoopSource;
-    RemoteInspectorQueue m_queue;
-    Lock m_queueMutex;
-
-    RemoteInspectorDebuggable* m_debuggable;
-    RetainPtr&lt;NSString&gt; m_connectionIdentifier;
-    RetainPtr&lt;NSString&gt; m_destination;
-    unsigned m_identifier;
-    bool m_connected;
-};
-
-} // namespace Inspector
-
-#endif // RemoteInspectorDebuggableConnection_h
-
-#endif // ENABLE(REMOTE_INSPECTOR)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableConnectionmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,273 +0,0 @@
</span><del>-/*
- * 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 &quot;config.h&quot;
-#import &quot;RemoteInspectorDebuggableConnection.h&quot;
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import &quot;EventLoop.h&quot;
-#import &quot;RemoteInspector.h&quot;
-#import &lt;dispatch/dispatch.h&gt;
-#import &lt;wtf/Vector.h&gt;
-
-#if PLATFORM(IOS)
-#import &lt;wtf/ios/WebCoreThread.h&gt;
-#endif
-
-namespace Inspector {
-
-static StaticLock rwiQueueMutex;
-static CFRunLoopSourceRef rwiRunLoopSource;
-static RemoteInspectorQueue* rwiQueue;
-
-static void RemoteInspectorHandleRunSourceGlobal(void*)
-{
-    ASSERT(CFRunLoopGetCurrent() == CFRunLoopGetMain());
-    ASSERT(rwiRunLoopSource);
-    ASSERT(rwiQueue);
-
-    RemoteInspectorQueue queueCopy;
-    {
-        std::lock_guard&lt;StaticLock&gt; lock(rwiQueueMutex);
-        queueCopy = *rwiQueue;
-        rwiQueue-&gt;clear();
-    }
-
-    for (const auto&amp; block : queueCopy)
-        block();
-}
-
-static void RemoteInspectorQueueTaskOnGlobalQueue(void (^task)())
-{
-    ASSERT(rwiRunLoopSource);
-    ASSERT(rwiQueue);
-
-    {
-        std::lock_guard&lt;StaticLock&gt; lock(rwiQueueMutex);
-        rwiQueue-&gt;append(RemoteInspectorBlock(task));
-    }
-
-    CFRunLoopSourceSignal(rwiRunLoopSource);
-    CFRunLoopWakeUp(CFRunLoopGetMain());
-}
-
-static void RemoteInspectorInitializeGlobalQueue()
-{
-    static dispatch_once_t pred;
-    dispatch_once(&amp;pred, ^{
-        rwiQueue = new RemoteInspectorQueue;
-
-        CFRunLoopSourceContext runLoopSourceContext = {0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, RemoteInspectorHandleRunSourceGlobal};
-        rwiRunLoopSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 1, &amp;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 RemoteInspectorHandleRunSourceWithInfo(void* info)
-{
-    RemoteInspectorDebuggableConnection *debuggableConnection = static_cast&lt;RemoteInspectorDebuggableConnection*&gt;(info);
-
-    RemoteInspectorQueue queueCopy;
-    {
-        std::lock_guard&lt;Lock&gt; lock(debuggableConnection-&gt;queueMutex());
-        queueCopy = debuggableConnection-&gt;queue();
-        debuggableConnection-&gt;clearQueue();
-    }
-
-    for (const auto&amp; block : queueCopy)
-        block();
-}
-
-
-RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection(RemoteInspectorDebuggable* debuggable, NSString *connectionIdentifier, NSString *destination, RemoteInspectorDebuggable::DebuggableType)
-    : m_debuggable(debuggable)
-    , m_connectionIdentifier(connectionIdentifier)
-    , m_destination(destination)
-    , m_identifier(debuggable-&gt;identifier())
-    , m_connected(false)
-{
-    setupRunLoop();
-}
-
-RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection()
-{
-    teardownRunLoop();
-}
-
-NSString *RemoteInspectorDebuggableConnection::destination() const
-{
-    return [[m_destination copy] autorelease];
-}
-
-NSString *RemoteInspectorDebuggableConnection::connectionIdentifier() const
-{
-    return [[m_connectionIdentifier copy] autorelease];
-}
-
-void RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable(void (^block)())
-{
-    if (m_runLoop) {
-        queueTaskOnPrivateRunLoop(block);
-        return;
-    }
-
-#if PLATFORM(IOS)
-    if (WebCoreWebThreadIsEnabled &amp;&amp; WebCoreWebThreadIsEnabled()) {
-        WebCoreWebThreadRun(block);
-        return;
-    }
-#endif
-
-    RemoteInspectorQueueTaskOnGlobalQueue(block);
-}
-
-bool RemoteInspectorDebuggableConnection::setup(bool isAutomaticInspection, bool automaticallyPause)
-{
-    std::lock_guard&lt;Lock&gt; lock(m_debuggableMutex);
-
-    if (!m_debuggable)
-        return false;
-
-    ref();
-    dispatchAsyncOnDebuggable(^{
-        {
-            std::lock_guard&lt;Lock&gt; lock(m_debuggableMutex);
-            if (!m_debuggable || !m_debuggable-&gt;remoteDebuggingAllowed() || m_debuggable-&gt;hasLocalDebugger()) {
-                RemoteInspector::singleton().setupFailed(identifier());
-                m_debuggable = nullptr;
-            } else {
-                m_debuggable-&gt;connect(this, isAutomaticInspection);
-                m_connected = true;
-
-                if (automaticallyPause)
-                    m_debuggable-&gt;pause();
-            }
-        }
-        deref();
-    });
-
-    return true;
-}
-
-void RemoteInspectorDebuggableConnection::closeFromDebuggable()
-{
-    std::lock_guard&lt;Lock&gt; lock(m_debuggableMutex);
-
-    m_debuggable = nullptr;
-}
-
-void RemoteInspectorDebuggableConnection::close()
-{
-    ref();
-    dispatchAsyncOnDebuggable(^{
-        {
-            std::lock_guard&lt;Lock&gt; lock(m_debuggableMutex);
-
-            if (m_debuggable) {
-                if (m_connected)
-                    m_debuggable-&gt;disconnect(this);
-
-                m_debuggable = nullptr;
-            }
-        }
-        deref();
-    });
-}
-
-void RemoteInspectorDebuggableConnection::sendMessageToBackend(NSString *message)
-{
-    ref();
-    dispatchAsyncOnDebuggable(^{
-        {
-            RemoteInspectorDebuggable* debuggable = nullptr;
-            {
-                std::lock_guard&lt;Lock&gt; lock(m_debuggableMutex);
-                if (!m_debuggable)
-                    return;
-                debuggable = m_debuggable;
-            }
-
-            debuggable-&gt;dispatchMessageFromRemoteFrontend(message);
-        }
-        deref();
-    });
-}
-
-bool RemoteInspectorDebuggableConnection::sendMessageToFrontend(const String&amp; message)
-{
-    RemoteInspector::singleton().sendMessageToRemoteFrontend(identifier(), message);
-
-    return true;
-}
-
-void RemoteInspectorDebuggableConnection::setupRunLoop()
-{
-    CFRunLoopRef debuggerRunLoop = m_debuggable-&gt;debuggerRunLoop();
-    if (!debuggerRunLoop) {
-        RemoteInspectorInitializeGlobalQueue();
-        return;
-    }
-
-    m_runLoop = debuggerRunLoop;
-
-    CFRunLoopSourceContext runLoopSourceContext = {0, this, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, RemoteInspectorHandleRunSourceWithInfo};
-    m_runLoopSource = adoptCF(CFRunLoopSourceCreate(kCFAllocatorDefault, 1, &amp;runLoopSourceContext));
-
-    CFRunLoopAddSource(m_runLoop.get(), m_runLoopSource.get(), kCFRunLoopDefaultMode);
-    CFRunLoopAddSource(m_runLoop.get(), m_runLoopSource.get(), EventLoop::remoteInspectorRunLoopMode());
-}
-
-void RemoteInspectorDebuggableConnection::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 RemoteInspectorDebuggableConnection::queueTaskOnPrivateRunLoop(void (^block)())
-{
-    ASSERT(m_runLoop);
-
-    {
-        std::lock_guard&lt;Lock&gt; lock(m_queueMutex);
-        m_queue.append(RemoteInspectorBlock(block));
-    }
-
-    CFRunLoopSourceSignal(m_runLoopSource.get());
-    CFRunLoopWakeUp(m_runLoop.get());
-}
-
-} // namespace Inspector
-
-#endif // ENABLE(REMOTE_INSPECTOR)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     m_globalObject.inspectorController().pause();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend(const String&amp; message)
</del><ins>+void JSGlobalObjectDebuggable::dispatchMessageFromRemote(const String&amp; message)
</ins><span class="cx"> {
</span><span class="cx">     JSLockHolder locker(&amp;m_globalObject.vm());
</span><span class="cx"> 
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx"> void JSGlobalObjectDebuggable::pauseWaitingForAutomaticInspection()
</span><span class="cx"> {
</span><span class="cx">     JSC::JSLock::DropAllLocks dropAllLocks(&amp;m_globalObject.vm());
</span><del>-    RemoteInspectorDebuggable::pauseWaitingForAutomaticInspection();
</del><ins>+    RemoteInspectionTarget::pauseWaitingForAutomaticInspection();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectDebuggableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSGlobalObjectInspectorController.h&quot;
</span><del>-#include &quot;RemoteInspectorDebuggable.h&quot;
</del><ins>+#include &quot;RemoteInspectionTarget.h&quot;
</ins><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="lines">@@ -41,21 +41,21 @@
</span><span class="cx"> 
</span><span class="cx"> class JSGlobalObject;
</span><span class="cx"> 
</span><del>-class JSGlobalObjectDebuggable final : public Inspector::RemoteInspectorDebuggable {
</del><ins>+class JSGlobalObjectDebuggable final : public Inspector::RemoteInspectionTarget {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(JSGlobalObjectDebuggable);
</span><span class="cx"> public:
</span><span class="cx">     JSGlobalObjectDebuggable(JSGlobalObject&amp;);
</span><span class="cx">     ~JSGlobalObjectDebuggable() { }
</span><span class="cx"> 
</span><del>-    virtual Inspector::RemoteInspectorDebuggable::DebuggableType type() const override { return Inspector::RemoteInspectorDebuggable::JavaScript; }
</del><ins>+    virtual Inspector::RemoteControllableTarget::Type type() const override { return Inspector::RemoteControllableTarget::Type::JavaScript; }
</ins><span class="cx"> 
</span><span class="cx">     virtual String name() const override;
</span><span class="cx">     virtual bool hasLocalDebugger() const override { return false; }
</span><span class="cx"> 
</span><span class="cx">     virtual void connect(Inspector::FrontendChannel*, bool automaticInspection) override;
</span><span class="cx">     virtual void disconnect(Inspector::FrontendChannel*) override;
</span><del>-    virtual void dispatchMessageFromRemoteFrontend(const String&amp; message) override;
</del><ins>+    virtual void dispatchMessageFromRemote(const String&amp; message) override;
</ins><span class="cx">     virtual void pause() override;
</span><span class="cx"> 
</span><span class="cx">     virtual bool automaticInspectionAllowed() const override { return true; }
</span><span class="lines">@@ -67,6 +67,8 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CONTROLLABLE_TARGET(JSC::JSGlobalObjectDebuggable, JavaScript);
+
</ins><span class="cx"> #endif // ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span><span class="cx"> #endif // !defined(JSGlobalObjectDebuggable_h)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/WebCore/ChangeLog        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-11-20  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Inspector: RemoteInspector should track targets and connections for remote automation
+        https://bugs.webkit.org/show_bug.cgi?id=151042
+
+        Reviewed by Joseph Pecoraro.
+
+        Use the new RemoteControllableTarget API method names.
+
+        No new tests, no behavior change.
+
+        * page/PageDebuggable.cpp:
+        (WebCore::PageDebuggable::connect):
+        (WebCore::PageDebuggable::dispatchMessageFromRemote):
+        (WebCore::PageDebuggable::dispatchMessageFromRemoteFrontend): Deleted.
+        * page/PageDebuggable.h:
+
</ins><span class="cx"> 2015-11-23  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Unskip all indexeddb/mozilla tests that pass.
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageDebuggablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageDebuggable.cpp (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageDebuggable.cpp        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/WebCore/page/PageDebuggable.cpp        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     return m_page.inspectorController().hasLocalFrontend();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageDebuggable::connect(Inspector::FrontendChannel* channel, bool isAutomaticInspection)
</del><ins>+void PageDebuggable::connect(Inspector::FrontendChannel* channel, bool isAutomaticConnection)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_page.settings().developerExtrasEnabled()) {
</span><span class="cx">         m_forcedDeveloperExtrasEnabled = true;
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">         m_forcedDeveloperExtrasEnabled = false;
</span><span class="cx"> 
</span><span class="cx">     InspectorController&amp; inspectorController = m_page.inspectorController();
</span><del>-    inspectorController.connectFrontend(channel, isAutomaticInspection);
</del><ins>+    inspectorController.connectFrontend(channel, isAutomaticConnection);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageDebuggable::disconnect(Inspector::FrontendChannel* channel)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageDebuggable::dispatchMessageFromRemoteFrontend(const String&amp; message)
</del><ins>+void PageDebuggable::dispatchMessageFromRemote(const String&amp; message)
</ins><span class="cx"> {
</span><span class="cx">     m_page.inspectorController().dispatchMessageFromFrontend(message);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageDebuggableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageDebuggable.h (192752 => 192753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageDebuggable.h        2015-11-23 23:12:03 UTC (rev 192752)
+++ trunk/Source/WebCore/page/PageDebuggable.h        2015-11-23 23:51:48 UTC (rev 192753)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -28,29 +28,29 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span><del>-#include &lt;JavaScriptCore/RemoteInspectorDebuggable.h&gt;
</del><ins>+#include &lt;JavaScriptCore/RemoteInspectionTarget.h&gt;
</ins><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Page;
</span><span class="cx"> 
</span><del>-class PageDebuggable final : public Inspector::RemoteInspectorDebuggable {
</del><ins>+class PageDebuggable final : public Inspector::RemoteInspectionTarget {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PageDebuggable);
</span><span class="cx"> public:
</span><span class="cx">     PageDebuggable(Page&amp;);
</span><span class="cx">     ~PageDebuggable() { }
</span><span class="cx"> 
</span><del>-    virtual Inspector::RemoteInspectorDebuggable::DebuggableType type() const override { return Inspector::RemoteInspectorDebuggable::Web; }
</del><ins>+    virtual Inspector::RemoteControllableTarget::Type type() const override { return Inspector::RemoteControllableTarget::Type::Web; }
</ins><span class="cx"> 
</span><span class="cx">     virtual String name() const override;
</span><span class="cx">     virtual String url() const override;
</span><span class="cx">     virtual bool hasLocalDebugger() const override;
</span><span class="cx"> 
</span><del>-    virtual void connect(Inspector::FrontendChannel*, bool isAutomaticInspection) override;
</del><ins>+    virtual void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false) override;
</ins><span class="cx">     virtual void disconnect(Inspector::FrontendChannel*) override;
</span><del>-    virtual void dispatchMessageFromRemoteFrontend(const String&amp; message) override;
</del><ins>+    virtual void dispatchMessageFromRemote(const String&amp; message) override;
</ins><span class="cx">     virtual void setIndicating(bool) override;
</span><span class="cx"> 
</span><span class="cx">     String nameOverride() const { return m_nameOverride; }
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_CONTROLLABLE_TARGET(WebCore::PageDebuggable, Web);
+
</ins><span class="cx"> #endif // ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span><span class="cx"> #endif // !defined(PageDebuggable_h)
</span></span></pre>
</div>
</div>

</body>
</html>