Changeset 246177 in webkit


Ignore:
Timestamp:
Jun 6, 2019 4:31:40 PM (5 years ago)
Author:
Devin Rousso
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/JavaScriptCore:

  • 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):

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r246166 r246177  
     12019-06-06  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: create CommandLineAPIHost lazily like the other agents
     4        https://bugs.webkit.org/show_bug.cgi?id=196047
     5        <rdar://problem/49087835>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/InjectedScriptManager.h:
     10        * inspector/InjectedScriptManager.cpp:
     11        (Inspector::InjectedScriptManager::connect): Added.
     12
    1132019-06-06  Keith Miller  <keith_miller@apple.com>
    214
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp

    r243161 r246177  
    5858}
    5959
     60void InjectedScriptManager::connect()
     61{
     62}
     63
    6064void InjectedScriptManager::disconnect()
    6165{
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.h

    r243161 r246177  
    5050    virtual ~InjectedScriptManager();
    5151
     52    virtual void connect();
    5253    virtual void disconnect();
    5354    virtual void discardInjectedScripts();
  • trunk/Source/WebCore/ChangeLog

    r246170 r246177  
     12019-06-06  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: create CommandLineAPIHost lazily like the other agents
     4        https://bugs.webkit.org/show_bug.cgi?id=196047
     5        <rdar://problem/49087835>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        No change in functionality.
     10
     11        * inspector/InspectorController.cpp:
     12        (WebCore::InspectorController::InspectorController):
     13        (WebCore::InspectorController::createLazyAgents):
     14        * inspector/WorkerInspectorController.cpp:
     15        (WebCore::WorkerInspectorController::WorkerInspectorController):
     16        (WebCore::WorkerInspectorController::createLazyAgents):
     17
     18        * inspector/WebInjectedScriptManager.h:
     19        * inspector/WebInjectedScriptManager.cpp:
     20        (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
     21        (WebCore::WebInjectedScriptManager::connect): Added.
     22        (WebCore::WebInjectedScriptManager::disconnect):
     23        (WebCore::WebInjectedScriptManager::discardInjectedScripts):
     24
     25        * inspector/agents/InspectorDOMAgent.cpp:
     26        (WebCore::InspectorDOMAgent::setInspectedNode):
     27
    1282019-06-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
    229
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r246142 r246177  
    110110    m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
    111111    m_agents.append(WTFMove(consoleAgent));
    112 
    113     ASSERT(m_injectedScriptManager->commandLineAPIHost());
    114     if (auto* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
    115         commandLineAPIHost->init(m_instrumentingAgents.copyRef());
    116112}
    117113
     
    150146
    151147    m_didCreateLazyAgents = true;
     148
     149    m_injectedScriptManager->connect();
    152150
    153151    auto pageContext = pageAgentContext();
     
    187185    m_agents.append(std::make_unique<InspectorCanvasAgent>(pageContext));
    188186    m_agents.append(std::make_unique<InspectorTimelineAgent>(pageContext));
     187
     188    if (auto& commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
     189        commandLineAPIHost->init(m_instrumentingAgents.copyRef());
    189190}
    190191
  • trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp

    r225263 r246177  
    3737WebInjectedScriptManager::WebInjectedScriptManager(InspectorEnvironment& environment, Ref<InjectedScriptHost>&& host)
    3838    : InjectedScriptManager(environment, WTFMove(host))
    39     , m_commandLineAPIHost(CommandLineAPIHost::create())
    4039{
     40}
     41
     42void WebInjectedScriptManager::connect()
     43{
     44    InjectedScriptManager::connect();
     45
     46    m_commandLineAPIHost = CommandLineAPIHost::create();
    4147}
    4248
     
    4551    InjectedScriptManager::disconnect();
    4652
    47     m_commandLineAPIHost->disconnect();
    48     m_commandLineAPIHost = nullptr;
     53    if (m_commandLineAPIHost) {
     54        m_commandLineAPIHost->disconnect();
     55        m_commandLineAPIHost = nullptr;
     56    }
    4957}
    5058
     
    5361    InjectedScriptManager::discardInjectedScripts();
    5462
    55     m_commandLineAPIHost->clearAllWrappers();
     63    if (m_commandLineAPIHost)
     64        m_commandLineAPIHost->clearAllWrappers();
    5665}
    5766
  • trunk/Source/WebCore/inspector/WebInjectedScriptManager.h

    r228218 r246177  
    4141    virtual ~WebInjectedScriptManager() = default;
    4242
    43     CommandLineAPIHost* commandLineAPIHost() const { return m_commandLineAPIHost.get(); }
     43    const RefPtr<CommandLineAPIHost>& commandLineAPIHost() const { return m_commandLineAPIHost; }
    4444
     45    void connect() override;
    4546    void disconnect() override;
    4647    void discardInjectedScripts() override;
  • trunk/Source/WebCore/inspector/WorkerInspectorController.cpp

    r243243 r246177  
    7373    m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
    7474    m_agents.append(WTFMove(consoleAgent));
    75 
    76     if (auto* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
    77         commandLineAPIHost->init(m_instrumentingAgents.copyRef());
    7875}
    7976
     
    164161    m_didCreateLazyAgents = true;
    165162
     163    m_injectedScriptManager->connect();
     164
    166165    auto workerContext = workerAgentContext();
    167166
     
    178177    m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
    179178    m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
     179
     180    if (auto& commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
     181        commandLineAPIHost->init(m_instrumentingAgents.copyRef());
    180182}
    181183
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp

    r245730 r246177  
    14101410    m_inspectedNode = node;
    14111411
    1412     if (CommandLineAPIHost* commandLineAPIHost = static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).commandLineAPIHost())
     1412    if (auto& commandLineAPIHost = static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).commandLineAPIHost())
    14131413        commandLineAPIHost->addInspectedObject(std::make_unique<InspectableNode>(node));
    14141414
Note: See TracChangeset for help on using the changeset viewer.