Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (243149 => 243150)
--- trunk/Source/_javascript_Core/ChangeLog 2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-03-19 17:50:19 UTC (rev 243150)
@@ -1,3 +1,26 @@
+2019-03-19 Devin Rousso <[email protected]>
+
+ 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 <[email protected]>
[JSC] LLIntEntryPoint creates same DirectJITCode for all functions
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp (243149 => 243150)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp 2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp 2019-03-19 17:50:19 UTC (rev 243150)
@@ -73,8 +73,7 @@
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);
@@ -87,7 +86,6 @@
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();
@@ -314,6 +312,11 @@
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));
}
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp (243149 => 243150)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp 2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.cpp 2019-03-19 17:50:19 UTC (rev 243150)
@@ -42,19 +42,14 @@
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))
- , m_heapAgent(heapAgent)
{
}
-InspectorConsoleAgent::~InspectorConsoleAgent()
-{
-}
-
void InspectorConsoleAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
{
}
@@ -173,6 +168,9 @@
if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
return;
+ if (!m_heapAgent)
+ return;
+
ErrorString ignored;
double timestamp;
String snapshotData;
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h (243149 => 243150)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h 2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorConsoleAgent.h 2019-03-19 17:50:19 UTC (rev 243150)
@@ -52,13 +52,15 @@
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 setInspectorHeapAgent(InspectorHeapAgent* agent) { m_heapAgent = agent; }
+
void enable(ErrorString&) override;
void disable(ErrorString&) override;
void clearMessages(ErrorString&) override;
@@ -82,7 +84,7 @@
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 };
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp (243149 => 243150)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp 2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp 2019-03-19 17:50:19 UTC (rev 243150)
@@ -48,10 +48,6 @@
{
}
-InspectorHeapAgent::~InspectorHeapAgent()
-{
-}
-
void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
{
}
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h (243149 => 243150)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h 2019-03-19 17:49:21 UTC (rev 243149)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h 2019-03-19 17:50:19 UTC (rev 243150)
@@ -47,7 +47,7 @@
WTF_MAKE_FAST_ALLOCATED;
public:
InspectorHeapAgent(AgentContext&);
- virtual ~InspectorHeapAgent();
+ virtual ~InspectorHeapAgent() = default;
void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
void willDestroyFrontendAndBackend(DisconnectReason) override;
Modified: trunk/Source/WebCore/ChangeLog (243149 => 243150)
--- 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)
@@ -1,3 +1,38 @@
+2019-03-19 Devin Rousso <[email protected]>
+
+ 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 <[email protected]>
Fix GraphicsLayer-related crashes after r243129
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (243149 => 243150)
--- 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)
@@ -131,15 +131,11 @@
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 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));
@@ -202,6 +198,7 @@
#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));
Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (243149 => 243150)
--- 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)
@@ -69,15 +69,12 @@
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_agents.append(WTFMove(heapAgent));
if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
commandLineAPIHost->init(nullptr, m_instrumentingAgents->webConsoleAgent(), nullptr, nullptr);
@@ -178,6 +175,7 @@
}
#endif
+ m_agents.append(std::make_unique<WebHeapAgent>(workerContext));
m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
}
Modified: trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp (243149 => 243150)
--- 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)
@@ -43,8 +43,8 @@
using namespace Inspector;
-WebConsoleAgent::WebConsoleAgent(AgentContext& context, InspectorHeapAgent* heapAgent)
- : InspectorConsoleAgent(context, heapAgent)
+WebConsoleAgent::WebConsoleAgent(AgentContext& context)
+ : InspectorConsoleAgent(context)
{
}
Modified: trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h (243149 => 243150)
--- 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)
@@ -38,7 +38,7 @@
WTF_MAKE_NONCOPYABLE(WebConsoleAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
- WebConsoleAgent(Inspector::AgentContext&, Inspector::InspectorHeapAgent*);
+ WebConsoleAgent(Inspector::AgentContext&);
virtual ~WebConsoleAgent() = default;
void frameWindowDiscarded(DOMWindow*);
Modified: trunk/Source/WebCore/inspector/agents/WebHeapAgent.cpp (243149 => 243150)
--- 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)
@@ -92,8 +92,9 @@
m_agent.dispatchGarbageCollectionEventsAfterDelay(WTFMove(collectionsToSend));
}
-WebHeapAgent::WebHeapAgent(Inspector::AgentContext& context)
+WebHeapAgent::WebHeapAgent(WebAgentContext& context)
: InspectorHeapAgent(context)
+ , m_instrumentingAgents(context.instrumentingAgents)
, m_sendGarbageCollectionEventsTask(std::make_unique<SendGarbageCollectionEventsTask>(*this))
{
}
@@ -103,10 +104,21 @@
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();
+ if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent())
+ consoleAgent->setInspectorHeapAgent(nullptr);
+
InspectorHeapAgent::disable(errorString);
}
Modified: trunk/Source/WebCore/inspector/agents/WebHeapAgent.h (243149 => 243150)
--- 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)
@@ -25,6 +25,7 @@
#pragma once
+#include "InspectorWebAgentBase.h"
#include <_javascript_Core/InspectorHeapAgent.h>
#include <wtf/Forward.h>
@@ -39,10 +40,11 @@
WTF_MAKE_FAST_ALLOCATED;
friend class SendGarbageCollectionEventsTask;
public:
- WebHeapAgent(Inspector::AgentContext&);
+ WebHeapAgent(WebAgentContext&);
virtual ~WebHeapAgent();
protected:
+ void enable(ErrorString&) override;
void disable(ErrorString&) override;
void dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type, Seconds startTime, Seconds endTime) override;
@@ -49,6 +51,8 @@
void dispatchGarbageCollectionEventsAfterDelay(Vector<GarbageCollectionData>&& collections);
+ InstrumentingAgents& m_instrumentingAgents;
+
std::unique_ptr<SendGarbageCollectionEventsTask> m_sendGarbageCollectionEventsTask;
};
Modified: trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp (243149 => 243150)
--- 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)
@@ -42,8 +42,8 @@
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)
{
}
Modified: trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h (243149 => 243150)
--- 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)
@@ -42,7 +42,7 @@
WTF_MAKE_NONCOPYABLE(PageConsoleAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
- PageConsoleAgent(WebAgentContext&, Inspector::InspectorHeapAgent*, InspectorDOMAgent*);
+ PageConsoleAgent(WebAgentContext&, InspectorDOMAgent*);
virtual ~PageConsoleAgent() = default;
private:
Modified: trunk/Source/WebCore/inspector/agents/page/PageHeapAgent.cpp (243149 => 243150)
--- 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)
@@ -45,8 +45,8 @@
void PageHeapAgent::disable(ErrorString& errorString)
{
+ m_instrumentingAgents.setPageHeapAgent(nullptr);
WebHeapAgent::disable(errorString);
- m_instrumentingAgents.setPageHeapAgent(nullptr);
}
void PageHeapAgent::mainFrameNavigated()
Modified: trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp (243149 => 243150)
--- 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)
@@ -32,8 +32,8 @@
using namespace Inspector;
-WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context, InspectorHeapAgent* heapAgent)
- : WebConsoleAgent(context, heapAgent)
+WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context)
+ : WebConsoleAgent(context)
{
ASSERT(context.workerGlobalScope.isContextThread());
}
Modified: trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h (243149 => 243150)
--- 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)
@@ -34,7 +34,7 @@
WTF_MAKE_NONCOPYABLE(WorkerConsoleAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
- WorkerConsoleAgent(WorkerAgentContext&, Inspector::InspectorHeapAgent*);
+ WorkerConsoleAgent(WorkerAgentContext&);
~WorkerConsoleAgent() = default;
};