Title: [175999] trunk/Source
Revision
175999
Author
[email protected]
Date
2014-11-11 19:07:12 -0800 (Tue, 11 Nov 2014)

Log Message

Web Inspector: Handle activating extra agents properly after inspector has connected
https://bugs.webkit.org/show_bug.cgi?id=138639

Patch by Joseph Pecoraro <[email protected]> on 2014-11-11
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

Instead of having the protocol configuration directly add the extra agent
to the inspector registry, isntead go through the augmentable controller.
The controller will initialize as required if we are already connected or not,
and will add to the registry.

The functional change here is that the frontend can be notified to activate
extra agents multiple times as agents eventually become available.

* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::appendExtraAgent):
* inspector/JSGlobalObjectInspectorController.h:
* inspector/agents/InspectorAgent.cpp:
(Inspector::InspectorAgent::activateExtraDomain):
* inspector/agents/InspectorAgent.h:
* inspector/augmentable/AugmentableInspectorController.h:
* inspector/scripts/codegen/generator_templates.py:
* inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/expected/enum-values.json-result:
* inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
Rebased results.

Source/WebInspectorUI:

* UserInterface/Base/Main.js:
(WebInspector.activateExtraDomains):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (175998 => 175999)


--- trunk/Source/_javascript_Core/ChangeLog	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-11-12 03:07:12 UTC (rev 175999)
@@ -1,3 +1,33 @@
+2014-11-11  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Handle activating extra agents properly after inspector has connected
+        https://bugs.webkit.org/show_bug.cgi?id=138639
+
+        Reviewed by Timothy Hatcher.
+
+        Instead of having the protocol configuration directly add the extra agent
+        to the inspector registry, isntead go through the augmentable controller.
+        The controller will initialize as required if we are already connected or not,
+        and will add to the registry.
+
+        The functional change here is that the frontend can be notified to activate
+        extra agents multiple times as agents eventually become available.
+
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::appendExtraAgent):
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/agents/InspectorAgent.cpp:
+        (Inspector::InspectorAgent::activateExtraDomain):
+        * inspector/agents/InspectorAgent.h:
+        * inspector/augmentable/AugmentableInspectorController.h:
+        * inspector/scripts/codegen/generator_templates.py:
+        * inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
+        * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
+        * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
+        * inspector/scripts/tests/expected/enum-values.json-result:
+        * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
+        Rebased results.
+
 2014-11-11  Michael Saboff  <[email protected]>
 
         Use scope register when processing op_resolve_scope in LLInt and Baseline JIT

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp	2014-11-12 03:07:12 UTC (rev 175999)
@@ -227,6 +227,21 @@
     return m_executionStopwatch;
 }
 
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void JSGlobalObjectInspectorController::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent)
+{
+    String domainName = agent->domainName();
+
+    if (m_inspectorFrontendChannel)
+        agent->didCreateFrontendAndBackend(m_inspectorFrontendChannel, m_inspectorBackendDispatcher.get());
+
+    m_agents.appendExtraAgent(WTF::move(agent));
+
+    if (m_inspectorFrontendChannel)
+        m_inspectorAgent->activateExtraDomain(domainName);
+}
+#endif
+
 } // namespace Inspector
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h	2014-11-12 03:07:12 UTC (rev 175999)
@@ -85,7 +85,6 @@
     void reportAPIException(JSC::ExecState*, JSC::JSValue exception);
 
     JSC::ConsoleClient* consoleClient() const;
-    InspectorAgentRegistry& inspectorAgentRegistry() { return m_agents; }
 
     virtual bool developerExtrasEnabled() const override { return true; }
     virtual bool canAccessInspectedScriptState(JSC::ExecState*) const override { return true; }
@@ -101,7 +100,7 @@
     virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient* client) override { m_augmentingClient = client; }
 
     virtual InspectorFrontendChannel* frontendChannel() const override { return m_inspectorFrontendChannel; }
-    virtual InspectorAgentRegistry& agentRegistry() override { return m_agents; }
+    virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) override;
 #endif
 
 private:

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.cpp (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.cpp	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.cpp	2014-11-12 03:07:12 UTC (rev 175999)
@@ -121,6 +121,20 @@
 }
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void InspectorAgent::activateExtraDomain(const String& domainName)
+{
+    if (!m_enabled) {
+        if (!m_pendingExtraDomainsData)
+            m_pendingExtraDomainsData = Inspector::Protocol::Array<String>::create();
+        m_pendingExtraDomainsData->addItem(domainName);
+        return;
+    }
+
+    RefPtr<Inspector::Protocol::Array<String>> domainNames = Inspector::Protocol::Array<String>::create();
+    domainNames->addItem(domainName);
+    m_frontendDispatcher->activateExtraDomains(domainNames.release());
+}
+
 void InspectorAgent::activateExtraDomains(const Vector<String>& extraDomains)
 {
     if (extraDomains.isEmpty())

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.h (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.h	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.h	2014-11-12 03:07:12 UTC (rev 175999)
@@ -65,6 +65,7 @@
     void evaluateForTestInFrontend(const String& script);
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+    void activateExtraDomain(const String&);
     void activateExtraDomains(const Vector<String>&);
 #endif
 

Modified: trunk/Source/_javascript_Core/inspector/augmentable/AugmentableInspectorController.h (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/augmentable/AugmentableInspectorController.h	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/augmentable/AugmentableInspectorController.h	2014-11-12 03:07:12 UTC (rev 175999)
@@ -29,11 +29,12 @@
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 #include <_javascript_Core/AugmentableInspectorControllerClient.h>
-#include <_javascript_Core/InspectorAgentRegistry.h>
 #include <_javascript_Core/InspectorFrontendChannel.h>
 
 namespace Inspector {
 
+class InspectorAgentBase;
+
 class AugmentableInspectorController {
 public:
     virtual ~AugmentableInspectorController() { }
@@ -42,7 +43,7 @@
     virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient*) = 0;
 
     virtual InspectorFrontendChannel* frontendChannel() const = 0;
-    virtual InspectorAgentRegistry& agentRegistry() = 0;
+    virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) = 0;
 
     bool connected() const { return !!frontendChannel(); }
 };

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generator_templates.py (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generator_templates.py	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generator_templates.py	2014-11-12 03:07:12 UTC (rev 175999)
@@ -415,7 +415,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspector${domainName}BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<Inspector${domainName}BackendDispatcher, AlternateInspector${domainName}BackendDispatcher>>(ASCIILiteral("${domainName}"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<${objcPrefix}${domainName}DomainHandler>)${variableNamePrefix}Handler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2014-11-12 03:07:12 UTC (rev 175999)
@@ -963,7 +963,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorDatabaseBackendDispatcher, AlternateInspectorDatabaseBackendDispatcher>>(ASCIILiteral("Database"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolDatabaseDomainHandler>)databaseHandler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2014-11-12 03:07:12 UTC (rev 175999)
@@ -852,7 +852,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorDatabaseBackendDispatcher, AlternateInspectorDatabaseBackendDispatcher>>(ASCIILiteral("Database"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolDatabaseDomainHandler>)databaseHandler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result	2014-11-12 03:07:12 UTC (rev 175999)
@@ -869,7 +869,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork1BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorNetwork1BackendDispatcher, AlternateInspectorNetwork1BackendDispatcher>>(ASCIILiteral("Network1"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolNetwork1DomainHandler>)network1Handler
@@ -887,7 +887,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork3BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorNetwork3BackendDispatcher, AlternateInspectorNetwork3BackendDispatcher>>(ASCIILiteral("Network3"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolNetwork3DomainHandler>)network3Handler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result	2014-11-12 03:07:12 UTC (rev 175999)
@@ -701,7 +701,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorCommandDomainBackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorCommandDomainBackendDispatcher, AlternateInspectorCommandDomainBackendDispatcher>>(ASCIILiteral("CommandDomain"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolCommandDomainDomainHandler>)commandDomainHandler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result (175998 => 175999)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result	2014-11-12 03:07:12 UTC (rev 175999)
@@ -750,7 +750,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork1BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorNetwork1BackendDispatcher, AlternateInspectorNetwork1BackendDispatcher>>(ASCIILiteral("Network1"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
+    _controller->appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolNetwork1DomainHandler>)network1Handler

Modified: trunk/Source/WebInspectorUI/ChangeLog (175998 => 175999)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-11-12 03:07:12 UTC (rev 175999)
@@ -1,3 +1,13 @@
+2014-11-11  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Handle activating extra agents properly after inspector has connected
+        https://bugs.webkit.org/show_bug.cgi?id=138639
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.activateExtraDomains):
+
 2014-11-11  Jonathan Wells  <[email protected]>
 
         Web Inspector: Main.js missing many trailing semicolons

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (175998 => 175999)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2014-11-12 02:33:43 UTC (rev 175998)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2014-11-12 03:07:12 UTC (rev 175999)
@@ -357,7 +357,6 @@
 
 WebInspector.activateExtraDomains = function(domains)
 {
-    console.assert(!this.hasExtraDomains);
     this.hasExtraDomains = true;
 
     for (var domain of domains) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to