Title: [246177] trunk/Source
Revision
246177
Author
[email protected]
Date
2019-06-06 16:31:40 -0700 (Thu, 06 Jun 2019)

Log Message

Web Inspector: create CommandLineAPIHost lazily like the other agents
https://bugs.webkit.org/show_bug.cgi?id=196047
<rdar://problem/49087835>

Reviewed by Timothy Hatcher.

Source/_javascript_Core:

* inspector/InjectedScriptManager.h:
* inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::connect): Added.

Source/WebCore:

No change in functionality.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::createLazyAgents):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
(WebCore::WorkerInspectorController::createLazyAgents):

* inspector/WebInjectedScriptManager.h:
* inspector/WebInjectedScriptManager.cpp:
(WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
(WebCore::WebInjectedScriptManager::connect): Added.
(WebCore::WebInjectedScriptManager::disconnect):
(WebCore::WebInjectedScriptManager::discardInjectedScripts):

* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setInspectedNode):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (246176 => 246177)


--- trunk/Source/_javascript_Core/ChangeLog	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-06-06 23:31:40 UTC (rev 246177)
@@ -1,3 +1,15 @@
+2019-06-06  Devin Rousso  <[email protected]>
+
+        Web Inspector: create CommandLineAPIHost lazily like the other agents
+        https://bugs.webkit.org/show_bug.cgi?id=196047
+        <rdar://problem/49087835>
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InjectedScriptManager.h:
+        * inspector/InjectedScriptManager.cpp:
+        (Inspector::InjectedScriptManager::connect): Added.
+
 2019-06-06  Keith Miller  <[email protected]>
 
         Fix typo in cageWithoutUntagging

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptManager.cpp (246176 => 246177)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptManager.cpp	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptManager.cpp	2019-06-06 23:31:40 UTC (rev 246177)
@@ -57,6 +57,10 @@
 {
 }
 
+void InjectedScriptManager::connect()
+{
+}
+
 void InjectedScriptManager::disconnect()
 {
     discardInjectedScripts();

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptManager.h (246176 => 246177)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptManager.h	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptManager.h	2019-06-06 23:31:40 UTC (rev 246177)
@@ -49,6 +49,7 @@
     InjectedScriptManager(InspectorEnvironment&, Ref<InjectedScriptHost>&&);
     virtual ~InjectedScriptManager();
 
+    virtual void connect();
     virtual void disconnect();
     virtual void discardInjectedScripts();
 

Modified: trunk/Source/WebCore/ChangeLog (246176 => 246177)


--- trunk/Source/WebCore/ChangeLog	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/WebCore/ChangeLog	2019-06-06 23:31:40 UTC (rev 246177)
@@ -1,3 +1,30 @@
+2019-06-06  Devin Rousso  <[email protected]>
+
+        Web Inspector: create CommandLineAPIHost lazily like the other agents
+        https://bugs.webkit.org/show_bug.cgi?id=196047
+        <rdar://problem/49087835>
+
+        Reviewed by Timothy Hatcher.
+
+        No change in functionality.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::createLazyAgents):
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        (WebCore::WorkerInspectorController::createLazyAgents):
+
+        * inspector/WebInjectedScriptManager.h:
+        * inspector/WebInjectedScriptManager.cpp:
+        (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
+        (WebCore::WebInjectedScriptManager::connect): Added.
+        (WebCore::WebInjectedScriptManager::disconnect):
+        (WebCore::WebInjectedScriptManager::discardInjectedScripts):
+
+        * inspector/agents/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::setInspectedNode):
+
 2019-06-05  Said Abou-Hallawa  <[email protected]>
 
         REGRESSION (r243121): Load event should not be fired while animating the 'externalResourcesRequired' attribute 

Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (246176 => 246177)


--- trunk/Source/WebCore/inspector/InspectorController.cpp	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp	2019-06-06 23:31:40 UTC (rev 246177)
@@ -109,10 +109,6 @@
     auto consoleAgent = std::make_unique<PageConsoleAgent>(pageContext);
     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
     m_agents.append(WTFMove(consoleAgent));
-
-    ASSERT(m_injectedScriptManager->commandLineAPIHost());
-    if (auto* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
-        commandLineAPIHost->init(m_instrumentingAgents.copyRef());
 }
 
 InspectorController::~InspectorController()
@@ -150,6 +146,8 @@
 
     m_didCreateLazyAgents = true;
 
+    m_injectedScriptManager->connect();
+
     auto pageContext = pageAgentContext();
 
     ensureInspectorAgent();
@@ -186,6 +184,9 @@
     m_agents.append(std::make_unique<PageAuditAgent>(pageContext));
     m_agents.append(std::make_unique<InspectorCanvasAgent>(pageContext));
     m_agents.append(std::make_unique<InspectorTimelineAgent>(pageContext));
+
+    if (auto& commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
+        commandLineAPIHost->init(m_instrumentingAgents.copyRef());
 }
 
 void InspectorController::inspectedPageDestroyed()

Modified: trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp (246176 => 246177)


--- trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp	2019-06-06 23:31:40 UTC (rev 246177)
@@ -36,16 +36,24 @@
 
 WebInjectedScriptManager::WebInjectedScriptManager(InspectorEnvironment& environment, Ref<InjectedScriptHost>&& host)
     : InjectedScriptManager(environment, WTFMove(host))
-    , m_commandLineAPIHost(CommandLineAPIHost::create())
 {
 }
 
+void WebInjectedScriptManager::connect()
+{
+    InjectedScriptManager::connect();
+
+    m_commandLineAPIHost = CommandLineAPIHost::create();
+}
+
 void WebInjectedScriptManager::disconnect()
 {
     InjectedScriptManager::disconnect();
 
-    m_commandLineAPIHost->disconnect();
-    m_commandLineAPIHost = nullptr;
+    if (m_commandLineAPIHost) {
+        m_commandLineAPIHost->disconnect();
+        m_commandLineAPIHost = nullptr;
+    }
 }
 
 void WebInjectedScriptManager::discardInjectedScripts()
@@ -52,7 +60,8 @@
 {
     InjectedScriptManager::discardInjectedScripts();
 
-    m_commandLineAPIHost->clearAllWrappers();
+    if (m_commandLineAPIHost)
+        m_commandLineAPIHost->clearAllWrappers();
 }
 
 void WebInjectedScriptManager::didCreateInjectedScript(const Inspector::InjectedScript& injectedScript)

Modified: trunk/Source/WebCore/inspector/WebInjectedScriptManager.h (246176 => 246177)


--- trunk/Source/WebCore/inspector/WebInjectedScriptManager.h	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/WebCore/inspector/WebInjectedScriptManager.h	2019-06-06 23:31:40 UTC (rev 246177)
@@ -40,8 +40,9 @@
     WebInjectedScriptManager(Inspector::InspectorEnvironment&, Ref<Inspector::InjectedScriptHost>&&);
     virtual ~WebInjectedScriptManager() = default;
 
-    CommandLineAPIHost* commandLineAPIHost() const { return m_commandLineAPIHost.get(); }
+    const RefPtr<CommandLineAPIHost>& commandLineAPIHost() const { return m_commandLineAPIHost; }
 
+    void connect() override;
     void disconnect() override;
     void discardInjectedScripts() override;
 

Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (246176 => 246177)


--- trunk/Source/WebCore/inspector/WorkerInspectorController.cpp	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.cpp	2019-06-06 23:31:40 UTC (rev 246177)
@@ -72,9 +72,6 @@
     auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext);
     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
     m_agents.append(WTFMove(consoleAgent));
-
-    if (auto* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
-        commandLineAPIHost->init(m_instrumentingAgents.copyRef());
 }
 
 WorkerInspectorController::~WorkerInspectorController()
@@ -163,6 +160,8 @@
 
     m_didCreateLazyAgents = true;
 
+    m_injectedScriptManager->connect();
+
     auto workerContext = workerAgentContext();
 
     m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext));
@@ -177,6 +176,9 @@
     m_agents.append(std::make_unique<WebHeapAgent>(workerContext));
     m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
     m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
+
+    if (auto& commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
+        commandLineAPIHost->init(m_instrumentingAgents.copyRef());
 }
 
 InspectorFunctionCallHandler WorkerInspectorController::functionCallHandler() const

Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (246176 => 246177)


--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp	2019-06-06 23:28:34 UTC (rev 246176)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp	2019-06-06 23:31:40 UTC (rev 246177)
@@ -1409,7 +1409,7 @@
 
     m_inspectedNode = node;
 
-    if (CommandLineAPIHost* commandLineAPIHost = static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).commandLineAPIHost())
+    if (auto& commandLineAPIHost = static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).commandLineAPIHost())
         commandLineAPIHost->addInspectedObject(std::make_unique<InspectableNode>(node));
 
     m_suppressEventListenerChangedEvent = false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to