<!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>[243150] trunk/Source</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/243150">243150</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2019-03-19 10:50:19 -0700 (Tue, 19 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Heap: lazily create the agent
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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorHeapAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorHeapAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllercpp">trunk/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorWorkerInspectorControllercpp">trunk/Source/WebCore/inspector/WorkerInspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsWebConsoleAgentcpp">trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsWebConsoleAgenth">trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsWebHeapAgentcpp">trunk/Source/WebCore/inspector/agents/WebHeapAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsWebHeapAgenth">trunk/Source/WebCore/inspector/agents/WebHeapAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageConsoleAgentcpp">trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageConsoleAgenth">trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentspagePageHeapAgentcpp">trunk/Source/WebCore/inspector/agents/page/PageHeapAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsworkerWorkerConsoleAgentcpp">trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectoragentsworkerWorkerConsoleAgenth">trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/JavaScriptCore/ChangeLog       2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+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):
+
</ins><span class="cx"> 2019-03-19  Caio Lima  <ticaiolima@gmail.com>
</span><span class="cx"> 
</span><span class="cx">         [JSC] LLIntEntryPoint creates same DirectJITCode for all functions
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp      2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp 2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -73,8 +73,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto inspectorAgent = std::make_unique<InspectorAgent>(context);
</span><span class="cx">     auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
</span><del>-    auto heapAgent = std::make_unique<InspectorHeapAgent>(context);
-    auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context, heapAgent.get());
</del><ins>+    auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context);
</ins><span class="cx">     auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
</span><span class="cx">     auto scriptProfilerAgent = std::make_unique<InspectorScriptProfilerAgent>(context);
</span><span class="cx"> 
</span><span class="lines">@@ -87,7 +86,6 @@
</span><span class="cx">     m_agents.append(WTFMove(runtimeAgent));
</span><span class="cx">     m_agents.append(WTFMove(consoleAgent));
</span><span class="cx">     m_agents.append(WTFMove(debuggerAgent));
</span><del>-    m_agents.append(WTFMove(heapAgent));
</del><span class="cx">     m_agents.append(WTFMove(scriptProfilerAgent));
</span><span class="cx"> 
</span><span class="cx">     m_executionStopwatch->start();
</span><span class="lines">@@ -314,6 +312,11 @@
</span><span class="cx"> 
</span><span class="cx">     auto context = jsAgentContext();
</span><span class="cx"> 
</span><ins>+    auto heapAgent = std::make_unique<InspectorHeapAgent>(context);
+    if (m_consoleAgent)
+        m_consoleAgent->setInspectorHeapAgent(heapAgent.get());
+    m_agents.append(WTFMove(heapAgent));
+
</ins><span class="cx">     m_agents.append(std::make_unique<JSGlobalObjectAuditAgent>(context));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp   2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp      2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -42,19 +42,14 @@
</span><span class="cx"> static const unsigned maximumConsoleMessages = 100;
</span><span class="cx"> static const int expireConsoleMessagesStep = 10;
</span><span class="cx"> 
</span><del>-InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context, InspectorHeapAgent* heapAgent)
</del><ins>+InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context)
</ins><span class="cx">     : InspectorAgentBase("Console"_s)
</span><span class="cx">     , m_injectedScriptManager(context.injectedScriptManager)
</span><span class="cx">     , m_frontendDispatcher(std::make_unique<ConsoleFrontendDispatcher>(context.frontendRouter))
</span><span class="cx">     , m_backendDispatcher(ConsoleBackendDispatcher::create(context.backendDispatcher, this))
</span><del>-    , m_heapAgent(heapAgent)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-InspectorConsoleAgent::~InspectorConsoleAgent()
-{
-}
-
</del><span class="cx"> void InspectorConsoleAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -173,6 +168,9 @@
</span><span class="cx">     if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (!m_heapAgent)
+        return;
+
</ins><span class="cx">     ErrorString ignored;
</span><span class="cx">     double timestamp;
</span><span class="cx">     String snapshotData;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h     2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h        2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -52,13 +52,15 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    InspectorConsoleAgent(AgentContext&, InspectorHeapAgent*);
-    virtual ~InspectorConsoleAgent();
</del><ins>+    InspectorConsoleAgent(AgentContext&);
+    virtual ~InspectorConsoleAgent() = default;
</ins><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
</span><span class="cx">     void willDestroyFrontendAndBackend(DisconnectReason) override;
</span><span class="cx">     void discardValues() override;
</span><span class="cx"> 
</span><ins>+    void setInspectorHeapAgent(InspectorHeapAgent* agent) { m_heapAgent = agent; }
+
</ins><span class="cx">     void enable(ErrorString&) override;
</span><span class="cx">     void disable(ErrorString&) override;
</span><span class="cx">     void clearMessages(ErrorString&) override;
</span><span class="lines">@@ -82,7 +84,7 @@
</span><span class="cx">     InjectedScriptManager& m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr<ConsoleFrontendDispatcher> m_frontendDispatcher;
</span><span class="cx">     RefPtr<ConsoleBackendDispatcher> m_backendDispatcher;
</span><del>-    InspectorHeapAgent* m_heapAgent;
</del><ins>+    InspectorHeapAgent* m_heapAgent { nullptr };
</ins><span class="cx"> 
</span><span class="cx">     Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages;
</span><span class="cx">     int m_expiredConsoleMessageCount { 0 };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorHeapAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp      2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp 2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -48,10 +48,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-InspectorHeapAgent::~InspectorHeapAgent()
-{
-}
-
</del><span class="cx"> void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorHeapAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h        2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h   2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     InspectorHeapAgent(AgentContext&);
</span><del>-    virtual ~InspectorHeapAgent();
</del><ins>+    virtual ~InspectorHeapAgent() = default;
</ins><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
</span><span class="cx">     void willDestroyFrontendAndBackend(DisconnectReason) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/ChangeLog      2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+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):
+
</ins><span class="cx"> 2019-03-19  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Fix GraphicsLayer-related crashes after r243129
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp   2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp      2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -131,15 +131,11 @@
</span><span class="cx">     InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
</span><span class="cx">     m_agents.append(WTFMove(domStorageAgentPtr));
</span><span class="cx"> 
</span><del>-    auto heapAgentPtr = std::make_unique<PageHeapAgent>(pageContext);
-    InspectorHeapAgent* heapAgent = heapAgentPtr.get();
-    m_agents.append(WTFMove(heapAgentPtr));
-
</del><span class="cx">     auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext);
</span><span class="cx">     m_instrumentingAgents->setInspectorScriptProfilerAgent(scriptProfilerAgentPtr.get());
</span><span class="cx">     m_agents.append(WTFMove(scriptProfilerAgentPtr));
</span><span class="cx"> 
</span><del>-    auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, heapAgent, m_domAgent);
</del><ins>+    auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, m_domAgent);
</ins><span class="cx">     WebConsoleAgent* consoleAgent = consoleAgentPtr.get();
</span><span class="cx">     m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get());
</span><span class="cx">     m_agents.append(WTFMove(consoleAgentPtr));
</span><span class="lines">@@ -202,6 +198,7 @@
</span><span class="cx"> #if ENABLE(RESOURCE_USAGE)
</span><span class="cx">     m_agents.append(std::make_unique<InspectorCPUProfilerAgent>(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorMemoryAgent>(pageContext));
</span><ins>+    m_agents.append(std::make_unique<PageHeapAgent>(pageContext));
</ins><span class="cx"> #endif
</span><span class="cx">     m_agents.append(std::make_unique<PageAuditAgent>(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique<InspectorCanvasAgent>(pageContext));
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorWorkerInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/WorkerInspectorController.cpp     2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.cpp        2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -69,15 +69,12 @@
</span><span class="cx"> 
</span><span class="cx">     auto workerContext = workerAgentContext();
</span><span class="cx"> 
</span><del>-    auto heapAgent = std::make_unique<WebHeapAgent>(workerContext);
-    auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext, heapAgent.get());
-
</del><ins>+    auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext);
</ins><span class="cx">     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
</span><span class="cx"> 
</span><span class="cx">     m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext));
</span><span class="cx">     m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
</span><span class="cx">     m_agents.append(WTFMove(consoleAgent));
</span><del>-    m_agents.append(WTFMove(heapAgent));
</del><span class="cx"> 
</span><span class="cx">     if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
</span><span class="cx">         commandLineAPIHost->init(nullptr, m_instrumentingAgents->webConsoleAgent(), nullptr, nullptr);
</span><span class="lines">@@ -178,6 +175,7 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    m_agents.append(std::make_unique<WebHeapAgent>(workerContext));
</ins><span class="cx">     m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsWebConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp        2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp   2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -43,8 +43,8 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-WebConsoleAgent::WebConsoleAgent(AgentContext& context, InspectorHeapAgent* heapAgent)
-    : InspectorConsoleAgent(context, heapAgent)
</del><ins>+WebConsoleAgent::WebConsoleAgent(AgentContext& context)
+    : InspectorConsoleAgent(context)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsWebConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h  2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h     2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(WebConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    WebConsoleAgent(Inspector::AgentContext&, Inspector::InspectorHeapAgent*);
</del><ins>+    WebConsoleAgent(Inspector::AgentContext&);
</ins><span class="cx">     virtual ~WebConsoleAgent() = default;
</span><span class="cx"> 
</span><span class="cx">     void frameWindowDiscarded(DOMWindow*);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsWebHeapAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/WebHeapAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/WebHeapAgent.cpp   2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/WebHeapAgent.cpp      2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -92,8 +92,9 @@
</span><span class="cx">     m_agent.dispatchGarbageCollectionEventsAfterDelay(WTFMove(collectionsToSend));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebHeapAgent::WebHeapAgent(Inspector::AgentContext& context)
</del><ins>+WebHeapAgent::WebHeapAgent(WebAgentContext& context)
</ins><span class="cx">     : InspectorHeapAgent(context)
</span><ins>+    , m_instrumentingAgents(context.instrumentingAgents)
</ins><span class="cx">     , m_sendGarbageCollectionEventsTask(std::make_unique<SendGarbageCollectionEventsTask>(*this))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -103,10 +104,21 @@
</span><span class="cx">     m_sendGarbageCollectionEventsTask->reset();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebHeapAgent::enable(ErrorString& errorString)
+{
+    InspectorHeapAgent::enable(errorString);
+
+    if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent())
+        consoleAgent->setInspectorHeapAgent(this);
+}
+
</ins><span class="cx"> void WebHeapAgent::disable(ErrorString& errorString)
</span><span class="cx"> {
</span><span class="cx">     m_sendGarbageCollectionEventsTask->reset();
</span><span class="cx"> 
</span><ins>+    if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent())
+        consoleAgent->setInspectorHeapAgent(nullptr);
+
</ins><span class="cx">     InspectorHeapAgent::disable(errorString);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsWebHeapAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/WebHeapAgent.h (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/WebHeapAgent.h     2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/WebHeapAgent.h        2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include "InspectorWebAgentBase.h"
</ins><span class="cx"> #include <JavaScriptCore/InspectorHeapAgent.h>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> 
</span><span class="lines">@@ -39,10 +40,11 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx">     friend class SendGarbageCollectionEventsTask;
</span><span class="cx"> public:
</span><del>-    WebHeapAgent(Inspector::AgentContext&);
</del><ins>+    WebHeapAgent(WebAgentContext&);
</ins><span class="cx">     virtual ~WebHeapAgent();
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><ins>+    void enable(ErrorString&) override;
</ins><span class="cx">     void disable(ErrorString&) override;
</span><span class="cx"> 
</span><span class="cx">     void dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type, Seconds startTime, Seconds endTime) override;
</span><span class="lines">@@ -49,6 +51,8 @@
</span><span class="cx"> 
</span><span class="cx">     void dispatchGarbageCollectionEventsAfterDelay(Vector<GarbageCollectionData>&& collections);
</span><span class="cx"> 
</span><ins>+    InstrumentingAgents& m_instrumentingAgents;
+
</ins><span class="cx">     std::unique_ptr<SendGarbageCollectionEventsTask> m_sendGarbageCollectionEventsTask;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp  2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp     2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -42,8 +42,8 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, InspectorHeapAgent* heapAgent, InspectorDOMAgent* domAgent)
-    : WebConsoleAgent(context, heapAgent)
</del><ins>+PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, InspectorDOMAgent* domAgent)
+    : WebConsoleAgent(context)
</ins><span class="cx">     , m_inspectorDOMAgent(domAgent)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h    2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h       2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PageConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    PageConsoleAgent(WebAgentContext&, Inspector::InspectorHeapAgent*, InspectorDOMAgent*);
</del><ins>+    PageConsoleAgent(WebAgentContext&, InspectorDOMAgent*);
</ins><span class="cx">     virtual ~PageConsoleAgent() = default;
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentspagePageHeapAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/page/PageHeapAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/page/PageHeapAgent.cpp     2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/page/PageHeapAgent.cpp        2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -45,8 +45,8 @@
</span><span class="cx"> 
</span><span class="cx"> void PageHeapAgent::disable(ErrorString& errorString)
</span><span class="cx"> {
</span><ins>+    m_instrumentingAgents.setPageHeapAgent(nullptr);
</ins><span class="cx">     WebHeapAgent::disable(errorString);
</span><del>-    m_instrumentingAgents.setPageHeapAgent(nullptr);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageHeapAgent::mainFrameNavigated()
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsworkerWorkerConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp      2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp 2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -32,8 +32,8 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><del>-WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context, InspectorHeapAgent* heapAgent)
-    : WebConsoleAgent(context, heapAgent)
</del><ins>+WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context)
+    : WebConsoleAgent(context)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(context.workerGlobalScope.isContextThread());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectoragentsworkerWorkerConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h (243149 => 243150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h        2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h   2019-03-19 17:50:19 UTC (rev 243150)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(WorkerConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    WorkerConsoleAgent(WorkerAgentContext&, Inspector::InspectorHeapAgent*);
</del><ins>+    WorkerConsoleAgent(WorkerAgentContext&);
</ins><span class="cx">     ~WorkerConsoleAgent() = default;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>