Web Inspector: Heap: lazily create the agent
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 17:50:19 +0000 (17:50 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 17:50:19 +0000 (17:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195590
<rdar://problem/48791750>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/agents/InspectorHeapAgent.h:
* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::~InspectorHeapAgent): Deleted.

* inspector/agents/InspectorConsoleAgent.h:
(Inspector::InspectorConsoleAgent::setInspectorHeapAgent): Added.
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::InspectorConsoleAgent):
(Inspector::InspectorConsoleAgent::takeHeapSnapshot):
(Inspector::InspectorConsoleAgent::~InspectorConsoleAgent): Deleted.

* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::createLazyAgents):

Source/WebCore:

No change in functionality.

* inspector/agents/page/PageHeapAgent.cpp:
(WebCore::PageHeapAgent::disable):
* inspector/agents/WebHeapAgent.h:
* inspector/agents/WebHeapAgent.cpp:
(WebCore::WebHeapAgent::WebHeapAgent):
(WebCore::WebHeapAgent::enable): Added.
(WebCore::WebHeapAgent::disable):

* inspector/agents/page/PageConsoleAgent.h:
* inspector/agents/page/PageConsoleAgent.cpp:
(WebCore::PageConsoleAgent::PageConsoleAgent):
* inspector/agents/WebConsoleAgent.h:
* inspector/agents/WebConsoleAgent.cpp:
(WebCore::WebConsoleAgent::WebConsoleAgent):
* inspector/agents/worker/WorkerConsoleAgent.h:
* inspector/agents/worker/WorkerConsoleAgent.cpp:
(WebCore::WorkerConsoleAgent::WorkerConsoleAgent):

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243150 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/agents/WebConsoleAgent.cpp
Source/WebCore/inspector/agents/WebConsoleAgent.h
Source/WebCore/inspector/agents/WebHeapAgent.cpp
Source/WebCore/inspector/agents/WebHeapAgent.h
Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp
Source/WebCore/inspector/agents/page/PageConsoleAgent.h
Source/WebCore/inspector/agents/page/PageHeapAgent.cpp
Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp
Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h

index 0fc72f8..6b21256 100644 (file)
@@ -1,3 +1,26 @@
+2019-03-19  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Heap: lazily create the agent
+        https://bugs.webkit.org/show_bug.cgi?id=195590
+        <rdar://problem/48791750>
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/agents/InspectorHeapAgent.h:
+        * inspector/agents/InspectorHeapAgent.cpp:
+        (Inspector::InspectorHeapAgent::~InspectorHeapAgent): Deleted.
+
+        * inspector/agents/InspectorConsoleAgent.h:
+        (Inspector::InspectorConsoleAgent::setInspectorHeapAgent): Added.
+        * inspector/agents/InspectorConsoleAgent.cpp:
+        (Inspector::InspectorConsoleAgent::InspectorConsoleAgent):
+        (Inspector::InspectorConsoleAgent::takeHeapSnapshot):
+        (Inspector::InspectorConsoleAgent::~InspectorConsoleAgent): Deleted.
+
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        (Inspector::JSGlobalObjectInspectorController::createLazyAgents):
+
 2019-03-19  Caio Lima  <ticaiolima@gmail.com>
 
         [JSC] LLIntEntryPoint creates same DirectJITCode for all functions
 2019-03-19  Caio Lima  <ticaiolima@gmail.com>
 
         [JSC] LLIntEntryPoint creates same DirectJITCode for all functions
index 0e62aa4..7844ef7 100644 (file)
@@ -73,8 +73,7 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
 
     auto inspectorAgent = std::make_unique<InspectorAgent>(context);
     auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
 
     auto inspectorAgent = std::make_unique<InspectorAgent>(context);
     auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
-    auto heapAgent = std::make_unique<InspectorHeapAgent>(context);
-    auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context, heapAgent.get());
+    auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context);
     auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
     auto scriptProfilerAgent = std::make_unique<InspectorScriptProfilerAgent>(context);
 
     auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
     auto scriptProfilerAgent = std::make_unique<InspectorScriptProfilerAgent>(context);
 
@@ -87,7 +86,6 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
     m_agents.append(WTFMove(runtimeAgent));
     m_agents.append(WTFMove(consoleAgent));
     m_agents.append(WTFMove(debuggerAgent));
     m_agents.append(WTFMove(runtimeAgent));
     m_agents.append(WTFMove(consoleAgent));
     m_agents.append(WTFMove(debuggerAgent));
-    m_agents.append(WTFMove(heapAgent));
     m_agents.append(WTFMove(scriptProfilerAgent));
 
     m_executionStopwatch->start();
     m_agents.append(WTFMove(scriptProfilerAgent));
 
     m_executionStopwatch->start();
@@ -314,6 +312,11 @@ void JSGlobalObjectInspectorController::createLazyAgents()
 
     auto context = jsAgentContext();
 
 
     auto context = jsAgentContext();
 
+    auto heapAgent = std::make_unique<InspectorHeapAgent>(context);
+    if (m_consoleAgent)
+        m_consoleAgent->setInspectorHeapAgent(heapAgent.get());
+    m_agents.append(WTFMove(heapAgent));
+
     m_agents.append(std::make_unique<JSGlobalObjectAuditAgent>(context));
 }
 
     m_agents.append(std::make_unique<JSGlobalObjectAuditAgent>(context));
 }
 
index 85bdb81..1062740 100644 (file)
@@ -42,16 +42,11 @@ namespace Inspector {
 static const unsigned maximumConsoleMessages = 100;
 static const int expireConsoleMessagesStep = 10;
 
 static const unsigned maximumConsoleMessages = 100;
 static const int expireConsoleMessagesStep = 10;
 
-InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context, InspectorHeapAgent* heapAgent)
+InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context)
     : InspectorAgentBase("Console"_s)
     , m_injectedScriptManager(context.injectedScriptManager)
     , m_frontendDispatcher(std::make_unique<ConsoleFrontendDispatcher>(context.frontendRouter))
     , m_backendDispatcher(ConsoleBackendDispatcher::create(context.backendDispatcher, this))
     : InspectorAgentBase("Console"_s)
     , m_injectedScriptManager(context.injectedScriptManager)
     , m_frontendDispatcher(std::make_unique<ConsoleFrontendDispatcher>(context.frontendRouter))
     , m_backendDispatcher(ConsoleBackendDispatcher::create(context.backendDispatcher, this))
-    , m_heapAgent(heapAgent)
-{
-}
-
-InspectorConsoleAgent::~InspectorConsoleAgent()
 {
 }
 
 {
 }
 
@@ -173,6 +168,9 @@ void InspectorConsoleAgent::takeHeapSnapshot(const String& title)
     if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
         return;
 
     if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
         return;
 
+    if (!m_heapAgent)
+        return;
+
     ErrorString ignored;
     double timestamp;
     String snapshotData;
     ErrorString ignored;
     double timestamp;
     String snapshotData;
index 6184764..f0b6aae 100644 (file)
@@ -52,13 +52,15 @@ class JS_EXPORT_PRIVATE InspectorConsoleAgent : public InspectorAgentBase, publi
     WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorConsoleAgent(AgentContext&, InspectorHeapAgent*);
-    virtual ~InspectorConsoleAgent();
+    InspectorConsoleAgent(AgentContext&);
+    virtual ~InspectorConsoleAgent() = default;
 
     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
     void willDestroyFrontendAndBackend(DisconnectReason) override;
     void discardValues() override;
 
 
     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
     void willDestroyFrontendAndBackend(DisconnectReason) override;
     void discardValues() override;
 
+    void setInspectorHeapAgent(InspectorHeapAgent* agent) { m_heapAgent = agent; }
+
     void enable(ErrorString&) override;
     void disable(ErrorString&) override;
     void clearMessages(ErrorString&) override;
     void enable(ErrorString&) override;
     void disable(ErrorString&) override;
     void clearMessages(ErrorString&) override;
@@ -82,7 +84,7 @@ protected:
     InjectedScriptManager& m_injectedScriptManager;
     std::unique_ptr<ConsoleFrontendDispatcher> m_frontendDispatcher;
     RefPtr<ConsoleBackendDispatcher> m_backendDispatcher;
     InjectedScriptManager& m_injectedScriptManager;
     std::unique_ptr<ConsoleFrontendDispatcher> m_frontendDispatcher;
     RefPtr<ConsoleBackendDispatcher> m_backendDispatcher;
-    InspectorHeapAgent* m_heapAgent;
+    InspectorHeapAgent* m_heapAgent { nullptr };
 
     Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages;
     int m_expiredConsoleMessageCount { 0 };
 
     Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages;
     int m_expiredConsoleMessageCount { 0 };
index b00bb9b..908bc0e 100644 (file)
@@ -48,10 +48,6 @@ InspectorHeapAgent::InspectorHeapAgent(AgentContext& context)
 {
 }
 
 {
 }
 
-InspectorHeapAgent::~InspectorHeapAgent()
-{
-}
-
 void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
 {
 }
 void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
 {
 }
index 743c398..2bb916f 100644 (file)
@@ -47,7 +47,7 @@ class JS_EXPORT_PRIVATE InspectorHeapAgent : public InspectorAgentBase, public H
     WTF_MAKE_FAST_ALLOCATED;
 public:
     InspectorHeapAgent(AgentContext&);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     InspectorHeapAgent(AgentContext&);
-    virtual ~InspectorHeapAgent();
+    virtual ~InspectorHeapAgent() = default;
 
     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
     void willDestroyFrontendAndBackend(DisconnectReason) override;
 
     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
     void willDestroyFrontendAndBackend(DisconnectReason) override;
index c8be23f..646fe5f 100644 (file)
@@ -1,3 +1,38 @@
+2019-03-19  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Heap: lazily create the agent
+        https://bugs.webkit.org/show_bug.cgi?id=195590
+        <rdar://problem/48791750>
+
+        Reviewed by Joseph Pecoraro.
+
+        No change in functionality.
+
+        * inspector/agents/page/PageHeapAgent.cpp:
+        (WebCore::PageHeapAgent::disable):
+        * inspector/agents/WebHeapAgent.h:
+        * inspector/agents/WebHeapAgent.cpp:
+        (WebCore::WebHeapAgent::WebHeapAgent):
+        (WebCore::WebHeapAgent::enable): Added.
+        (WebCore::WebHeapAgent::disable):
+
+        * inspector/agents/page/PageConsoleAgent.h:
+        * inspector/agents/page/PageConsoleAgent.cpp:
+        (WebCore::PageConsoleAgent::PageConsoleAgent):
+        * inspector/agents/WebConsoleAgent.h:
+        * inspector/agents/WebConsoleAgent.cpp:
+        (WebCore::WebConsoleAgent::WebConsoleAgent):
+        * inspector/agents/worker/WorkerConsoleAgent.h:
+        * inspector/agents/worker/WorkerConsoleAgent.cpp:
+        (WebCore::WorkerConsoleAgent::WorkerConsoleAgent):
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::createLazyAgents):
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        (WebCore::WorkerInspectorController::createLazyAgents):
+
 2019-03-19  Simon Fraser  <simon.fraser@apple.com>
 
         Fix GraphicsLayer-related crashes after r243129
 2019-03-19  Simon Fraser  <simon.fraser@apple.com>
 
         Fix GraphicsLayer-related crashes after r243129
index 498a3d7..d6e8997 100644 (file)
@@ -131,15 +131,11 @@ InspectorController::InspectorController(Page& page, InspectorClient* inspectorC
     InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
     m_agents.append(WTFMove(domStorageAgentPtr));
 
     InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
     m_agents.append(WTFMove(domStorageAgentPtr));
 
-    auto heapAgentPtr = std::make_unique<PageHeapAgent>(pageContext);
-    InspectorHeapAgent* heapAgent = heapAgentPtr.get();
-    m_agents.append(WTFMove(heapAgentPtr));
-
     auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext);
     m_instrumentingAgents->setInspectorScriptProfilerAgent(scriptProfilerAgentPtr.get());
     m_agents.append(WTFMove(scriptProfilerAgentPtr));
 
     auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext);
     m_instrumentingAgents->setInspectorScriptProfilerAgent(scriptProfilerAgentPtr.get());
     m_agents.append(WTFMove(scriptProfilerAgentPtr));
 
-    auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, heapAgent, m_domAgent);
+    auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, m_domAgent);
     WebConsoleAgent* consoleAgent = consoleAgentPtr.get();
     m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get());
     m_agents.append(WTFMove(consoleAgentPtr));
     WebConsoleAgent* consoleAgent = consoleAgentPtr.get();
     m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get());
     m_agents.append(WTFMove(consoleAgentPtr));
@@ -202,6 +198,7 @@ void InspectorController::createLazyAgents()
 #if ENABLE(RESOURCE_USAGE)
     m_agents.append(std::make_unique<InspectorCPUProfilerAgent>(pageContext));
     m_agents.append(std::make_unique<InspectorMemoryAgent>(pageContext));
 #if ENABLE(RESOURCE_USAGE)
     m_agents.append(std::make_unique<InspectorCPUProfilerAgent>(pageContext));
     m_agents.append(std::make_unique<InspectorMemoryAgent>(pageContext));
+    m_agents.append(std::make_unique<PageHeapAgent>(pageContext));
 #endif
     m_agents.append(std::make_unique<PageAuditAgent>(pageContext));
     m_agents.append(std::make_unique<InspectorCanvasAgent>(pageContext));
 #endif
     m_agents.append(std::make_unique<PageAuditAgent>(pageContext));
     m_agents.append(std::make_unique<InspectorCanvasAgent>(pageContext));
index b063e6f..b8ee440 100644 (file)
@@ -69,15 +69,12 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope& workerGl
 
     auto workerContext = workerAgentContext();
 
 
     auto workerContext = workerAgentContext();
 
-    auto heapAgent = std::make_unique<WebHeapAgent>(workerContext);
-    auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext, heapAgent.get());
-
+    auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext);
     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
 
     m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext));
     m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
     m_agents.append(WTFMove(consoleAgent));
     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
 
     m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext));
     m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
     m_agents.append(WTFMove(consoleAgent));
-    m_agents.append(WTFMove(heapAgent));
 
     if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
         commandLineAPIHost->init(nullptr, m_instrumentingAgents->webConsoleAgent(), nullptr, nullptr);
 
     if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
         commandLineAPIHost->init(nullptr, m_instrumentingAgents->webConsoleAgent(), nullptr, nullptr);
@@ -178,6 +175,7 @@ void WorkerInspectorController::createLazyAgents()
     }
 #endif
 
     }
 #endif
 
+    m_agents.append(std::make_unique<WebHeapAgent>(workerContext));
     m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
 }
 
     m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
 }
 
index 9d5eb0b..5a18f81 100644 (file)
@@ -43,8 +43,8 @@ namespace WebCore {
 
 using namespace Inspector;
 
 
 using namespace Inspector;
 
-WebConsoleAgent::WebConsoleAgent(AgentContext& context, InspectorHeapAgent* heapAgent)
-    : InspectorConsoleAgent(context, heapAgent)
+WebConsoleAgent::WebConsoleAgent(AgentContext& context)
+    : InspectorConsoleAgent(context)
 {
 }
 
 {
 }
 
index a82f5e7..e49a78f 100644 (file)
@@ -38,7 +38,7 @@ class WebConsoleAgent : public Inspector::InspectorConsoleAgent {
     WTF_MAKE_NONCOPYABLE(WebConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     WTF_MAKE_NONCOPYABLE(WebConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WebConsoleAgent(Inspector::AgentContext&, Inspector::InspectorHeapAgent*);
+    WebConsoleAgent(Inspector::AgentContext&);
     virtual ~WebConsoleAgent() = default;
 
     void frameWindowDiscarded(DOMWindow*);
     virtual ~WebConsoleAgent() = default;
 
     void frameWindowDiscarded(DOMWindow*);
index bf507fa..46e720b 100644 (file)
@@ -92,8 +92,9 @@ void SendGarbageCollectionEventsTask::timerFired()
     m_agent.dispatchGarbageCollectionEventsAfterDelay(WTFMove(collectionsToSend));
 }
 
     m_agent.dispatchGarbageCollectionEventsAfterDelay(WTFMove(collectionsToSend));
 }
 
-WebHeapAgent::WebHeapAgent(Inspector::AgentContext& context)
+WebHeapAgent::WebHeapAgent(WebAgentContext& context)
     : InspectorHeapAgent(context)
     : InspectorHeapAgent(context)
+    , m_instrumentingAgents(context.instrumentingAgents)
     , m_sendGarbageCollectionEventsTask(std::make_unique<SendGarbageCollectionEventsTask>(*this))
 {
 }
     , m_sendGarbageCollectionEventsTask(std::make_unique<SendGarbageCollectionEventsTask>(*this))
 {
 }
@@ -103,10 +104,21 @@ WebHeapAgent::~WebHeapAgent()
     m_sendGarbageCollectionEventsTask->reset();
 }
 
     m_sendGarbageCollectionEventsTask->reset();
 }
 
+void WebHeapAgent::enable(ErrorString& errorString)
+{
+    InspectorHeapAgent::enable(errorString);
+
+    if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent())
+        consoleAgent->setInspectorHeapAgent(this);
+}
+
 void WebHeapAgent::disable(ErrorString& errorString)
 {
     m_sendGarbageCollectionEventsTask->reset();
 
 void WebHeapAgent::disable(ErrorString& errorString)
 {
     m_sendGarbageCollectionEventsTask->reset();
 
+    if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent())
+        consoleAgent->setInspectorHeapAgent(nullptr);
+
     InspectorHeapAgent::disable(errorString);
 }
 
     InspectorHeapAgent::disable(errorString);
 }
 
index e13f876..ba963b5 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
 
 #pragma once
 
+#include "InspectorWebAgentBase.h"
 #include <JavaScriptCore/InspectorHeapAgent.h>
 #include <wtf/Forward.h>
 
 #include <JavaScriptCore/InspectorHeapAgent.h>
 #include <wtf/Forward.h>
 
@@ -39,16 +40,19 @@ class WebHeapAgent : public Inspector::InspectorHeapAgent {
     WTF_MAKE_FAST_ALLOCATED;
     friend class SendGarbageCollectionEventsTask;
 public:
     WTF_MAKE_FAST_ALLOCATED;
     friend class SendGarbageCollectionEventsTask;
 public:
-    WebHeapAgent(Inspector::AgentContext&);
+    WebHeapAgent(WebAgentContext&);
     virtual ~WebHeapAgent();
 
 protected:
     virtual ~WebHeapAgent();
 
 protected:
+    void enable(ErrorString&) override;
     void disable(ErrorString&) override;
 
     void dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type, Seconds startTime, Seconds endTime) override;
 
     void dispatchGarbageCollectionEventsAfterDelay(Vector<GarbageCollectionData>&& collections);
 
     void disable(ErrorString&) override;
 
     void dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type, Seconds startTime, Seconds endTime) override;
 
     void dispatchGarbageCollectionEventsAfterDelay(Vector<GarbageCollectionData>&& collections);
 
+    InstrumentingAgents& m_instrumentingAgents;
+
     std::unique_ptr<SendGarbageCollectionEventsTask> m_sendGarbageCollectionEventsTask;
 };
 
     std::unique_ptr<SendGarbageCollectionEventsTask> m_sendGarbageCollectionEventsTask;
 };
 
index 75e5670..6eb26e0 100644 (file)
@@ -42,8 +42,8 @@ namespace WebCore {
 
 using namespace Inspector;
 
 
 using namespace Inspector;
 
-PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, InspectorHeapAgent* heapAgent, InspectorDOMAgent* domAgent)
-    : WebConsoleAgent(context, heapAgent)
+PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, InspectorDOMAgent* domAgent)
+    : WebConsoleAgent(context)
     , m_inspectorDOMAgent(domAgent)
 {
 }
     , m_inspectorDOMAgent(domAgent)
 {
 }
index d5f559e..71cb890 100644 (file)
@@ -42,7 +42,7 @@ class PageConsoleAgent final : public WebConsoleAgent {
     WTF_MAKE_NONCOPYABLE(PageConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     WTF_MAKE_NONCOPYABLE(PageConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PageConsoleAgent(WebAgentContext&, Inspector::InspectorHeapAgent*, InspectorDOMAgent*);
+    PageConsoleAgent(WebAgentContext&, InspectorDOMAgent*);
     virtual ~PageConsoleAgent() = default;
 
 private:
     virtual ~PageConsoleAgent() = default;
 
 private:
index 81efd5e..7626b3d 100644 (file)
@@ -45,8 +45,8 @@ void PageHeapAgent::enable(ErrorString& errorString)
 
 void PageHeapAgent::disable(ErrorString& errorString)
 {
 
 void PageHeapAgent::disable(ErrorString& errorString)
 {
-    WebHeapAgent::disable(errorString);
     m_instrumentingAgents.setPageHeapAgent(nullptr);
     m_instrumentingAgents.setPageHeapAgent(nullptr);
+    WebHeapAgent::disable(errorString);
 }
 
 void PageHeapAgent::mainFrameNavigated()
 }
 
 void PageHeapAgent::mainFrameNavigated()
index 0ad29ac..381f572 100644 (file)
@@ -32,8 +32,8 @@ namespace WebCore {
 
 using namespace Inspector;
 
 
 using namespace Inspector;
 
-WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context, InspectorHeapAgent* heapAgent)
-    : WebConsoleAgent(context, heapAgent)
+WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context)
+    : WebConsoleAgent(context)
 {
     ASSERT(context.workerGlobalScope.isContextThread());
 }
 {
     ASSERT(context.workerGlobalScope.isContextThread());
 }
index 6bdfc3c..7a2d695 100644 (file)
@@ -34,7 +34,7 @@ class WorkerConsoleAgent final : public WebConsoleAgent {
     WTF_MAKE_NONCOPYABLE(WorkerConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     WTF_MAKE_NONCOPYABLE(WorkerConsoleAgent);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WorkerConsoleAgent(WorkerAgentContext&, Inspector::InspectorHeapAgent*);
+    WorkerConsoleAgent(WorkerAgentContext&);
     ~WorkerConsoleAgent() = default;
 };
 
     ~WorkerConsoleAgent() = default;
 };