<!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>[159268] trunk/Source/WebCore</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/159268">159268</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2013-11-13 18:24:46 -0800 (Wed, 13 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Generate Individual InspectorBackendDispatchers, add base InspectorBackendDispatcher
https://bugs.webkit.org/show_bug.cgi?id=124296

Reviewed by Timothy Hatcher.

No new tests, this is just refactoring without changing functionality.
Set of changes made:

  - Add inspector/InspectorBackendDispatcher.{h,cpp}. This used to be almost entirely
    written in the code generator strings file, but make it actual source files
    because there is nothing changing in the code. Also clean this up a bit.
  - Give the base dispatcher a list of domain dispatchers and a way to register.
  - Make InspectorBackendDispatcher::dispatch read the domain of incoming request
    and pass the request on to the domain dispatcher.
  - Create per-domain dispatcher classes named &quot;InspectorFooBackendDispatcher&quot;
  - Convert &quot;InspectorBackendDispatcher::FooCommandHandler&quot; interfaces to
    &quot;InspectorFooBackendDispatcherHandler&quot; interfaces.
  - Convert all &quot;InspectorBackendDispatcherImpl::FooDomain_fooMethod&quot; methods to
    &quot;InspectorFooBackendDispatcher::fooMethod&quot; methods. These can also remove their
    &quot;if (!agent)&quot; checks because that can never be the case anymore.
  - Remove InspectorBackendDispatcherImpl, now that there are base and domain dispatchers.
  - Add ASCIILiteral in many places in generated code where possible.
  - In all agents, create dispatchers in didCreateFrontendAndBackend and clear
    them in willDestroyFrontendAndBackend, right alongside frontend dispatchers.

* inspector/CodeGeneratorInspector.py:
(DomainNameFixes.get_fixed_data.Res):
(TypeBindings.create_type_declaration_.EnumBinding.get_code_generator.CodeGenerator.generate_type_builder):
(Generator):
(Generator.go):
(Generator.process_command):
(Generator.generate_send_method):
* inspector/CodeGeneratorInspectorStrings.py:
(void):
(HashMap):
(InspectorBackendDispatchers_h):
* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::didCreateFrontendAndBackend):
(WebCore::InspectorAgent::willDestroyFrontendAndBackend):
* inspector/InspectorAgent.h:
* inspector/InspectorAllInOne.cpp:
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::didCreateFrontendAndBackend):
(WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend):
* inspector/InspectorApplicationCacheAgent.h:
* inspector/InspectorBackendDispatcher.cpp: Added.
(WebCore::InspectorBackendDispatcher::CallbackBase::CallbackBase):
(WebCore::InspectorBackendDispatcher::CallbackBase::isActive):
(WebCore::InspectorBackendDispatcher::CallbackBase::sendFailure):
(WebCore::InspectorBackendDispatcher::CallbackBase::sendIfActive):
(WebCore::InspectorBackendDispatcher::create):
(WebCore::InspectorBackendDispatcher::registerDispatcherForDomain):
(WebCore::InspectorBackendDispatcher::dispatch):
(WebCore::InspectorBackendDispatcher::sendResponse):
(WebCore::InspectorBackendDispatcher::reportProtocolError):
(WebCore::InspectorBackendDispatcher::getPropertyValue):
(WebCore::AsMethodBridges::asInt):
(WebCore::AsMethodBridges::asDouble):
(WebCore::AsMethodBridges::asString):
(WebCore::AsMethodBridges::asBoolean):
(WebCore::AsMethodBridges::asObject):
(WebCore::AsMethodBridges::asArray):
(WebCore::InspectorBackendDispatcher::getInt):
(WebCore::InspectorBackendDispatcher::getDouble):
(WebCore::InspectorBackendDispatcher::getString):
(WebCore::InspectorBackendDispatcher::getBoolean):
(WebCore::InspectorBackendDispatcher::getObject):
(WebCore::InspectorBackendDispatcher::getArray):
* inspector/InspectorBackendDispatcher.h: Added.
(WebCore::InspectorSupplementalBackendDispatcher::InspectorSupplementalBackendDispatcher):
(WebCore::InspectorSupplementalBackendDispatcher::~InspectorSupplementalBackendDispatcher):
(WebCore::InspectorBackendDispatcher::~InspectorBackendDispatcher):
(WebCore::InspectorBackendDispatcher::clearFrontend):
(WebCore::InspectorBackendDispatcher::isActive):
(WebCore::InspectorBackendDispatcher::InspectorBackendDispatcher):
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didCreateFrontendAndBackend):
(WebCore::InspectorCSSAgent::willDestroyFrontendAndBackend):
* inspector/InspectorCSSAgent.h:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
(WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
* inspector/InspectorCanvasAgent.h:
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::didCreateFrontendAndBackend):
(WebCore::InspectorConsoleAgent::willDestroyFrontendAndBackend):
* inspector/InspectorConsoleAgent.h:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
* inspector/InspectorDOMAgent.h:
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDOMDebuggerAgent::willDestroyFrontendAndBackend):
* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDOMStorageAgent::willDestroyFrontendAndBackend):
* inspector/InspectorDOMStorageAgent.h:
* inspector/InspectorDatabaseAgent.cpp:
(WebCore::InspectorDatabaseAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDatabaseAgent::willDestroyFrontendAndBackend):
* inspector/InspectorDatabaseAgent.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDebuggerAgent::willDestroyFrontendAndBackend):
* inspector/InspectorDebuggerAgent.h:
* inspector/InspectorHeapProfilerAgent.cpp:
(WebCore::InspectorHeapProfilerAgent::didCreateFrontendAndBackend):
(WebCore::InspectorHeapProfilerAgent::willDestroyFrontendAndBackend):
* inspector/InspectorHeapProfilerAgent.h:
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::didCreateFrontendAndBackend):
(WebCore::InspectorIndexedDBAgent::willDestroyFrontendAndBackend):
* inspector/InspectorIndexedDBAgent.h:
* inspector/InspectorInputAgent.cpp:
(WebCore::InspectorInputAgent::didCreateFrontendAndBackend):
(WebCore::InspectorInputAgent::willDestroyFrontendAndBackend):
* inspector/InspectorInputAgent.h:
* inspector/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::didCreateFrontendAndBackend):
(WebCore::InspectorLayerTreeAgent::willDestroyFrontendAndBackend):
* inspector/InspectorLayerTreeAgent.h:
* inspector/InspectorMemoryAgent.cpp:
(WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
(WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
* inspector/InspectorMemoryAgent.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::didCreateFrontendAndBackend):
(WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorPageAgent::getScriptExecutionStatus):
* inspector/InspectorPageAgent.h:
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::didCreateFrontendAndBackend):
(WebCore::InspectorProfilerAgent::willDestroyFrontendAndBackend):
* inspector/InspectorProfilerAgent.h:
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::didCreateFrontendAndBackend):
(WebCore::InspectorResourceAgent::willDestroyFrontendAndBackend):
* inspector/InspectorResourceAgent.h:
* inspector/InspectorRuntimeAgent.h:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
(WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
* inspector/InspectorTimelineAgent.h:
* inspector/InspectorWorkerAgent.cpp:
(WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend):
(WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend):
* inspector/InspectorWorkerAgent.h:
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::didCreateFrontendAndBackend):
(WebCore::PageRuntimeAgent::willDestroyFrontendAndBackend):
* inspector/PageRuntimeAgent.h:
* inspector/WorkerRuntimeAgent.cpp:
(WebCore::WorkerRuntimeAgent::didCreateFrontendAndBackend):
(WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend):
* inspector/WorkerRuntimeAgent.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreinspectorCodeGeneratorInspectorpy">trunk/Source/WebCore/inspector/CodeGeneratorInspector.py</a></li>
<li><a href="#trunkSourceWebCoreinspectorCodeGeneratorInspectorStringspy">trunk/Source/WebCore/inspector/CodeGeneratorInspectorStrings.py</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorAgentcpp">trunk/Source/WebCore/inspector/InspectorAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorAgenth">trunk/Source/WebCore/inspector/InspectorAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorAllInOnecpp">trunk/Source/WebCore/inspector/InspectorAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorApplicationCacheAgentcpp">trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorApplicationCacheAgenth">trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCSSAgentcpp">trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCSSAgenth">trunk/Source/WebCore/inspector/InspectorCSSAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCanvasAgentcpp">trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorCanvasAgenth">trunk/Source/WebCore/inspector/InspectorCanvasAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorConsoleAgentcpp">trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorConsoleAgenth">trunk/Source/WebCore/inspector/InspectorConsoleAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgenth">trunk/Source/WebCore/inspector/InspectorDOMAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMDebuggerAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMDebuggerAgenth">trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMStorageAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMStorageAgenth">trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDatabaseAgentcpp">trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDatabaseAgenth">trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDebuggerAgentcpp">trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDebuggerAgenth">trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorHeapProfilerAgentcpp">trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorHeapProfilerAgenth">trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgenth">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorInputAgentcpp">trunk/Source/WebCore/inspector/InspectorInputAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorInputAgenth">trunk/Source/WebCore/inspector/InspectorInputAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorLayerTreeAgentcpp">trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorLayerTreeAgenth">trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorMemoryAgentcpp">trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorMemoryAgenth">trunk/Source/WebCore/inspector/InspectorMemoryAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgentcpp">trunk/Source/WebCore/inspector/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgenth">trunk/Source/WebCore/inspector/InspectorPageAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorProfilerAgentcpp">trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorProfilerAgenth">trunk/Source/WebCore/inspector/InspectorProfilerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorResourceAgentcpp">trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorResourceAgenth">trunk/Source/WebCore/inspector/InspectorResourceAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorRuntimeAgenth">trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorTimelineAgentcpp">trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorTimelineAgenth">trunk/Source/WebCore/inspector/InspectorTimelineAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorWorkerAgentcpp">trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorWorkerAgenth">trunk/Source/WebCore/inspector/InspectorWorkerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageRuntimeAgentcpp">trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageRuntimeAgenth">trunk/Source/WebCore/inspector/PageRuntimeAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorWorkerRuntimeAgentcpp">trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorWorkerRuntimeAgenth">trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreinspectorInspectorBackendDispatchercpp">trunk/Source/WebCore/inspector/InspectorBackendDispatcher.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorBackendDispatcherh">trunk/Source/WebCore/inspector/InspectorBackendDispatcher.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/CMakeLists.txt        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -1571,6 +1571,7 @@
</span><span class="cx">     inspector/InspectorAgent.cpp
</span><span class="cx">     inspector/InspectorAgentRegistry.cpp
</span><span class="cx">     inspector/InspectorApplicationCacheAgent.cpp
</span><ins>+    inspector/InspectorBackendDispatcher.cpp
</ins><span class="cx">     inspector/InspectorCSSAgent.cpp
</span><span class="cx">     inspector/InspectorCanvasAgent.cpp
</span><span class="cx">     inspector/InspectorClient.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/ChangeLog        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -1,3 +1,163 @@
</span><ins>+2013-11-13  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Generate Individual InspectorBackendDispatchers, add base InspectorBackendDispatcher
+        https://bugs.webkit.org/show_bug.cgi?id=124296
+
+        Reviewed by Timothy Hatcher.
+
+        No new tests, this is just refactoring without changing functionality.
+        Set of changes made:
+
+          - Add inspector/InspectorBackendDispatcher.{h,cpp}. This used to be almost entirely
+            written in the code generator strings file, but make it actual source files
+            because there is nothing changing in the code. Also clean this up a bit.
+          - Give the base dispatcher a list of domain dispatchers and a way to register.
+          - Make InspectorBackendDispatcher::dispatch read the domain of incoming request
+            and pass the request on to the domain dispatcher.
+          - Create per-domain dispatcher classes named &quot;InspectorFooBackendDispatcher&quot;
+          - Convert &quot;InspectorBackendDispatcher::FooCommandHandler&quot; interfaces to
+            &quot;InspectorFooBackendDispatcherHandler&quot; interfaces.
+          - Convert all &quot;InspectorBackendDispatcherImpl::FooDomain_fooMethod&quot; methods to
+            &quot;InspectorFooBackendDispatcher::fooMethod&quot; methods. These can also remove their
+            &quot;if (!agent)&quot; checks because that can never be the case anymore.
+          - Remove InspectorBackendDispatcherImpl, now that there are base and domain dispatchers.
+          - Add ASCIILiteral in many places in generated code where possible.
+          - In all agents, create dispatchers in didCreateFrontendAndBackend and clear
+            them in willDestroyFrontendAndBackend, right alongside frontend dispatchers.
+
+        * inspector/CodeGeneratorInspector.py:
+        (DomainNameFixes.get_fixed_data.Res):
+        (TypeBindings.create_type_declaration_.EnumBinding.get_code_generator.CodeGenerator.generate_type_builder):
+        (Generator):
+        (Generator.go):
+        (Generator.process_command):
+        (Generator.generate_send_method):
+        * inspector/CodeGeneratorInspectorStrings.py:
+        (void):
+        (HashMap):
+        (InspectorBackendDispatchers_h):
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorAgent.h:
+        * inspector/InspectorAllInOne.cpp:
+        * inspector/InspectorApplicationCacheAgent.cpp:
+        (WebCore::InspectorApplicationCacheAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorApplicationCacheAgent.h:
+        * inspector/InspectorBackendDispatcher.cpp: Added.
+        (WebCore::InspectorBackendDispatcher::CallbackBase::CallbackBase):
+        (WebCore::InspectorBackendDispatcher::CallbackBase::isActive):
+        (WebCore::InspectorBackendDispatcher::CallbackBase::sendFailure):
+        (WebCore::InspectorBackendDispatcher::CallbackBase::sendIfActive):
+        (WebCore::InspectorBackendDispatcher::create):
+        (WebCore::InspectorBackendDispatcher::registerDispatcherForDomain):
+        (WebCore::InspectorBackendDispatcher::dispatch):
+        (WebCore::InspectorBackendDispatcher::sendResponse):
+        (WebCore::InspectorBackendDispatcher::reportProtocolError):
+        (WebCore::InspectorBackendDispatcher::getPropertyValue):
+        (WebCore::AsMethodBridges::asInt):
+        (WebCore::AsMethodBridges::asDouble):
+        (WebCore::AsMethodBridges::asString):
+        (WebCore::AsMethodBridges::asBoolean):
+        (WebCore::AsMethodBridges::asObject):
+        (WebCore::AsMethodBridges::asArray):
+        (WebCore::InspectorBackendDispatcher::getInt):
+        (WebCore::InspectorBackendDispatcher::getDouble):
+        (WebCore::InspectorBackendDispatcher::getString):
+        (WebCore::InspectorBackendDispatcher::getBoolean):
+        (WebCore::InspectorBackendDispatcher::getObject):
+        (WebCore::InspectorBackendDispatcher::getArray):
+        * inspector/InspectorBackendDispatcher.h: Added.
+        (WebCore::InspectorSupplementalBackendDispatcher::InspectorSupplementalBackendDispatcher):
+        (WebCore::InspectorSupplementalBackendDispatcher::~InspectorSupplementalBackendDispatcher):
+        (WebCore::InspectorBackendDispatcher::~InspectorBackendDispatcher):
+        (WebCore::InspectorBackendDispatcher::clearFrontend):
+        (WebCore::InspectorBackendDispatcher::isActive):
+        (WebCore::InspectorBackendDispatcher::InspectorBackendDispatcher):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorCSSAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorCSSAgent.h:
+        * inspector/InspectorCanvasAgent.cpp:
+        (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorCanvasAgent.h:
+        * inspector/InspectorConsoleAgent.cpp:
+        (WebCore::InspectorConsoleAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorConsoleAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorConsoleAgent.h:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorDOMDebuggerAgent.cpp:
+        (WebCore::InspectorDOMDebuggerAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorDOMDebuggerAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorDOMDebuggerAgent.h:
+        * inspector/InspectorDOMStorageAgent.cpp:
+        (WebCore::InspectorDOMStorageAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorDOMStorageAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorDOMStorageAgent.h:
+        * inspector/InspectorDatabaseAgent.cpp:
+        (WebCore::InspectorDatabaseAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorDatabaseAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorDatabaseAgent.h:
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorDebuggerAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorDebuggerAgent.h:
+        * inspector/InspectorHeapProfilerAgent.cpp:
+        (WebCore::InspectorHeapProfilerAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorHeapProfilerAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorHeapProfilerAgent.h:
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (WebCore::InspectorIndexedDBAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorIndexedDBAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorIndexedDBAgent.h:
+        * inspector/InspectorInputAgent.cpp:
+        (WebCore::InspectorInputAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorInputAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorInputAgent.h:
+        * inspector/InspectorLayerTreeAgent.cpp:
+        (WebCore::InspectorLayerTreeAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorLayerTreeAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorLayerTreeAgent.h:
+        * inspector/InspectorMemoryAgent.cpp:
+        (WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorMemoryAgent.h:
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
+        (WebCore::InspectorPageAgent::getScriptExecutionStatus):
+        * inspector/InspectorPageAgent.h:
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorProfilerAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorProfilerAgent.h:
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorResourceAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorResourceAgent.h:
+        * inspector/InspectorRuntimeAgent.h:
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorTimelineAgent.h:
+        * inspector/InspectorWorkerAgent.cpp:
+        (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorWorkerAgent.h:
+        * inspector/PageRuntimeAgent.cpp:
+        (WebCore::PageRuntimeAgent::didCreateFrontendAndBackend):
+        (WebCore::PageRuntimeAgent::willDestroyFrontendAndBackend):
+        * inspector/PageRuntimeAgent.h:
+        * inspector/WorkerRuntimeAgent.cpp:
+        (WebCore::WorkerRuntimeAgent::didCreateFrontendAndBackend):
+        (WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend):
+        * inspector/WorkerRuntimeAgent.h:
+
</ins><span class="cx"> 2013-11-13  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use NSCalendarIdentifierGregorian instead of NSGregorianCalendar on OS X 10.9 and iOS
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -3769,6 +3769,8 @@
</span><span class="cx">         Source/WebCore/inspector/InspectorAgentRegistry.h \
</span><span class="cx">         Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp \
</span><span class="cx">         Source/WebCore/inspector/InspectorApplicationCacheAgent.h \
</span><ins>+        Source/WebCore/inspector/InspectorBackendDispatcher.cpp \
+        Source/WebCore/inspector/InspectorBackendDispatcher.h \
</ins><span class="cx">         Source/WebCore/inspector/InspectorBaseAgent.h \
</span><span class="cx">         Source/WebCore/inspector/InspectorCanvasAgent.cpp \
</span><span class="cx">         Source/WebCore/inspector/InspectorCanvasAgent.h \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -3514,6 +3514,8 @@
</span><span class="cx">                 A5732B0A136A161D005C8D7C /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5732B08136A161D005C8D7C /* DateComponents.cpp */; };
</span><span class="cx">                 A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B09136A161D005C8D7C /* DateComponents.h */; };
</span><span class="cx">                 A5ABB78713B904BC00F197E3 /* LineBreakIteratorPoolICU.h in Headers */ = {isa = PBXBuildFile; fileRef = A5ABB78613B904BC00F197E3 /* LineBreakIteratorPoolICU.h */; };
</span><ins>+                A5AC4AEF18336975007114E0 /* InspectorBackendDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AC4AED18336975007114E0 /* InspectorBackendDispatcher.cpp */; };
+                A5AC4AF018336975007114E0 /* InspectorBackendDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AC4AEE18336975007114E0 /* InspectorBackendDispatcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AFB34D115151A700B045CB /* StepRange.cpp */; };
</span><span class="cx">                 A5AFB350115151A700B045CB /* StepRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AFB34E115151A700B045CB /* StepRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A5C566AB127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C566AA127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -10292,6 +10294,8 @@
</span><span class="cx">                 A5732B08136A161D005C8D7C /* DateComponents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateComponents.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5732B09136A161D005C8D7C /* DateComponents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateComponents.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5ABB78613B904BC00F197E3 /* LineBreakIteratorPoolICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineBreakIteratorPoolICU.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A5AC4AED18336975007114E0 /* InspectorBackendDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcher.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A5AC4AEE18336975007114E0 /* InspectorBackendDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackendDispatcher.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A5AFB34D115151A700B045CB /* StepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepRange.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5AFB34E115151A700B045CB /* StepRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepRange.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5C566AA127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiskImageCacheClientIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14387,6 +14391,8 @@
</span><span class="cx">                                 A556C287183206A8008CB720 /* InspectorAgentRegistry.h */,
</span><span class="cx">                                 B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */,
</span><span class="cx">                                 B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */,
</span><ins>+                                A5AC4AED18336975007114E0 /* InspectorBackendDispatcher.cpp */,
+                                A5AC4AEE18336975007114E0 /* InspectorBackendDispatcher.h */,
</ins><span class="cx">                                 7AA51B6C1483B61600AD2752 /* InspectorBaseAgent.h */,
</span><span class="cx">                                 AAD766E8157E502F00E85423 /* InspectorCanvasAgent.cpp */,
</span><span class="cx">                                 AAD766E9157E502F00E85423 /* InspectorCanvasAgent.h */,
</span><span class="lines">@@ -22255,6 +22261,7 @@
</span><span class="cx">                                 A80E6D010A1989CA007FB8C5 /* CSSInheritedValue.h in Headers */,
</span><span class="cx">                                 A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */,
</span><span class="cx">                                 BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */,
</span><ins>+                                A5AC4AF018336975007114E0 /* InspectorBackendDispatcher.h in Headers */,
</ins><span class="cx">                                 A80E6D030A1989CA007FB8C5 /* CSSMediaRule.h in Headers */,
</span><span class="cx">                                 F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */,
</span><span class="cx">                                 A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
</span><span class="lines">@@ -25617,6 +25624,7 @@
</span><span class="cx">                                 59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */,
</span><span class="cx">                                 F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */,
</span><span class="cx">                                 1A569CF70D7E2B82007C3983 /* c_class.cpp in Sources */,
</span><ins>+                                A5AC4AEF18336975007114E0 /* InspectorBackendDispatcher.cpp in Sources */,
</ins><span class="cx">                                 1A569CF90D7E2B82007C3983 /* c_instance.cpp in Sources */,
</span><span class="cx">                                 1A569CFB0D7E2B82007C3983 /* c_runtime.cpp in Sources */,
</span><span class="cx">                                 1A569CFD0D7E2B82007C3983 /* c_utility.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorCodeGeneratorInspectorpy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/CodeGeneratorInspector.py (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/CodeGeneratorInspector.py        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/CodeGeneratorInspector.py        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -190,7 +190,6 @@
</span><span class="cx"> 
</span><span class="cx">         class Res(object):
</span><span class="cx">             skip_js_bind = domain_name in cls.skip_js_bind_domains
</span><del>-            agent_field_name = field_name_res
</del><span class="cx"> 
</span><span class="cx">             @staticmethod
</span><span class="cx">             def get_guard():
</span><span class="lines">@@ -959,7 +958,7 @@
</span><span class="cx"> 
</span><span class="cx">                                 writer.newline(&quot;}; // struct &quot;)
</span><span class="cx">                                 writer.append(enum_name)
</span><del>-                                writer.append(&quot;\n\n&quot;)
</del><ins>+                                writer.append(&quot;\n&quot;)
</ins><span class="cx"> 
</span><span class="cx">                             @staticmethod
</span><span class="cx">                             def register_use(forward_listener):
</span><span class="lines">@@ -1245,7 +1244,7 @@
</span><span class="cx">                                     writer.append_multiline(&quot;\n    void %s&quot; % setter_name)
</span><span class="cx">                                     writer.append(&quot;(%s value)\n&quot; % param_type_binding.get_type_model().get_input_param_type_text())
</span><span class="cx">                                     writer.newline(&quot;    {\n&quot;)
</span><del>-                                    writer.newline(&quot;        this-&gt;set%s(\&quot;%s\&quot;, %s);\n&quot;
</del><ins>+                                    writer.newline(&quot;        this-&gt;set%s(ASCIILiteral(\&quot;%s\&quot;), %s);\n&quot;
</ins><span class="cx">                                         % (param_type_binding.reduce_to_raw_type().get_setter_name(), prop_data.p[&quot;name&quot;],
</span><span class="cx">                                            format_setter_value_expression(param_type_binding, &quot;value&quot;)))
</span><span class="cx">                                     writer.newline(&quot;    }\n&quot;)
</span><span class="lines">@@ -1730,6 +1729,8 @@
</span><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="cx">     frontend_domain_class = string.Template(CodeGeneratorInspectorStrings.frontend_domain_class)
</span><ins>+    backend_dispatcher_constructor = string.Template(CodeGeneratorInspectorStrings.backend_dispatcher_constructor)
+    backend_dispatcher_dispatch_method = string.Template(CodeGeneratorInspectorStrings.backend_dispatcher_dispatch_method)
</ins><span class="cx">     backend_method = string.Template(CodeGeneratorInspectorStrings.backend_method)
</span><span class="cx">     frontend_method = string.Template(CodeGeneratorInspectorStrings.frontend_method)
</span><span class="cx">     callback_method = string.Template(CodeGeneratorInspectorStrings.callback_method)
</span><span class="lines">@@ -1823,19 +1824,12 @@
</span><span class="cx"> class Generator:
</span><span class="cx">     frontend_domain_class_lines = []
</span><span class="cx"> 
</span><del>-    method_name_enum_list = []
-    backend_method_declaration_list = []
</del><span class="cx">     backend_method_implementation_list = []
</span><del>-    backend_method_name_declaration_list = []
-    method_handler_list = []
</del><span class="cx">     frontend_method_list = []
</span><span class="cx">     backend_js_domain_initializer_list = []
</span><span class="cx"> 
</span><del>-    backend_virtual_setters_list = []
-    backend_agent_interface_list = []
-    backend_setters_list = []
-    backend_constructor_init_list = []
-    backend_field_list = []
</del><ins>+    backend_handler_interface_list = []
+    backend_dispatcher_interface_list = []
</ins><span class="cx">     type_builder_fragments = []
</span><span class="cx">     type_builder_forwards = []
</span><span class="cx">     validator_impl_list = []
</span><span class="lines">@@ -1847,16 +1841,9 @@
</span><span class="cx">         Generator.process_types(type_map)
</span><span class="cx"> 
</span><span class="cx">         first_cycle_guardable_list_list = [
</span><del>-            Generator.backend_method_declaration_list,
</del><span class="cx">             Generator.backend_method_implementation_list,
</span><del>-            Generator.backend_method_name_declaration_list,
-            Generator.backend_agent_interface_list,
-            Generator.method_handler_list,
-            Generator.method_name_enum_list,
-            Generator.backend_constructor_init_list,
-            Generator.backend_virtual_setters_list,
-            Generator.backend_setters_list,
-            Generator.backend_field_list]
</del><ins>+            Generator.backend_handler_interface_list,
+            Generator.backend_dispatcher_interface_list]
</ins><span class="cx"> 
</span><span class="cx">         for json_domain in json_api[&quot;domains&quot;]:
</span><span class="cx">             domain_name = json_domain[&quot;domain&quot;]
</span><span class="lines">@@ -1870,8 +1857,6 @@
</span><span class="cx">                 for l in first_cycle_guardable_list_list:
</span><span class="cx">                     domain_guard.generate_open(l)
</span><span class="cx"> 
</span><del>-            agent_field_name = domain_fixes.agent_field_name
-
</del><span class="cx">             frontend_method_declaration_lines = []
</span><span class="cx"> 
</span><span class="cx">             Generator.backend_js_domain_initializer_list.append(&quot;// %s.\n&quot; % domain_name)
</span><span class="lines">@@ -1907,21 +1892,44 @@
</span><span class="cx">                     domain_guard.generate_close(Generator.frontend_method_list)
</span><span class="cx">                     domain_guard.generate_close(Generator.frontend_domain_class_lines)
</span><span class="cx"> 
</span><del>-            agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + &quot;CommandHandler&quot;
-            Generator.backend_agent_interface_list.append(&quot;    class %s {\n&quot; % agent_interface_name)
-            Generator.backend_agent_interface_list.append(&quot;    public:\n&quot;)
</del><ins>+            dispatcher_name = &quot;Inspector&quot; + Capitalizer.lower_camel_case_to_upper(domain_name) + &quot;BackendDispatcher&quot;
+            agent_interface_name = dispatcher_name + &quot;Handler&quot;
+
+            Generator.backend_dispatcher_interface_list.append(&quot;class %s FINAL : public InspectorSupplementalBackendDispatcher {\n&quot; % dispatcher_name)
+            Generator.backend_dispatcher_interface_list.append(&quot;public:\n&quot;)
+            Generator.backend_dispatcher_interface_list.append(&quot;    static PassRefPtr&lt;%s&gt; create(InspectorBackendDispatcher*, %s*);\n&quot; % (dispatcher_name, agent_interface_name))
+            Generator.backend_dispatcher_interface_list.append(&quot;    virtual void dispatch(long callId, const String&amp; method, PassRefPtr&lt;InspectorObject&gt; message) OVERRIDE;\n&quot;)
+            Generator.backend_dispatcher_interface_list.append(&quot;private:\n&quot;)
+
+            Generator.backend_handler_interface_list.append(&quot;class %s {\n&quot; % agent_interface_name)
+            Generator.backend_handler_interface_list.append(&quot;public:\n&quot;)
+
+            backend_method_count = len(Generator.backend_method_implementation_list)
+
+            dispatcher_commands_list = []
</ins><span class="cx">             if &quot;commands&quot; in json_domain:
</span><span class="cx">                 for json_command in json_domain[&quot;commands&quot;]:
</span><del>-                    Generator.process_command(json_command, domain_name, agent_field_name, agent_interface_name)
-            Generator.backend_agent_interface_list.append(&quot;\n    protected:\n&quot;)
-            Generator.backend_agent_interface_list.append(&quot;        virtual ~%s() { }\n&quot; % agent_interface_name)
-            Generator.backend_agent_interface_list.append(&quot;    };\n\n&quot;)
</del><ins>+                    Generator.process_command(json_command, domain_name, agent_interface_name, dispatcher_name, dispatcher_commands_list)
</ins><span class="cx"> 
</span><del>-            Generator.backend_constructor_init_list.append(&quot;        , m_%s(0)&quot; % agent_field_name)
-            Generator.backend_virtual_setters_list.append(&quot;    virtual void registerAgent(%s* %s) = 0;&quot; % (agent_interface_name, agent_field_name))
-            Generator.backend_setters_list.append(&quot;    virtual void registerAgent(%s* %s) { ASSERT(!m_%s); m_%s = %s; }&quot; % (agent_interface_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name))
-            Generator.backend_field_list.append(&quot;    %s* m_%s;&quot; % (agent_interface_name, agent_field_name))
</del><ins>+            Generator.backend_handler_interface_list.append(&quot;protected:\n&quot;)
+            Generator.backend_handler_interface_list.append(&quot;    virtual ~%s() { }\n&quot; % agent_interface_name)
+            Generator.backend_handler_interface_list.append(&quot;};\n\n&quot;)
</ins><span class="cx"> 
</span><ins>+            Generator.backend_dispatcher_interface_list.append(&quot;private:\n&quot;)
+            Generator.backend_dispatcher_interface_list.append(&quot;    %s(InspectorBackendDispatcher*, %s*);\n&quot; % (dispatcher_name, agent_interface_name))
+            Generator.backend_dispatcher_interface_list.append(&quot;    %s* m_agent;\n&quot; % agent_interface_name)
+            Generator.backend_dispatcher_interface_list.append(&quot;};\n\n&quot;)
+
+            Generator.backend_method_implementation_list.insert(backend_method_count, Templates.backend_dispatcher_constructor.substitute(None,
+                domainName=domain_name,
+                dispatcherName=dispatcher_name,
+                agentName=agent_interface_name))
+
+            Generator.backend_method_implementation_list.insert(backend_method_count + 1, Templates.backend_dispatcher_dispatch_method.substitute(None,
+                domainName=domain_name,
+                dispatcherName=dispatcher_name,
+                dispatcherCommands=&quot;\n&quot;.join(dispatcher_commands_list)))
+
</ins><span class="cx">             if domain_guard:
</span><span class="cx">                 for l in reversed(first_cycle_guardable_list_list):
</span><span class="cx">                     domain_guard.generate_close(l)
</span><span class="lines">@@ -1976,20 +1984,18 @@
</span><span class="cx">         container_name = &quot;paramsObject&quot;
</span><span class="cx"> 
</span><span class="cx">     @staticmethod
</span><del>-    def process_command(json_command, domain_name, agent_field_name, agent_interface_name):
</del><ins>+    def process_command(json_command, domain_name, agent_interface_name, dispatcher_name, dispatcher_commands_list):
</ins><span class="cx">         json_command_name = json_command[&quot;name&quot;]
</span><span class="cx"> 
</span><del>-        cmd_enum_name = &quot;k%s_%sCmd&quot; % (domain_name, json_command[&quot;name&quot;])
</del><ins>+        ad_hoc_type_output = []
+        Generator.backend_handler_interface_list.append(ad_hoc_type_output)
+        ad_hoc_type_writer = Writer(ad_hoc_type_output, &quot;    &quot;)
</ins><span class="cx"> 
</span><del>-        Generator.method_name_enum_list.append(&quot;        %s,&quot; % cmd_enum_name)
-        Generator.method_handler_list.append(&quot;            &amp;InspectorBackendDispatcherImpl::%s_%s,&quot; % (domain_name, json_command_name))
-        Generator.backend_method_declaration_list.append(&quot;    void %s_%s(long callId, InspectorObject* requestMessageObject);&quot; % (domain_name, json_command_name))
</del><ins>+        Generator.backend_dispatcher_interface_list.append(&quot;    void %s(long callId, const InspectorObject&amp; message);\n&quot; % json_command_name)
</ins><span class="cx"> 
</span><del>-        ad_hoc_type_output = []
-        Generator.backend_agent_interface_list.append(ad_hoc_type_output)
-        ad_hoc_type_writer = Writer(ad_hoc_type_output, &quot;        &quot;)
</del><ins>+        Generator.backend_handler_interface_list.append(&quot;    virtual void %s(ErrorString*&quot; % json_command_name)
</ins><span class="cx"> 
</span><del>-        Generator.backend_agent_interface_list.append(&quot;        virtual void %s(ErrorString*&quot; % json_command_name)
</del><ins>+        dispatcher_commands_list.append(&quot;            { \&quot;%s\&quot;,  &amp;%s::%s },&quot; % (json_command_name, dispatcher_name, json_command_name))
</ins><span class="cx"> 
</span><span class="cx">         method_in_code = &quot;&quot;
</span><span class="cx">         method_out_code = &quot;&quot;
</span><span class="lines">@@ -2000,7 +2006,7 @@
</span><span class="cx">         if &quot;parameters&quot; in json_command:
</span><span class="cx">             json_params = json_command[&quot;parameters&quot;]
</span><span class="cx">             method_in_code += Templates.param_container_access_code
</span><del>-            request_message_param = &quot; requestMessageObject&quot;
</del><ins>+            request_message_param = &quot; message&quot;
</ins><span class="cx">             js_param_list = []
</span><span class="cx"> 
</span><span class="cx">             for json_parameter in json_params:
</span><span class="lines">@@ -2019,13 +2025,13 @@
</span><span class="cx"> 
</span><span class="cx">                 if optional:
</span><span class="cx">                     code = (&quot;    bool %s_valueFound = false;\n&quot;
</span><del>-                            &quot;    %s in_%s = get%s(paramsContainerPtr, \&quot;%s\&quot;, &amp;%s_valueFound, protocolErrorsPtr);\n&quot; %
</del><ins>+                            &quot;    %s in_%s = InspectorBackendDispatcher::get%s(paramsContainerPtr, ASCIILiteral(\&quot;%s\&quot;), &amp;%s_valueFound, protocolErrorsPtr);\n&quot; %
</ins><span class="cx">                            (json_param_name, non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name, json_param_name))
</span><span class="cx">                     param = &quot;, %s_valueFound ? &amp;in_%s : 0&quot; % (json_param_name, json_param_name)
</span><span class="cx">                     # FIXME: pass optional refptr-values as PassRefPtr
</span><span class="cx">                     formal_param_type_pattern = &quot;const %s*&quot;
</span><span class="cx">                 else:
</span><del>-                    code = (&quot;    %s in_%s = get%s(paramsContainerPtr, \&quot;%s\&quot;, 0, protocolErrorsPtr);\n&quot; %
</del><ins>+                    code = (&quot;    %s in_%s = InspectorBackendDispatcher::get%s(paramsContainerPtr, ASCIILiteral(\&quot;%s\&quot;), nullptr, protocolErrorsPtr);\n&quot; %
</ins><span class="cx">                             (non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name))
</span><span class="cx">                     param = &quot;, in_%s&quot; % json_param_name
</span><span class="cx">                     # FIXME: pass not-optional refptr-values as NonNullPassRefPtr
</span><span class="lines">@@ -2036,7 +2042,7 @@
</span><span class="cx"> 
</span><span class="cx">                 method_in_code += code
</span><span class="cx">                 agent_call_param_list.append(param)
</span><del>-                Generator.backend_agent_interface_list.append(&quot;, %s in_%s&quot; % (formal_param_type_pattern % non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name))
</del><ins>+                Generator.backend_handler_interface_list.append(&quot;, %s in_%s&quot; % (formal_param_type_pattern % non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name))
</ins><span class="cx"> 
</span><span class="cx">                 js_bind_type = param_raw_type.get_js_bind_type()
</span><span class="cx">                 js_param_text = &quot;{\&quot;name\&quot;: \&quot;%s\&quot;, \&quot;type\&quot;: \&quot;%s\&quot;, \&quot;optional\&quot;: %s}&quot; % (
</span><span class="lines">@@ -2060,22 +2066,22 @@
</span><span class="cx">                                            decl_parameter_list,
</span><span class="cx">                                            Generator.CallbackMethodStructTemplate,
</span><span class="cx">                                            Generator.backend_method_implementation_list, Templates.callback_method,
</span><del>-                                           {&quot;callbackName&quot;: callback_name, &quot;agentName&quot;: agent_interface_name})
</del><ins>+                                           {&quot;callbackName&quot;: callback_name, &quot;handlerName&quot;: agent_interface_name})
</ins><span class="cx"> 
</span><del>-            callback_writer.newline(&quot;class &quot; + callback_name + &quot; : public CallbackBase {\n&quot;)
</del><ins>+            callback_writer.newline(&quot;class &quot; + callback_name + &quot; : public InspectorBackendDispatcher::CallbackBase {\n&quot;)
</ins><span class="cx">             callback_writer.newline(&quot;public:\n&quot;)
</span><del>-            callback_writer.newline(&quot;    &quot; + callback_name + &quot;(PassRefPtr&lt;InspectorBackendDispatcherImpl&gt;, int id);\n&quot;)
</del><ins>+            callback_writer.newline(&quot;    &quot; + callback_name + &quot;(PassRefPtr&lt;InspectorBackendDispatcher&gt;, int id);\n&quot;)
</ins><span class="cx">             callback_writer.newline(&quot;    void sendSuccess(&quot; + &quot;, &quot;.join(decl_parameter_list) + &quot;);\n&quot;)
</span><span class="cx">             callback_writer.newline(&quot;};\n&quot;)
</span><span class="cx"> 
</span><span class="cx">             ad_hoc_type_output.append(callback_output)
</span><span class="cx"> 
</span><del>-            method_out_code += &quot;    RefPtr&lt;&quot; + agent_interface_name + &quot;::&quot; + callback_name + &quot;&gt; callback = adoptRef(new &quot; + agent_interface_name + &quot;::&quot; + callback_name + &quot;(this, callId));\n&quot;
</del><ins>+            method_out_code += &quot;    RefPtr&lt;&quot; + agent_interface_name + &quot;::&quot; + callback_name + &quot;&gt; callback = adoptRef(new &quot; + agent_interface_name + &quot;::&quot; + callback_name + &quot;(m_backendDispatcher, callId));\n&quot;
</ins><span class="cx">             agent_call_param_list.append(&quot;, callback&quot;)
</span><del>-            response_cook_text += &quot;        if (!error.length()) \n&quot;
</del><ins>+            response_cook_text += &quot;        if (!error.length())\n&quot;
</ins><span class="cx">             response_cook_text += &quot;            return;\n&quot;
</span><span class="cx">             response_cook_text += &quot;        callback-&gt;disable();\n&quot;
</span><del>-            Generator.backend_agent_interface_list.append(&quot;, PassRefPtr&lt;%s&gt; callback&quot; % callback_name)
</del><ins>+            Generator.backend_handler_interface_list.append(&quot;, PassRefPtr&lt;%s&gt; callback&quot; % callback_name)
</ins><span class="cx">         else:
</span><span class="cx">             if &quot;returns&quot; in json_command:
</span><span class="cx">                 method_out_code += &quot;\n&quot;
</span><span class="lines">@@ -2102,7 +2108,7 @@
</span><span class="cx">                     if return_type_binding.get_setter_value_expression_pattern():
</span><span class="cx">                         setter_argument = return_type_binding.get_setter_value_expression_pattern() % setter_argument
</span><span class="cx"> 
</span><del>-                    cook = &quot;            result-&gt;set%s(\&quot;%s\&quot;, %s);\n&quot; % (setter_type, json_return_name,
</del><ins>+                    cook = &quot;            result-&gt;set%s(ASCIILiteral(\&quot;%s\&quot;), %s);\n&quot; % (setter_type, json_return_name,
</ins><span class="cx">                                                                          setter_argument)
</span><span class="cx"> 
</span><span class="cx">                     set_condition_pattern = type_model.get_command_return_pass_model().get_set_return_condition()
</span><span class="lines">@@ -2114,7 +2120,7 @@
</span><span class="cx">                     if optional:
</span><span class="cx">                         param_name = &quot;opt_&quot; + param_name
</span><span class="cx"> 
</span><del>-                    Generator.backend_agent_interface_list.append(&quot;, %s %s&quot; % (annotated_type, param_name))
</del><ins>+                    Generator.backend_handler_interface_list.append(&quot;, %s %s&quot; % (annotated_type, param_name))
</ins><span class="cx">                     response_cook_list.append(cook)
</span><span class="cx"> 
</span><span class="cx">                     method_out_code += code
</span><span class="lines">@@ -2134,18 +2140,16 @@
</span><span class="cx">         js_reply_list = &quot;[%s]&quot; % &quot;, &quot;.join(backend_js_reply_param_list)
</span><span class="cx"> 
</span><span class="cx">         Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None,
</span><del>-            domainName=domain_name, methodName=json_command_name,
-            agentField=&quot;m_&quot; + agent_field_name,
</del><ins>+            dispatcherName=dispatcher_name,
+            methodName=json_command_name,
</ins><span class="cx">             methodInCode=method_in_code,
</span><span class="cx">             methodOutCode=method_out_code,
</span><span class="cx">             agentCallParams=&quot;&quot;.join(agent_call_param_list),
</span><span class="cx">             requestMessageObject=request_message_param,
</span><del>-            responseCook=response_cook_text,
-            commandNameIndex=cmd_enum_name))
-        Generator.backend_method_name_declaration_list.append(&quot;    \&quot;%s.%s\&quot;,&quot; % (domain_name, json_command_name))
</del><ins>+            responseCook=response_cook_text))
</ins><span class="cx"> 
</span><span class="cx">         Generator.backend_js_domain_initializer_list.append(&quot;InspectorBackend.registerCommand(\&quot;%s.%s\&quot;, [%s], %s);\n&quot; % (domain_name, json_command_name, js_parameters_text, js_reply_list))
</span><del>-        Generator.backend_agent_interface_list.append(&quot;) = 0;\n&quot;)
</del><ins>+        Generator.backend_handler_interface_list.append(&quot;) = 0;\n&quot;)
</ins><span class="cx"> 
</span><span class="cx">     class CallbackMethodStructTemplate:
</span><span class="cx">         @staticmethod
</span><span class="lines">@@ -2193,7 +2197,7 @@
</span><span class="cx">                 if mode_type_binding.get_setter_value_expression_pattern():
</span><span class="cx">                     setter_argument = mode_type_binding.get_setter_value_expression_pattern() % setter_argument
</span><span class="cx"> 
</span><del>-                setter_code = &quot;    %s-&gt;set%s(\&quot;%s\&quot;, %s);\n&quot; % (method_struct_template.container_name, setter_type, parameter_name, setter_argument)
</del><ins>+                setter_code = &quot;    %s-&gt;set%s(ASCIILiteral(\&quot;%s\&quot;), %s);\n&quot; % (method_struct_template.container_name, setter_type, parameter_name, setter_argument)
</ins><span class="cx">                 if optional:
</span><span class="cx">                     setter_code = (&quot;    if (%s)\n    &quot; % parameter_name) + setter_code
</span><span class="cx">                 method_line_list.append(setter_code)
</span><span class="lines">@@ -2375,18 +2379,11 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> backend_h_file.write(Templates.backend_h.substitute(None,
</span><del>-    virtualSetters=&quot;\n&quot;.join(Generator.backend_virtual_setters_list),
-    agentInterfaces=&quot;&quot;.join(flatten_list(Generator.backend_agent_interface_list)),
-    methodNamesEnumContent=&quot;\n&quot;.join(Generator.method_name_enum_list)))
</del><ins>+    handlerInterfaces=&quot;&quot;.join(flatten_list(Generator.backend_handler_interface_list)),
+    dispatcherInterfaces=&quot;&quot;.join(flatten_list(Generator.backend_dispatcher_interface_list))))
</ins><span class="cx"> 
</span><span class="cx"> backend_cpp_file.write(Templates.backend_cpp.substitute(None,
</span><del>-    constructorInit=&quot;\n&quot;.join(Generator.backend_constructor_init_list),
-    setters=&quot;\n&quot;.join(Generator.backend_setters_list),
-    fieldDeclarations=&quot;\n&quot;.join(Generator.backend_field_list),
-    methodNameDeclarations=&quot;\n&quot;.join(Generator.backend_method_name_declaration_list),
-    methods=&quot;\n&quot;.join(Generator.backend_method_implementation_list),
-    methodDeclarations=&quot;\n&quot;.join(Generator.backend_method_declaration_list),
-    messageHandlers=&quot;\n&quot;.join(Generator.method_handler_list)))
</del><ins>+    methods=&quot;\n&quot;.join(Generator.backend_method_implementation_list)))
</ins><span class="cx"> 
</span><span class="cx"> frontend_h_file.write(Templates.frontend_h.substitute(None,
</span><span class="cx">     domainClassList=&quot;&quot;.join(Generator.frontend_domain_class_lines)))
</span><span class="lines">@@ -2418,3 +2415,14 @@
</span><span class="cx"> typebuilder_cpp_file.close()
</span><span class="cx"> 
</span><span class="cx"> backend_js_file.close()
</span><ins>+
+# FIXME: This exists to remove some old generated files that can cause build issues if
+# a compiler includes the old files instead of the new files with the same name. This
+# can be removed after a week or so once bots and developers have built with this.
+# Otherwise, developers can always just do a clean build or remove their DerivedSources.
+old_backend_h_file = os.path.join(output_header_dirname, &quot;InspectorBackendDispatcher.h&quot;)
+old_backend_cpp_file = os.path.join(output_header_dirname, &quot;InspectorBackendDispatcher.cpp&quot;)
+if os.path.exists(old_backend_h_file):
+    os.remove(old_backend_h_file)
+if os.path.exists(old_backend_cpp_file):
+    os.remove(old_backend_cpp_file)
</ins></span></pre></div>
<a id="trunkSourceWebCoreinspectorCodeGeneratorInspectorStringspy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/CodeGeneratorInspectorStrings.py (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/CodeGeneratorInspectorStrings.py        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/CodeGeneratorInspectorStrings.py        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -39,23 +39,63 @@
</span><span class="cx"> 
</span><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><ins>+backend_dispatcher_constructor = (
+&quot;&quot;&quot;PassRefPtr&lt;${dispatcherName}&gt; ${dispatcherName}::create(InspectorBackendDispatcher* backendDispatcher, ${agentName}* agent)
+{
+    return adoptRef(new ${dispatcherName}(backendDispatcher, agent));
+}
+
+${dispatcherName}::${dispatcherName}(InspectorBackendDispatcher* backendDispatcher, ${agentName}* agent)
+    : InspectorSupplementalBackendDispatcher(backendDispatcher)
+    , m_agent(agent)
+{
+    m_backendDispatcher-&gt;registerDispatcherForDomain(ASCIILiteral(&quot;${domainName}&quot;), this);
+}
+&quot;&quot;&quot;)
+
+backend_dispatcher_dispatch_method = (
+&quot;&quot;&quot;void ${dispatcherName}::dispatch(long callId, const String&amp; method, PassRefPtr&lt;InspectorObject&gt; message)
+{
+    Ref&lt;${dispatcherName}&gt; protect(*this);
+
+    typedef void (${dispatcherName}::*CallHandler)(long callId, const InspectorObject&amp; message);
+    typedef HashMap&lt;String, CallHandler&gt; DispatchMap;
+    DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ());
+    if (dispatchMap.isEmpty()) {
+        static const struct MethodTable {
+            const char* name;
+            CallHandler handler;
+        } commands[] = {
+${dispatcherCommands}
+        };
+        size_t length = WTF_ARRAY_LENGTH(commands);
+        for (size_t i = 0; i &lt; length; ++i)
+            dispatchMap.add(commands[i].name, commands[i].handler);
+    }
+
+    HashMap&lt;String, CallHandler&gt;::iterator it = dispatchMap.find(method);
+    if (it == dispatchMap.end()) {
+        m_backendDispatcher-&gt;reportProtocolError(&amp;callId, InspectorBackendDispatcher::MethodNotFound, String(&quot;'&quot;) + &quot;${domainName}&quot; + '.' + method + &quot;' was not found&quot;);
+        return;
+    }
+
+    ((*this).*it-&gt;value)(callId, *message.get());
+}
+&quot;&quot;&quot;)
+
</ins><span class="cx"> backend_method = (
</span><del>-&quot;&quot;&quot;void InspectorBackendDispatcherImpl::${domainName}_$methodName(long callId, InspectorObject*$requestMessageObject)
</del><ins>+&quot;&quot;&quot;void ${dispatcherName}::${methodName}(long callId, const InspectorObject&amp;${requestMessageObject})
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorArray&gt; protocolErrors = InspectorArray::create();
</span><del>-
-    if (!$agentField)
-        protocolErrors-&gt;pushString(&quot;${domainName} handler is not available.&quot;);
-$methodOutCode
-$methodInCode
</del><ins>+${methodOutCode}${methodInCode}
</ins><span class="cx">     RefPtr&lt;InspectorObject&gt; result = InspectorObject::create();
</span><span class="cx">     ErrorString error;
</span><span class="cx">     if (!protocolErrors-&gt;length()) {
</span><del>-        $agentField-&gt;$methodName(&amp;error$agentCallParams);
</del><ins>+        m_agent-&gt;${methodName}(&amp;error${agentCallParams});
</ins><span class="cx"> 
</span><span class="cx"> ${responseCook}
</span><span class="cx">     }
</span><del>-    sendResponse(callId, result.release(), commandNames[$commandNameIndex], protocolErrors.release(), error);
</del><ins>+    m_backendDispatcher-&gt;sendResponse(callId, result.release(), protocolErrors.release(), error);
</ins><span class="cx"> }
</span><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="lines">@@ -69,12 +109,12 @@
</span><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="cx"> callback_method = (
</span><del>-&quot;&quot;&quot;InspectorBackendDispatcher::$agentName::$callbackName::$callbackName(PassRefPtr&lt;InspectorBackendDispatcherImpl&gt; backendImpl, int id) : CallbackBase(backendImpl, id) {}
</del><ins>+&quot;&quot;&quot;${handlerName}::${callbackName}::${callbackName}(PassRefPtr&lt;InspectorBackendDispatcher&gt; backendDispatcher, int id) : InspectorBackendDispatcher::CallbackBase(backendDispatcher, id) { }
</ins><span class="cx"> 
</span><del>-void InspectorBackendDispatcher::$agentName::$callbackName::sendSuccess($parameters)
</del><ins>+void ${handlerName}::${callbackName}::sendSuccess(${parameters})
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorObject&gt; jsonMessage = InspectorObject::create();
</span><del>-$code    sendIfActive(jsonMessage, ErrorString());
</del><ins>+${code}    sendIfActive(jsonMessage, ErrorString());
</ins><span class="cx"> }
</span><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="lines">@@ -106,84 +146,28 @@
</span><span class="cx"> &quot;&quot;&quot;#ifndef InspectorBackendDispatchers_h
</span><span class="cx"> #define InspectorBackendDispatchers_h
</span><span class="cx"> 
</span><ins>+#include &quot;InspectorBackendDispatcher.h&quot;
+#include &quot;InspectorTypeBuilder.h&quot;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><del>-#include &quot;InspectorTypeBuilder.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class InspectorAgent;
</del><span class="cx"> class InspectorObject;
</span><span class="cx"> class InspectorArray;
</span><del>-class InspectorFrontendChannel;
</del><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorBackendDispatcherImpl;
</del><ins>+$handlerInterfaces
</ins><span class="cx"> 
</span><del>-class InspectorBackendDispatcher: public RefCounted&lt;InspectorBackendDispatcher&gt; {
-public:
-    static PassRefPtr&lt;InspectorBackendDispatcher&gt; create(InspectorFrontendChannel* inspectorFrontendChannel);
-    virtual ~InspectorBackendDispatcher() { }
-
-    class CallbackBase: public RefCounted&lt;CallbackBase&gt; {
-    public:
-        CallbackBase(PassRefPtr&lt;InspectorBackendDispatcherImpl&gt; backendImpl, int id);
-        virtual ~CallbackBase();
-        void sendFailure(const ErrorString&amp;);
-        bool isActive();
-
-    protected:
-        void sendIfActive(PassRefPtr&lt;InspectorObject&gt; partialMessage, const ErrorString&amp; invocationError);
-
-    private:
-        void disable() { m_alreadySent = true; }
-
-        RefPtr&lt;InspectorBackendDispatcherImpl&gt; m_backendImpl;
-        int m_id;
-        bool m_alreadySent;
-
-        friend class InspectorBackendDispatcherImpl;
-    };
-
-$agentInterfaces
-$virtualSetters
-
-    virtual void clearFrontend() = 0;
-
-    enum CommonErrorCode {
-        ParseError = 0,
-        InvalidRequest,
-        MethodNotFound,
-        InvalidParams,
-        InternalError,
-        ServerError,
-        LastEntry,
-    };
-
-    void reportProtocolError(const long* const callId, CommonErrorCode, const String&amp; errorMessage) const;
-    virtual void reportProtocolError(const long* const callId, CommonErrorCode, const String&amp; errorMessage, PassRefPtr&lt;InspectorArray&gt; data) const = 0;
-    virtual void dispatch(const String&amp; message) = 0;
-
-    enum MethodNames {
-$methodNamesEnumContent
-
-        kMethodNamesEnumSize
-    };
-
-    static const char* commandNames[];
-};
-
</del><ins>+$dispatcherInterfaces
</ins><span class="cx"> } // namespace WebCore
</span><del>-#endif // !defined(InspectorBackendDispatchers_h)
</del><span class="cx"> 
</span><del>-
</del><ins>+#endif // !defined(InspectorBackendDispatchers_h)
</ins><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="cx"> backend_cpp = (
</span><span class="cx"> &quot;&quot;&quot;
</span><del>-
</del><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="lines">@@ -198,275 +182,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* InspectorBackendDispatcher::commandNames[] = {
-$methodNameDeclarations
-};
-
-
-class InspectorBackendDispatcherImpl : public InspectorBackendDispatcher {
-public:
-    InspectorBackendDispatcherImpl(InspectorFrontendChannel* inspectorFrontendChannel)
-        : m_inspectorFrontendChannel(inspectorFrontendChannel)
-$constructorInit
-    { }
-
-    virtual void clearFrontend() { m_inspectorFrontendChannel = 0; }
-    virtual void dispatch(const String&amp; message);
-    virtual void reportProtocolError(const long* const callId, CommonErrorCode, const String&amp; errorMessage, PassRefPtr&lt;InspectorArray&gt; data) const;
-    using InspectorBackendDispatcher::reportProtocolError;
-
-    void sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, const ErrorString&amp; invocationError);
-    bool isActive() { return m_inspectorFrontendChannel; }
-
-$setters
-private:
-$methodDeclarations
-
-    InspectorFrontendChannel* m_inspectorFrontendChannel;
-$fieldDeclarations
-
-    template&lt;typename R, typename V, typename V0&gt;
-    static R getPropertyValueImpl(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors, V0 initial_value, bool (*as_method)(InspectorValue*, V*), const char* type_name);
-
-    static int getInt(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
-    static double getDouble(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
-    static String getString(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
-    static bool getBoolean(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
-    static PassRefPtr&lt;InspectorObject&gt; getObject(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
-    static PassRefPtr&lt;InspectorArray&gt; getArray(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
-
-    void sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, const char* commandName, PassRefPtr&lt;InspectorArray&gt; protocolErrors, ErrorString invocationError);
-
-};
-
</del><span class="cx"> $methods
</span><del>-
-PassRefPtr&lt;InspectorBackendDispatcher&gt; InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel)
-{
-    return adoptRef(new InspectorBackendDispatcherImpl(inspectorFrontendChannel));
-}
-
-
-void InspectorBackendDispatcherImpl::dispatch(const String&amp; message)
-{
-    Ref&lt;InspectorBackendDispatcher&gt; protect(*this);
-    typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, InspectorObject* messageObject);
-    typedef HashMap&lt;String, CallHandler&gt; DispatchMap;
-    DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, );
-    long callId = 0;
-
-    if (dispatchMap.isEmpty()) {
-        static CallHandler handlers[] = {
-$messageHandlers
-        };
-        size_t length = WTF_ARRAY_LENGTH(commandNames);
-        for (size_t i = 0; i &lt; length; ++i)
-            dispatchMap.add(commandNames[i], handlers[i]);
-    }
-
-    RefPtr&lt;InspectorValue&gt; parsedMessage = InspectorValue::parseJSON(message);
-    if (!parsedMessage) {
-        reportProtocolError(0, ParseError, &quot;Message must be in JSON format&quot;);
-        return;
-    }
-
-    RefPtr&lt;InspectorObject&gt; messageObject = parsedMessage-&gt;asObject();
-    if (!messageObject) {
-        reportProtocolError(0, InvalidRequest, &quot;Message must be a JSONified object&quot;);
-        return;
-    }
-
-    RefPtr&lt;InspectorValue&gt; callIdValue = messageObject-&gt;get(&quot;id&quot;);
-    if (!callIdValue) {
-        reportProtocolError(0, InvalidRequest, &quot;'id' property was not found&quot;);
-        return;
-    }
-
-    if (!callIdValue-&gt;asNumber(&amp;callId)) {
-        reportProtocolError(0, InvalidRequest, &quot;The type of 'id' property must be number&quot;);
-        return;
-    }
-
-    RefPtr&lt;InspectorValue&gt; methodValue = messageObject-&gt;get(&quot;method&quot;);
-    if (!methodValue) {
-        reportProtocolError(&amp;callId, InvalidRequest, &quot;'method' property wasn't found&quot;);
-        return;
-    }
-
-    String method;
-    if (!methodValue-&gt;asString(&amp;method)) {
-        reportProtocolError(&amp;callId, InvalidRequest, &quot;The type of 'method' property must be string&quot;);
-        return;
-    }
-
-    HashMap&lt;String, CallHandler&gt;::iterator it = dispatchMap.find(method);
-    if (it == dispatchMap.end()) {
-        reportProtocolError(&amp;callId, MethodNotFound, &quot;'&quot; + method + &quot;' wasn't found&quot;);
-        return;
-    }
-
-    ((*this).*it-&gt;value)(callId, messageObject.get());
-}
-
-void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, const char* commandName, PassRefPtr&lt;InspectorArray&gt; protocolErrors, ErrorString invocationError)
-{
-    if (protocolErrors-&gt;length()) {
-        String errorMessage = String::format(&quot;Some arguments of method '%s' can't be processed&quot;, commandName);
-        reportProtocolError(&amp;callId, InvalidParams, errorMessage, protocolErrors);
-        return;
-    }
-    sendResponse(callId, result, invocationError);
-}
-
-void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, const ErrorString&amp; invocationError)
-{
-    if (invocationError.length()) {
-        reportProtocolError(&amp;callId, ServerError, invocationError);
-        return;
-    }
-
-    RefPtr&lt;InspectorObject&gt; responseMessage = InspectorObject::create();
-    responseMessage-&gt;setObject(&quot;result&quot;, result);
-    responseMessage-&gt;setNumber(&quot;id&quot;, callId);
-    if (m_inspectorFrontendChannel)
-        m_inspectorFrontendChannel-&gt;sendMessageToFrontend(responseMessage-&gt;toJSONString());
-}
-
-void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode code, const String&amp; errorMessage) const
-{
-    reportProtocolError(callId, code, errorMessage, 0);
-}
-
-void InspectorBackendDispatcherImpl::reportProtocolError(const long* const callId, CommonErrorCode code, const String&amp; errorMessage, PassRefPtr&lt;InspectorArray&gt; data) const
-{
-    DEFINE_STATIC_LOCAL(Vector&lt;int&gt;,s_commonErrors,);
-    if (!s_commonErrors.size()) {
-        s_commonErrors.insert(ParseError, -32700);
-        s_commonErrors.insert(InvalidRequest, -32600);
-        s_commonErrors.insert(MethodNotFound, -32601);
-        s_commonErrors.insert(InvalidParams, -32602);
-        s_commonErrors.insert(InternalError, -32603);
-        s_commonErrors.insert(ServerError, -32000);
-    }
-    ASSERT(code &gt;=0);
-    ASSERT((unsigned)code &lt; s_commonErrors.size());
-    ASSERT(s_commonErrors[code]);
-    RefPtr&lt;InspectorObject&gt; error = InspectorObject::create();
-    error-&gt;setNumber(&quot;code&quot;, s_commonErrors[code]);
-    error-&gt;setString(&quot;message&quot;, errorMessage);
-    ASSERT(error);
-    if (data)
-        error-&gt;setArray(&quot;data&quot;, data);
-    RefPtr&lt;InspectorObject&gt; message = InspectorObject::create();
-    message-&gt;setObject(&quot;error&quot;, error.release());
-    if (callId)
-        message-&gt;setNumber(&quot;id&quot;, *callId);
-    else
-        message-&gt;setValue(&quot;id&quot;, InspectorValue::null());
-    if (m_inspectorFrontendChannel)
-        m_inspectorFrontendChannel-&gt;sendMessageToFrontend(message-&gt;toJSONString());
-}
-
-template&lt;typename R, typename V, typename V0&gt;
-R InspectorBackendDispatcherImpl::getPropertyValueImpl(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors, V0 initial_value, bool (*as_method)(InspectorValue*, V*), const char* type_name)
-{
-    ASSERT(protocolErrors);
-
-    if (valueFound)
-        *valueFound = false;
-
-    V value = initial_value;
-
-    if (!object) {
-        if (!valueFound) {
-            // Required parameter in missing params container.
-            protocolErrors-&gt;pushString(String::format(&quot;'params' object must contain required parameter '%s' with type '%s'.&quot;, name.utf8().data(), type_name));
-        }
-        return value;
-    }
-
-    InspectorObject::const_iterator end = object-&gt;end();
-    InspectorObject::const_iterator valueIterator = object-&gt;find(name);
-
-    if (valueIterator == end) {
-        if (!valueFound)
-            protocolErrors-&gt;pushString(String::format(&quot;Parameter '%s' with type '%s' was not found.&quot;, name.utf8().data(), type_name));
-        return value;
-    }
-
-    if (!as_method(valueIterator-&gt;value.get(), &amp;value))
-        protocolErrors-&gt;pushString(String::format(&quot;Parameter '%s' has wrong type. It must be '%s'.&quot;, name.utf8().data(), type_name));
-    else
-        if (valueFound)
-            *valueFound = true;
-    return value;
-}
-
-struct AsMethodBridges {
-    static bool asInt(InspectorValue* value, int* output) { return value-&gt;asNumber(output); }
-    static bool asDouble(InspectorValue* value, double* output) { return value-&gt;asNumber(output); }
-    static bool asString(InspectorValue* value, String* output) { return value-&gt;asString(output); }
-    static bool asBoolean(InspectorValue* value, bool* output) { return value-&gt;asBoolean(output); }
-    static bool asObject(InspectorValue* value, RefPtr&lt;InspectorObject&gt;* output) { return value-&gt;asObject(output); }
-    static bool asArray(InspectorValue* value, RefPtr&lt;InspectorArray&gt;* output) { return value-&gt;asArray(output); }
-};
-
-int InspectorBackendDispatcherImpl::getInt(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
-{
-    return getPropertyValueImpl&lt;int, int, int&gt;(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInt, &quot;Number&quot;);
-}
-
-double InspectorBackendDispatcherImpl::getDouble(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
-{
-    return getPropertyValueImpl&lt;double, double, double&gt;(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asDouble, &quot;Number&quot;);
-}
-
-String InspectorBackendDispatcherImpl::getString(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
-{
-    return getPropertyValueImpl&lt;String, String, String&gt;(object, name, valueFound, protocolErrors, &quot;&quot;, AsMethodBridges::asString, &quot;String&quot;);
-}
-
-bool InspectorBackendDispatcherImpl::getBoolean(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
-{
-    return getPropertyValueImpl&lt;bool, bool, bool&gt;(object, name, valueFound, protocolErrors, false, AsMethodBridges::asBoolean, &quot;Boolean&quot;);
-}
-
-PassRefPtr&lt;InspectorObject&gt; InspectorBackendDispatcherImpl::getObject(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
-{
-    return getPropertyValueImpl&lt;PassRefPtr&lt;InspectorObject&gt;, RefPtr&lt;InspectorObject&gt;, InspectorObject*&gt;(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asObject, &quot;Object&quot;);
-}
-
-PassRefPtr&lt;InspectorArray&gt; InspectorBackendDispatcherImpl::getArray(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
-{
-    return getPropertyValueImpl&lt;PassRefPtr&lt;InspectorArray&gt;, RefPtr&lt;InspectorArray&gt;, InspectorArray*&gt;(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asArray, &quot;Array&quot;);
-}
-
-InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtr&lt;InspectorBackendDispatcherImpl&gt; backendImpl, int id)
-    : m_backendImpl(backendImpl), m_id(id), m_alreadySent(false) {}
-
-InspectorBackendDispatcher::CallbackBase::~CallbackBase() {}
-
-void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString&amp; error)
-{
-    ASSERT(error.length());
-    sendIfActive(0, error);
-}
-
-bool InspectorBackendDispatcher::CallbackBase::isActive()
-{
-    return !m_alreadySent &amp;&amp; m_backendImpl-&gt;isActive();
-}
-
-void InspectorBackendDispatcher::CallbackBase::sendIfActive(PassRefPtr&lt;InspectorObject&gt; partialMessage, const ErrorString&amp; invocationError)
-{
-    if (m_alreadySent)
-        return;
-    m_backendImpl-&gt;sendResponse(m_id, partialMessage, invocationError);
-    m_alreadySent = true;
-}
-
-COMPILE_ASSERT(static_cast&lt;int&gt;(InspectorBackendDispatcher::kMethodNamesEnumSize) == WTF_ARRAY_LENGTH(InspectorBackendDispatcher::commandNames), command_name_array_problem);
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span><span class="lines">@@ -601,12 +317,12 @@
</span><span class="cx">         ArrayItemHelper&lt;T&gt;::Traits::pushRaw(this-&gt;openAccessors(), value);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;Array&lt;T&gt; &gt; create()
</del><ins>+    static PassRefPtr&lt;Array&lt;T&gt;&gt; create()
</ins><span class="cx">     {
</span><span class="cx">         return adoptRef(new Array&lt;T&gt;());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;Array&lt;T&gt; &gt; runtimeCast(PassRefPtr&lt;InspectorValue&gt; value)
</del><ins>+    static PassRefPtr&lt;Array&lt;T&gt;&gt; runtimeCast(PassRefPtr&lt;InspectorValue&gt; value)
</ins><span class="cx">     {
</span><span class="cx">         RefPtr&lt;InspectorArray&gt; array;
</span><span class="cx">         bool castRes = value-&gt;asArray(&amp;array);
</span><span class="lines">@@ -765,9 +481,9 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt;
</span><del>-struct ArrayItemHelper&lt;TypeBuilder::Array&lt;T&gt; &gt; {
</del><ins>+struct ArrayItemHelper&lt;TypeBuilder::Array&lt;T&gt;&gt; {
</ins><span class="cx">     struct Traits {
</span><del>-        static void pushRefPtr(InspectorArray* array, PassRefPtr&lt;TypeBuilder::Array&lt;T&gt; &gt; value)
</del><ins>+        static void pushRefPtr(InspectorArray* array, PassRefPtr&lt;TypeBuilder::Array&lt;T&gt;&gt; value)
</ins><span class="cx">         {
</span><span class="cx">             array-&gt;pushValue(value);
</span><span class="cx">         }
</span><span class="lines">@@ -853,7 +569,7 @@
</span><span class="cx"> &quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="cx"> param_container_access_code = &quot;&quot;&quot;
</span><del>-    RefPtr&lt;InspectorObject&gt; paramsContainer = requestMessageObject-&gt;getObject(&quot;params&quot;);
</del><ins>+    RefPtr&lt;InspectorObject&gt; paramsContainer = message.getObject(&quot;params&quot;);
</ins><span class="cx">     InspectorObject* paramsContainerPtr = paramsContainer.get();
</span><span class="cx">     InspectorArray* protocolErrorsPtr = protocolErrors.get();
</span><span class="cx"> &quot;&quot;&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -96,12 +96,13 @@
</span><span class="cx"> void InspectorAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorInspectorFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorInspectorBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     m_pendingEvaluateTestCommands.clear();
</span><span class="cx">     m_injectedScriptManager-&gt;discardInjectedScripts();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::InspectorCommandHandler {
</del><ins>+class InspectorAgent : public InspectorBaseAgent, public InspectorInspectorBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorAgent);
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorAgent&gt; create(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx"> 
</span><span class="cx">     Page* m_inspectedPage;
</span><span class="cx">     std::unique_ptr&lt;InspectorInspectorFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorInspectorBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;pair&lt;long, String&gt;&gt; m_pendingEvaluateTestCommands;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorAllInOne.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorAllInOne.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorAllInOne.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include &quot;InspectorAgent.cpp&quot;
</span><span class="cx"> #include &quot;InspectorAgentRegistry.cpp&quot;
</span><span class="cx"> #include &quot;InspectorApplicationCacheAgent.cpp&quot;
</span><ins>+#include &quot;InspectorBackendDispatcher.cpp&quot;
</ins><span class="cx"> #include &quot;InspectorCSSAgent.cpp&quot;
</span><span class="cx"> #include &quot;InspectorCanvasAgent.cpp&quot;
</span><span class="cx"> #include &quot;InspectorClient.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorApplicationCacheAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -53,12 +53,13 @@
</span><span class="cx"> void InspectorApplicationCacheAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorApplicationCacheFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorApplicationCacheBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorApplicationCacheAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     m_instrumentingAgents-&gt;setInspectorApplicationCacheAgent(0);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorApplicationCacheAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorApplicationCacheAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::ApplicationCacheCommandHandler {
</del><ins>+class InspectorApplicationCacheAgent : public InspectorBaseAgent, public InspectorApplicationCacheBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorApplicationCacheAgent&gt; create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><span class="cx">     std::unique_ptr&lt;InspectorApplicationCacheFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorApplicationCacheBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorBackendDispatchercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/inspector/InspectorBackendDispatcher.cpp (0 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorBackendDispatcher.cpp                                (rev 0)
+++ trunk/Source/WebCore/inspector/InspectorBackendDispatcher.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -0,0 +1,277 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 The Chromium Authors. 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;InspectorBackendDispatcher.h&quot;
+
+#if ENABLE(INSPECTOR)
+
+#include &quot;InspectorFrontendChannel.h&quot;
+#include &quot;InspectorValues.h&quot;
+#include &lt;wtf/text/CString.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtr&lt;InspectorBackendDispatcher&gt; backendDispatcher, int id)
+    : m_backendDispatcher(backendDispatcher)
+    , m_id(id)
+    , m_alreadySent(false)
+{
+}
+
+bool InspectorBackendDispatcher::CallbackBase::isActive() const
+{
+    return !m_alreadySent &amp;&amp; m_backendDispatcher-&gt;isActive();
+}
+
+void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString&amp; error)
+{
+    ASSERT(error.length());
+    sendIfActive(nullptr, error);
+}
+
+void InspectorBackendDispatcher::CallbackBase::sendIfActive(PassRefPtr&lt;InspectorObject&gt; partialMessage, const ErrorString&amp; invocationError)
+{
+    if (m_alreadySent)
+        return;
+
+    m_backendDispatcher-&gt;sendResponse(m_id, partialMessage, invocationError);
+    m_alreadySent = true;
+}
+
+PassRefPtr&lt;InspectorBackendDispatcher&gt; InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel)
+{
+    return adoptRef(new InspectorBackendDispatcher(inspectorFrontendChannel));
+}
+
+void InspectorBackendDispatcher::registerDispatcherForDomain(const String&amp; domain, InspectorSupplementalBackendDispatcher* dispatcher)
+{
+    auto result = m_dispatchers.add(domain, dispatcher);
+    ASSERT_UNUSED(result, result.isNewEntry);
+}
+
+void InspectorBackendDispatcher::dispatch(const String&amp; message)
+{
+    Ref&lt;InspectorBackendDispatcher&gt; protect(*this);
+
+    RefPtr&lt;InspectorValue&gt; parsedMessage = InspectorValue::parseJSON(message);
+    if (!parsedMessage) {
+        reportProtocolError(nullptr, ParseError, &quot;Message must be in JSON format&quot;);
+        return;
+    }
+
+    RefPtr&lt;InspectorObject&gt; messageObject = parsedMessage-&gt;asObject();
+    if (!messageObject) {
+        reportProtocolError(nullptr, InvalidRequest, &quot;Message must be a JSONified object&quot;);
+        return;
+    }
+
+    RefPtr&lt;InspectorValue&gt; callIdValue = messageObject-&gt;get(&quot;id&quot;);
+    if (!callIdValue) {
+        reportProtocolError(nullptr, InvalidRequest, &quot;'id' property was not found&quot;);
+        return;
+    }
+
+    long callId = 0;
+    if (!callIdValue-&gt;asNumber(&amp;callId)) {
+        reportProtocolError(nullptr, InvalidRequest, &quot;The type of 'id' property must be number&quot;);
+        return;
+    }
+
+    RefPtr&lt;InspectorValue&gt; methodValue = messageObject-&gt;get(&quot;method&quot;);
+    if (!methodValue) {
+        reportProtocolError(&amp;callId, InvalidRequest, &quot;'method' property wasn't found&quot;);
+        return;
+    }
+
+    String method;
+    if (!methodValue-&gt;asString(&amp;method)) {
+        reportProtocolError(&amp;callId, InvalidRequest, &quot;The type of 'method' property must be string&quot;);
+        return;
+    }
+
+    size_t position = method.find('.');
+    if (position == WTF::notFound) {
+        reportProtocolError(&amp;callId, InvalidRequest, &quot;The 'method' property was formatted incorrectly. It should be 'Domain.method'&quot;);
+        return;
+    }
+
+    String domain = method.substring(0, position);
+    InspectorSupplementalBackendDispatcher* domainDispatcher = m_dispatchers.get(domain);
+    if (!domainDispatcher) {
+        reportProtocolError(&amp;callId, MethodNotFound, &quot;'&quot; + domain + &quot;' domain was not found&quot;);
+        return;
+    }
+
+    String domainMethod = method.substring(position + 1);
+    domainDispatcher-&gt;dispatch(callId, domainMethod, messageObject.release());
+}
+
+// FIXME: Remove this by building better generated code.
+void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, PassRefPtr&lt;InspectorArray&gt; protocolErrors, const ErrorString&amp; invocationError)
+{
+    if (protocolErrors-&gt;length()) {
+        String errorMessage = String::format(&quot;Some arguments of method ??? can't be processed&quot;);
+        reportProtocolError(&amp;callId, InvalidParams, errorMessage, protocolErrors);
+        return;
+    }
+
+    sendResponse(callId, result, invocationError);
+}
+
+void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, const ErrorString&amp; invocationError)
+{
+    if (!m_inspectorFrontendChannel)
+        return;
+
+    if (invocationError.length()) {
+        reportProtocolError(&amp;callId, ServerError, invocationError);
+        return;
+    }
+
+    RefPtr&lt;InspectorObject&gt; responseMessage = InspectorObject::create();
+    responseMessage-&gt;setObject(&quot;result&quot;, result);
+    responseMessage-&gt;setNumber(&quot;id&quot;, callId);
+    m_inspectorFrontendChannel-&gt;sendMessageToFrontend(responseMessage-&gt;toJSONString());
+}
+
+void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String&amp; errorMessage) const
+{
+    reportProtocolError(callId, errorCode, errorMessage, nullptr);
+}
+
+void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String&amp; errorMessage, PassRefPtr&lt;InspectorArray&gt; data) const
+{
+    DEFINE_STATIC_LOCAL(Vector&lt;int&gt;, commonErrors, ());
+    if (!commonErrors.size()) {
+        commonErrors.insert(ParseError, -32700);
+        commonErrors.insert(InvalidRequest, -32600);
+        commonErrors.insert(MethodNotFound, -32601);
+        commonErrors.insert(InvalidParams, -32602);
+        commonErrors.insert(InternalError, -32603);
+        commonErrors.insert(ServerError, -32000);
+    }
+
+    ASSERT(errorCode &gt;= 0);
+    ASSERT((unsigned)errorCode &lt; commonErrors.size());
+    ASSERT(commonErrors[errorCode]);
+
+    if (!m_inspectorFrontendChannel)
+        return;
+
+    RefPtr&lt;InspectorObject&gt; error = InspectorObject::create();
+    error-&gt;setNumber(&quot;code&quot;, commonErrors[errorCode]);
+    error-&gt;setString(&quot;message&quot;, errorMessage);
+    if (data)
+        error-&gt;setArray(&quot;data&quot;, data);
+
+    RefPtr&lt;InspectorObject&gt; message = InspectorObject::create();
+    message-&gt;setObject(&quot;error&quot;, error.release());
+    if (callId)
+        message-&gt;setNumber(&quot;id&quot;, *callId);
+    else
+        message-&gt;setValue(&quot;id&quot;, InspectorValue::null());
+
+    m_inspectorFrontendChannel-&gt;sendMessageToFrontend(message-&gt;toJSONString());
+}
+
+template&lt;typename ReturnValueType, typename ValueType, typename DefaultValueType&gt;
+ReturnValueType InspectorBackendDispatcher::getPropertyValue(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors, DefaultValueType defaultValue, bool (*asMethod)(InspectorValue*, ValueType*), const char* typeName)
+{
+    ASSERT(protocolErrors);
+
+    ValueType value = defaultValue;
+    if (valueFound)
+        *valueFound = false;
+
+    if (!object) {
+        if (!valueFound)
+            protocolErrors-&gt;pushString(String::format(&quot;'params' object must contain required parameter '%s' with type '%s'.&quot;, name.utf8().data(), typeName));
+        return value;
+    }
+
+    InspectorObject::const_iterator end = object-&gt;end();
+    InspectorObject::const_iterator valueIterator = object-&gt;find(name);
+    if (valueIterator == end) {
+        if (!valueFound)
+            protocolErrors-&gt;pushString(String::format(&quot;Parameter '%s' with type '%s' was not found.&quot;, name.utf8().data(), typeName));
+        return value;
+    }
+
+    if (!asMethod(valueIterator-&gt;value.get(), &amp;value)) {
+        protocolErrors-&gt;pushString(String::format(&quot;Parameter '%s' has wrong type. It must be '%s'.&quot;, name.utf8().data(), typeName));
+        return value;
+    }
+
+    if (valueFound)
+        *valueFound = true;
+
+    return value;
+}
+
+struct AsMethodBridges {
+    static bool asInt(InspectorValue* value, int* output) { return value-&gt;asNumber(output); }
+    static bool asDouble(InspectorValue* value, double* output) { return value-&gt;asNumber(output); }
+    static bool asString(InspectorValue* value, String* output) { return value-&gt;asString(output); }
+    static bool asBoolean(InspectorValue* value, bool* output) { return value-&gt;asBoolean(output); }
+    static bool asObject(InspectorValue* value, RefPtr&lt;InspectorObject&gt;* output) { return value-&gt;asObject(output); }
+    static bool asArray(InspectorValue* value, RefPtr&lt;InspectorArray&gt;* output) { return value-&gt;asArray(output); }
+};
+
+int InspectorBackendDispatcher::getInt(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
+{
+    return getPropertyValue&lt;int, int, int&gt;(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInt, &quot;Number&quot;);
+}
+
+double InspectorBackendDispatcher::getDouble(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
+{
+    return getPropertyValue&lt;double, double, double&gt;(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asDouble, &quot;Number&quot;);
+}
+
+String InspectorBackendDispatcher::getString(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
+{
+    return getPropertyValue&lt;String, String, String&gt;(object, name, valueFound, protocolErrors, &quot;&quot;, AsMethodBridges::asString, &quot;String&quot;);
+}
+
+bool InspectorBackendDispatcher::getBoolean(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
+{
+    return getPropertyValue&lt;bool, bool, bool&gt;(object, name, valueFound, protocolErrors, false, AsMethodBridges::asBoolean, &quot;Boolean&quot;);
+}
+
+PassRefPtr&lt;InspectorObject&gt; InspectorBackendDispatcher::getObject(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
+{
+    return getPropertyValue&lt;PassRefPtr&lt;InspectorObject&gt;, RefPtr&lt;InspectorObject&gt;, InspectorObject*&gt;(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asObject, &quot;Object&quot;);
+}
+
+PassRefPtr&lt;InspectorArray&gt; InspectorBackendDispatcher::getArray(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors)
+{
+    return getPropertyValue&lt;PassRefPtr&lt;InspectorArray&gt;, RefPtr&lt;InspectorArray&gt;, InspectorArray*&gt;(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asArray, &quot;Array&quot;);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
</ins></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorBackendDispatcherh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/inspector/InspectorBackendDispatcher.h (0 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorBackendDispatcher.h                                (rev 0)
+++ trunk/Source/WebCore/inspector/InspectorBackendDispatcher.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -0,0 +1,113 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorBackendDispatcher_h
+#define InspectorBackendDispatcher_h
+
+#include &quot;InspectorTypeBuilder.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class InspectorBackendDispatcher;
+class InspectorFrontendChannel;
+typedef String ErrorString;
+
+class InspectorSupplementalBackendDispatcher : public RefCounted&lt;InspectorSupplementalBackendDispatcher&gt; {
+public:
+    InspectorSupplementalBackendDispatcher(InspectorBackendDispatcher *backendDispatcher) : m_backendDispatcher(backendDispatcher) { }
+    virtual ~InspectorSupplementalBackendDispatcher() { }
+    virtual void dispatch(long callId, const String&amp; method, PassRefPtr&lt;InspectorObject&gt; message) = 0;
+protected:
+    RefPtr&lt;InspectorBackendDispatcher&gt; m_backendDispatcher;
+};
+
+class InspectorBackendDispatcher : public RefCounted&lt;InspectorBackendDispatcher&gt; {
+public:
+    static PassRefPtr&lt;InspectorBackendDispatcher&gt; create(InspectorFrontendChannel*);
+    virtual ~InspectorBackendDispatcher() { }
+
+    class CallbackBase: public RefCounted&lt;CallbackBase&gt; {
+    public:
+        CallbackBase(PassRefPtr&lt;InspectorBackendDispatcher&gt;, int id);
+        virtual ~CallbackBase() { }
+
+        bool isActive() const;
+        void sendFailure(const ErrorString&amp;);
+        void disable() { m_alreadySent = true; }
+
+    protected:
+        void sendIfActive(PassRefPtr&lt;InspectorObject&gt; partialMessage, const ErrorString&amp; invocationError);
+
+    private:
+        RefPtr&lt;InspectorBackendDispatcher&gt; m_backendDispatcher;
+        int m_id;
+        bool m_alreadySent;
+    };
+
+    void clearFrontend() { m_inspectorFrontendChannel = nullptr; }
+    bool isActive() const { return !!m_inspectorFrontendChannel; }
+
+    enum CommonErrorCode {
+        ParseError = 0,
+        InvalidRequest,
+        MethodNotFound,
+        InvalidParams,
+        InternalError,
+        ServerError
+    };
+
+    void registerDispatcherForDomain(const String&amp; domain, InspectorSupplementalBackendDispatcher*);
+    void dispatch(const String&amp; message);
+    void sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, const ErrorString&amp; invocationError);
+    void reportProtocolError(const long* const callId, CommonErrorCode, const String&amp; errorMessage) const;
+    void reportProtocolError(const long* const callId, CommonErrorCode, const String&amp; errorMessage, PassRefPtr&lt;InspectorArray&gt; data) const;
+
+    // FIXME: Remove this by building better generated code.
+    void sendResponse(long callId, PassRefPtr&lt;InspectorObject&gt; result, PassRefPtr&lt;InspectorArray&gt; protocolErrors, const ErrorString&amp; invocationError);
+
+    static int getInt(InspectorObject*, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
+    static double getDouble(InspectorObject*, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
+    static String getString(InspectorObject*, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
+    static bool getBoolean(InspectorObject*, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
+    static PassRefPtr&lt;InspectorObject&gt; getObject(InspectorObject*, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
+    static PassRefPtr&lt;InspectorArray&gt; getArray(InspectorObject*, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors);
+
+private:
+    InspectorBackendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { }
+
+    template&lt;typename ReturnValueType, typename ValueType, typename DefaultValueType&gt;
+    static ReturnValueType getPropertyValue(InspectorObject* object, const String&amp; name, bool* valueFound, InspectorArray* protocolErrors, DefaultValueType defaultValue, bool (*asMethod)(InspectorValue*, ValueType*), const char* typeName);
+
+    InspectorFrontendChannel* m_inspectorFrontendChannel;
+    HashMap&lt;String, InspectorSupplementalBackendDispatcher*&gt; m_dispatchers;
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorBackendDispatcher_h)
</ins></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -632,12 +632,13 @@
</span><span class="cx"> void InspectorCSSAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorCSSFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorCSSBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorCSSAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     resetNonPersistentData();
</span><span class="cx">     String errorString;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCSSAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> class InspectorCSSAgent
</span><span class="cx">     : public InspectorBaseAgent
</span><span class="cx">     , public InspectorDOMAgent::DOMListener
</span><del>-    , public InspectorBackendDispatcher::CSSCommandHandler
</del><ins>+    , public InspectorCSSBackendDispatcherHandler
</ins><span class="cx">     , public InspectorStyleSheet::Listener {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorCSSAgent);
</span><span class="cx"> public:
</span><span class="lines">@@ -184,6 +184,7 @@
</span><span class="cx">     void resetPseudoStates();
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;InspectorCSSFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorCSSBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     InspectorDOMAgent* m_domAgent;
</span><span class="cx"> 
</span><span class="cx">     IdToInspectorStyleSheet m_idToInspectorStyleSheet;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCanvasAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -76,12 +76,13 @@
</span><span class="cx"> void InspectorCanvasAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorCanvasFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorCanvasBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorCanvasAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     disable(nullptr);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorCanvasAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorCanvasAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorCanvasAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorCanvasAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorCanvasAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::CanvasCommandHandler {
</del><ins>+class InspectorCanvasAgent : public InspectorBaseAgent, public InspectorCanvasBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorCanvasAgent&gt; create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager)
</span><span class="cx">     {
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;InspectorCanvasFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorCanvasBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     bool m_enabled;
</span><span class="cx">     // Contains all frames with canvases, value is true only for frames that have an uninstrumented canvas.
</span><span class="cx">     typedef HashMap&lt;Frame*, bool&gt; FramesWithUninstrumentedCanvases;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -125,12 +125,13 @@
</span><span class="cx"> void InspectorConsoleAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorConsoleFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorConsoleBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorConsoleAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     String errorString;
</span><span class="cx">     disable(&amp;errorString);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorConsoleAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorConsoleAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorConsoleAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorConsoleAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::ConsoleCommandHandler {
</del><ins>+class InspectorConsoleAgent : public InspectorBaseAgent, public InspectorConsoleBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
</span><span class="cx"> public:
</span><span class="cx">     InspectorConsoleAgent(InstrumentingAgents*, InjectedScriptManager*);
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx"> 
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;InspectorConsoleFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorConsoleBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     ConsoleMessage* m_previousMessage;
</span><span class="cx">     Vector&lt;OwnPtr&lt;ConsoleMessage&gt;&gt; m_consoleMessages;
</span><span class="cx">     int m_expiredConsoleMessageCount;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -234,7 +234,7 @@
</span><span class="cx"> void InspectorDOMAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorDOMFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorDOMBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> 
</span><span class="cx">     m_history = adoptPtr(new InspectorHistory());
</span><span class="cx">     m_domEditor = adoptPtr(new DOMEditor(m_history.get()));
</span><span class="lines">@@ -249,6 +249,7 @@
</span><span class="cx"> void InspectorDOMAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     m_history.clear();
</span><span class="cx">     m_domEditor.clear();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">     const EventListenerVector eventListenerVector;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class InspectorDOMAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::DOMCommandHandler {
</del><ins>+class InspectorDOMAgent : public InspectorBaseAgent, public InspectorDOMBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorDOMAgent);
</span><span class="cx"> public:
</span><span class="cx">     struct DOMListener {
</span><span class="lines">@@ -245,6 +245,7 @@
</span><span class="cx">     InspectorOverlay* m_overlay;
</span><span class="cx">     InspectorClient* m_client;
</span><span class="cx">     std::unique_ptr&lt;InspectorDOMFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorDOMBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     DOMListener* m_domListener;
</span><span class="cx">     NodeToIdMap m_documentNodeToIdMap;
</span><span class="cx">     typedef HashMap&lt;RefPtr&lt;Node&gt;, BackendNodeId&gt; NodeToBackendIdMap;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMDebuggerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -113,11 +113,13 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMDebuggerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorDOMDebuggerBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMDebuggerAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><ins>+    m_backendDispatcher.clear();
+
</ins><span class="cx">     disable();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMDebuggerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorDOMDebuggerAgent : public InspectorBaseAgent, public InspectorDebuggerAgent::Listener, public InspectorBackendDispatcher::DOMDebuggerCommandHandler {
</del><ins>+class InspectorDOMDebuggerAgent : public InspectorBaseAgent, public InspectorDebuggerAgent::Listener, public InspectorDOMDebuggerBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent);
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorDOMDebuggerAgent&gt; create(InstrumentingAgents*, InspectorDOMAgent*, InspectorDebuggerAgent*, InspectorAgent*);
</span><span class="lines">@@ -104,6 +104,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorDOMAgent* m_domAgent;
</span><span class="cx">     InspectorDebuggerAgent* m_debuggerAgent;
</span><ins>+    RefPtr&lt;InspectorDOMDebuggerBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     HashMap&lt;Node*, uint32_t&gt; m_domBreakpoints;
</span><span class="cx">     HashSet&lt;String&gt; m_eventListenerBreakpoints;
</span><span class="cx">     HashSet&lt;String&gt; m_xhrBreakpoints;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMStorageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -72,12 +72,13 @@
</span><span class="cx"> void InspectorDOMStorageAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorDOMStorageFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorDOMStorageBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMStorageAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     disable(nullptr);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMStorageAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorDOMStorageAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::DOMStorageCommandHandler {
</del><ins>+class InspectorDOMStorageAgent : public InspectorBaseAgent, public InspectorDOMStorageBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorDOMStorageAgent&gt; create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
</span><span class="cx">     {
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><span class="cx">     std::unique_ptr&lt;InspectorDOMStorageFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorDOMStorageBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     bool m_enabled;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDatabaseAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><del>-typedef WebCore::InspectorBackendDispatcher::DatabaseCommandHandler::ExecuteSQLCallback ExecuteSQLCallback;
</del><ins>+typedef WebCore::InspectorDatabaseBackendDispatcherHandler::ExecuteSQLCallback ExecuteSQLCallback;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -225,12 +225,13 @@
</span><span class="cx"> void InspectorDatabaseAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorDatabaseFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorDatabaseBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorDatabaseAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     disable(nullptr);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDatabaseAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorDatabaseAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::DatabaseCommandHandler {
</del><ins>+class InspectorDatabaseAgent : public InspectorBaseAgent, public InspectorDatabaseBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorDatabaseAgent&gt; create(InstrumentingAgents* instrumentingAgents)
</span><span class="cx">     {
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">     InspectorDatabaseResource* findByFileName(const String&amp; fileName);
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;InspectorDatabaseFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorDatabaseBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     typedef HashMap&lt;String, RefPtr&lt;InspectorDatabaseResource&gt;&gt; DatabaseResourcesMap;
</span><span class="cx">     DatabaseResourcesMap m_resources;
</span><span class="cx">     bool m_enabled;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDebuggerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -139,12 +139,13 @@
</span><span class="cx"> void InspectorDebuggerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorDebuggerFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorDebuggerBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorDebuggerAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     disable();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDebuggerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorDebuggerAgent : public InspectorBaseAgent, public ScriptDebugListener, public InspectorBackendDispatcher::DebuggerCommandHandler {
</del><ins>+class InspectorDebuggerAgent : public InspectorBaseAgent, public ScriptDebugListener, public InspectorDebuggerBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static const char* backtraceObjectGroup;
</span><span class="lines">@@ -168,6 +168,7 @@
</span><span class="cx"> 
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;InspectorDebuggerFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorDebuggerBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     JSC::ExecState* m_pausedScriptState;
</span><span class="cx">     ScriptValue m_currentCallStack;
</span><span class="cx">     ScriptsMap m_scripts;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorHeapProfilerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -83,12 +83,13 @@
</span><span class="cx"> void InspectorHeapProfilerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorHeapProfilerFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorHeapProfilerBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorHeapProfilerAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     m_profileHeadersRequested = false;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorHeapProfilerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorHeapProfilerAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorHeapProfilerAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::HeapProfilerCommandHandler {
</del><ins>+class InspectorHeapProfilerAgent : public InspectorBaseAgent, public InspectorHeapProfilerBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorHeapProfilerAgent&gt; create(InstrumentingAgents*, InjectedScriptManager*);
</span><span class="lines">@@ -84,6 +84,7 @@
</span><span class="cx"> 
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;InspectorHeapProfilerFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorHeapProfilerBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     unsigned m_nextUserInitiatedHeapSnapshotNumber;
</span><span class="cx">     IdToHeapSnapshotMap m_snapshots;
</span><span class="cx">     bool m_profileHeadersRequested;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -76,11 +76,11 @@
</span><span class="cx"> using WebCore::TypeBuilder::IndexedDB::ObjectStore;
</span><span class="cx"> using WebCore::TypeBuilder::IndexedDB::ObjectStoreIndex;
</span><span class="cx"> 
</span><del>-typedef WebCore::InspectorBackendDispatcher::IndexedDBCommandHandler::RequestDatabaseNamesCallback RequestDatabaseNamesCallback;
-typedef WebCore::InspectorBackendDispatcher::IndexedDBCommandHandler::RequestDatabaseCallback RequestDatabaseCallback;
-typedef WebCore::InspectorBackendDispatcher::IndexedDBCommandHandler::RequestDataCallback RequestDataCallback;
</del><ins>+typedef WebCore::InspectorIndexedDBBackendDispatcherHandler::RequestDatabaseNamesCallback RequestDatabaseNamesCallback;
+typedef WebCore::InspectorIndexedDBBackendDispatcherHandler::RequestDatabaseCallback RequestDatabaseCallback;
+typedef WebCore::InspectorIndexedDBBackendDispatcherHandler::RequestDataCallback RequestDataCallback;
</ins><span class="cx"> typedef WebCore::InspectorBackendDispatcher::CallbackBase RequestCallback;
</span><del>-typedef WebCore::InspectorBackendDispatcher::IndexedDBCommandHandler::ClearObjectStoreCallback ClearObjectStoreCallback;
</del><ins>+typedef WebCore::InspectorIndexedDBBackendDispatcherHandler::ClearObjectStoreCallback ClearObjectStoreCallback;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -569,11 +569,13 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorIndexedDBAgent::didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorIndexedDBBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorIndexedDBAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><ins>+    m_backendDispatcher.clear();
+
</ins><span class="cx">     disable(nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorIndexedDBAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::IndexedDBCommandHandler {
</del><ins>+class InspectorIndexedDBAgent : public InspectorBaseAgent, public InspectorIndexedDBBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorIndexedDBAgent&gt; create(InstrumentingAgents* instrumentingAgents, InjectedScriptManager* injectedScriptManager, InspectorPageAgent* pageAgent)
</span><span class="cx">     {
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> 
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><ins>+    RefPtr&lt;InspectorIndexedDBBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInputAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInputAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInputAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorInputAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -63,11 +63,12 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorInputAgent::didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorInputBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorInputAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String&amp; type, const int* modifiers, const double* timestamp, const String* text, const String* unmodifiedText, const String* keyIdentifier, const int* windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const int* macCharCode, const bool* autoRepeat, const bool* isKeypad, const bool* isSystemKey)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInputAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInputAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInputAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorInputAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorInputAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::InputCommandHandler {
</del><ins>+class InspectorInputAgent : public InspectorBaseAgent, public InspectorInputBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorInputAgent);
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorInputAgent&gt; create(InstrumentingAgents* instrumentingAgents, Page* page)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx">     InspectorInputAgent(InstrumentingAgents*, Page*);
</span><span class="cx"> 
</span><span class="cx">     Page* m_page;
</span><ins>+    RefPtr&lt;InspectorInputBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorLayerTreeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -61,12 +61,13 @@
</span><span class="cx"> void InspectorLayerTreeAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorLayerTreeFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorLayerTreeBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorLayerTreeAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     disable(nullptr);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorLayerTreeAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorLayerTreeAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::LayerTreeCommandHandler {
</del><ins>+class InspectorLayerTreeAgent : public InspectorBaseAgent, public InspectorLayerTreeBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorLayerTreeAgent&gt; create(InstrumentingAgents* instrumentingAgents)
</span><span class="cx">     {
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx">     void unbindPseudoElement(PseudoElement*);
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;InspectorLayerTreeFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorLayerTreeBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx"> 
</span><span class="cx">     HashMap&lt;const RenderLayer*, String&gt; m_documentLayerToIdMap;
</span><span class="cx">     HashMap&lt;String, const RenderLayer*&gt; m_idToLayer;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorMemoryAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -69,11 +69,12 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorMemoryAgent::didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorMemoryBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorMemoryAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorMemoryAgent::getDOMCounters(ErrorString*, int* documents, int* nodes, int* jsEventListeners)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorMemoryAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorMemoryAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::MemoryCommandHandler {
</del><ins>+class InspectorMemoryAgent : public InspectorBaseAgent, public InspectorMemoryBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorMemoryAgent);
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorMemoryAgent&gt; create(InstrumentingAgents* instrumentingAgents);
</span><span class="lines">@@ -58,6 +58,8 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     InspectorMemoryAgent(InstrumentingAgents*);
</span><ins>+
+    RefPtr&lt;InspectorMemoryBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -371,12 +371,13 @@
</span><span class="cx"> void InspectorPageAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorPageFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorPageBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     ErrorString error;
</span><span class="cx">     disable(&amp;error);
</span><span class="lines">@@ -781,7 +782,7 @@
</span><span class="cx">         mainFrame()-&gt;view()-&gt;invalidate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum* status)
</del><ins>+void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, InspectorPageBackendDispatcherHandler::Result::Enum* status)
</ins><span class="cx"> {
</span><span class="cx">     bool disabledByScriptController = false;
</span><span class="cx">     bool disabledInSettings = false;
</span><span class="lines">@@ -792,14 +793,14 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!disabledByScriptController) {
</span><del>-        *status = PageCommandHandler::Result::Allowed;
</del><ins>+        *status = InspectorPageBackendDispatcherHandler::Result::Allowed;
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (disabledInSettings)
</span><del>-        *status = PageCommandHandler::Result::Disabled;
</del><ins>+        *status = InspectorPageBackendDispatcherHandler::Result::Disabled;
</ins><span class="cx">     else
</span><del>-        *status = PageCommandHandler::Result::Forbidden;
</del><ins>+        *status = InspectorPageBackendDispatcherHandler::Result::Forbidden;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::setScriptExecutionDisabled(ErrorString*, bool value)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorPageAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::PageCommandHandler {
</del><ins>+class InspectorPageAgent : public InspectorBaseAgent, public InspectorPageBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorPageAgent);
</span><span class="cx"> public:
</span><span class="cx">     enum ResourceType {
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx">     virtual void setShowFPSCounter(ErrorString*, bool show);
</span><span class="cx">     virtual void canContinuouslyPaint(ErrorString*, bool*);
</span><span class="cx">     virtual void setContinuousPaintingEnabled(ErrorString*, bool enabled);
</span><del>-    virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum*);
</del><ins>+    virtual void getScriptExecutionStatus(ErrorString*, InspectorPageBackendDispatcherHandler::Result::Enum*);
</ins><span class="cx">     virtual void setScriptExecutionDisabled(ErrorString*, bool);
</span><span class="cx">     virtual void setGeolocationOverride(ErrorString*, const double*, const double*, const double*);
</span><span class="cx">     virtual void clearGeolocationOverride(ErrorString*);
</span><span class="lines">@@ -198,6 +198,7 @@
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     InspectorClient* m_client;
</span><span class="cx">     std::unique_ptr&lt;InspectorPageFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorPageBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     InspectorOverlay* m_overlay;
</span><span class="cx">     long m_lastScriptIdentifier;
</span><span class="cx">     String m_pendingScriptToEvaluateOnLoadOnce;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorProfilerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -332,12 +332,13 @@
</span><span class="cx"> void InspectorProfilerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorProfilerFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorProfilerBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorProfilerAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     stop();
</span><span class="cx">     ErrorString error;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorProfilerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorProfilerAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::ProfilerCommandHandler {
</del><ins>+class InspectorProfilerAgent : public InspectorBaseAgent, public InspectorProfilerBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorProfilerAgent&gt; create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InjectedScriptManager*);
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx">     InspectorConsoleAgent* m_consoleAgent;
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;InspectorProfilerFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorProfilerBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     bool m_enabled;
</span><span class="cx">     bool m_profileHeadersRequested;
</span><span class="cx">     bool m_recordingCPUProfile;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorResourceAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -79,12 +79,13 @@
</span><span class="cx"> void InspectorResourceAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorNetworkFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorNetworkBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorResourceAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     ErrorString error;
</span><span class="cx">     disable(&amp;error);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorResourceAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorResourceAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorResourceAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::NetworkCommandHandler {
</del><ins>+class InspectorResourceAgent : public InspectorBaseAgent, public InspectorNetworkBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorResourceAgent&gt; create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client)
</span><span class="cx">     {
</span><span class="lines">@@ -154,6 +154,7 @@
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><span class="cx">     InspectorClient* m_client;
</span><span class="cx">     std::unique_ptr&lt;InspectorNetworkFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorNetworkBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     String m_userAgentOverride;
</span><span class="cx">     OwnPtr&lt;NetworkResourcesData&gt; m_resourcesData;
</span><span class="cx">     bool m_enabled;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorRuntimeAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorRuntimeAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::RuntimeCommandHandler {
</del><ins>+class InspectorRuntimeAgent : public InspectorBaseAgent, public InspectorRuntimeBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent);
</span><span class="cx"> public:
</span><span class="cx">     virtual ~InspectorRuntimeAgent();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -68,12 +68,13 @@
</span><span class="cx"> void InspectorTimelineAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorTimelineFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorTimelineBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorTimelineAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     ErrorString error;
</span><span class="cx">     stop(&amp;error);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> 
</span><span class="cx"> class InspectorTimelineAgent
</span><span class="cx">     : public InspectorBaseAgent
</span><del>-    , public InspectorBackendDispatcher::TimelineCommandHandler {
</del><ins>+    , public InspectorTimelineBackendDispatcherHandler {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent);
</span><span class="cx"> public:
</span><span class="cx">     enum InspectorType { PageInspector, WorkerInspector };
</span><span class="lines">@@ -259,6 +259,7 @@
</span><span class="cx">     TimelineTimeConverter m_timeConverter;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;InspectorTimelineFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorTimelineBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     double m_timestampOffset;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;TimelineRecordEntry&gt; m_recordStack;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorWorkerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> void InspectorWorkerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorWorkerFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorWorkerBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorWorkerAgent::willDestroyFrontendAndBackend()
</span><span class="lines">@@ -131,6 +131,7 @@
</span><span class="cx">     disable(nullptr);
</span><span class="cx"> 
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorWorkerAgent::enable(ErrorString*)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorWorkerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorWorkerAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorWorkerAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/InspectorWorkerAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef String ErrorString;
</span><span class="cx"> 
</span><del>-class InspectorWorkerAgent : public InspectorBaseAgent, public InspectorBackendDispatcher::WorkerCommandHandler {
</del><ins>+class InspectorWorkerAgent : public InspectorBaseAgent, public InspectorWorkerBackendDispatcherHandler {
</ins><span class="cx"> public:
</span><span class="cx">     static PassOwnPtr&lt;InspectorWorkerAgent&gt; create(InstrumentingAgents*);
</span><span class="cx">     ~InspectorWorkerAgent();
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx">     void destroyWorkerFrontendChannels();
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;InspectorWorkerFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorWorkerBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     bool m_enabled;
</span><span class="cx">     bool m_shouldPauseDedicatedWorkerOnStart;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageRuntimeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -66,12 +66,13 @@
</span><span class="cx"> void PageRuntimeAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = std::make_unique&lt;InspectorRuntimeFrontendDispatcher&gt;(frontendChannel);
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorRuntimeBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageRuntimeAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><span class="cx">     m_frontendDispatcher = nullptr;
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> 
</span><span class="cx">     String errorString;
</span><span class="cx">     disable(&amp;errorString);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageRuntimeAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageRuntimeAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx">     Page* m_inspectedPage;
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><span class="cx">     std::unique_ptr&lt;InspectorRuntimeFrontendDispatcher&gt; m_frontendDispatcher;
</span><ins>+    RefPtr&lt;InspectorRuntimeBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     bool m_mainWorldContextCreated;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorWorkerRuntimeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -59,11 +59,12 @@
</span><span class="cx"> 
</span><span class="cx"> void WorkerRuntimeAgent::didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher* backendDispatcher)
</span><span class="cx"> {
</span><del>-    backendDispatcher-&gt;registerAgent(this);
</del><ins>+    m_backendDispatcher = InspectorRuntimeBackendDispatcher::create(backendDispatcher, this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WorkerRuntimeAgent::willDestroyFrontendAndBackend()
</span><span class="cx"> {
</span><ins>+    m_backendDispatcher.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorWorkerRuntimeAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h (159267 => 159268)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h        2013-11-14 01:59:52 UTC (rev 159267)
+++ trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h        2013-11-14 02:24:46 UTC (rev 159268)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">     virtual void muteConsole();
</span><span class="cx">     virtual void unmuteConsole();
</span><span class="cx">     WorkerGlobalScope* m_workerGlobalScope;
</span><ins>+    RefPtr&lt;InspectorRuntimeBackendDispatcher&gt; m_backendDispatcher;
</ins><span class="cx">     bool m_paused;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>