Changeset 243150 in webkit
- Timestamp:
- Mar 19, 2019 10:50:19 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243136 r243150 1 2019-03-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Heap: lazily create the agent 4 https://bugs.webkit.org/show_bug.cgi?id=195590 5 <rdar://problem/48791750> 6 7 Reviewed by Joseph Pecoraro. 8 9 * inspector/agents/InspectorHeapAgent.h: 10 * inspector/agents/InspectorHeapAgent.cpp: 11 (Inspector::InspectorHeapAgent::~InspectorHeapAgent): Deleted. 12 13 * inspector/agents/InspectorConsoleAgent.h: 14 (Inspector::InspectorConsoleAgent::setInspectorHeapAgent): Added. 15 * inspector/agents/InspectorConsoleAgent.cpp: 16 (Inspector::InspectorConsoleAgent::InspectorConsoleAgent): 17 (Inspector::InspectorConsoleAgent::takeHeapSnapshot): 18 (Inspector::InspectorConsoleAgent::~InspectorConsoleAgent): Deleted. 19 20 * inspector/JSGlobalObjectInspectorController.cpp: 21 (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): 22 (Inspector::JSGlobalObjectInspectorController::createLazyAgents): 23 1 24 2019-03-19 Caio Lima <ticaiolima@gmail.com> 2 25 -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
r239976 r243150 74 74 auto inspectorAgent = std::make_unique<InspectorAgent>(context); 75 75 auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context); 76 auto heapAgent = std::make_unique<InspectorHeapAgent>(context); 77 auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context, heapAgent.get()); 76 auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context); 78 77 auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get()); 79 78 auto scriptProfilerAgent = std::make_unique<InspectorScriptProfilerAgent>(context); … … 88 87 m_agents.append(WTFMove(consoleAgent)); 89 88 m_agents.append(WTFMove(debuggerAgent)); 90 m_agents.append(WTFMove(heapAgent));91 89 m_agents.append(WTFMove(scriptProfilerAgent)); 92 90 … … 315 313 auto context = jsAgentContext(); 316 314 315 auto heapAgent = std::make_unique<InspectorHeapAgent>(context); 316 if (m_consoleAgent) 317 m_consoleAgent->setInspectorHeapAgent(heapAgent.get()); 318 m_agents.append(WTFMove(heapAgent)); 319 317 320 m_agents.append(std::make_unique<JSGlobalObjectAuditAgent>(context)); 318 321 } -
trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
r241244 r243150 43 43 static const int expireConsoleMessagesStep = 10; 44 44 45 InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context , InspectorHeapAgent* heapAgent)45 InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context) 46 46 : InspectorAgentBase("Console"_s) 47 47 , m_injectedScriptManager(context.injectedScriptManager) 48 48 , m_frontendDispatcher(std::make_unique<ConsoleFrontendDispatcher>(context.frontendRouter)) 49 49 , m_backendDispatcher(ConsoleBackendDispatcher::create(context.backendDispatcher, this)) 50 , m_heapAgent(heapAgent)51 {52 }53 54 InspectorConsoleAgent::~InspectorConsoleAgent()55 50 { 56 51 } … … 172 167 { 173 168 if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled()) 169 return; 170 171 if (!m_heapAgent) 174 172 return; 175 173 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
r228600 r243150 53 53 WTF_MAKE_FAST_ALLOCATED; 54 54 public: 55 InspectorConsoleAgent(AgentContext& , InspectorHeapAgent*);56 virtual ~InspectorConsoleAgent() ;55 InspectorConsoleAgent(AgentContext&); 56 virtual ~InspectorConsoleAgent() = default; 57 57 58 58 void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override; 59 59 void willDestroyFrontendAndBackend(DisconnectReason) override; 60 60 void discardValues() override; 61 62 void setInspectorHeapAgent(InspectorHeapAgent* agent) { m_heapAgent = agent; } 61 63 62 64 void enable(ErrorString&) override; … … 83 85 std::unique_ptr<ConsoleFrontendDispatcher> m_frontendDispatcher; 84 86 RefPtr<ConsoleBackendDispatcher> m_backendDispatcher; 85 InspectorHeapAgent* m_heapAgent ;87 InspectorHeapAgent* m_heapAgent { nullptr }; 86 88 87 89 Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages; -
trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
r239427 r243150 49 49 } 50 50 51 InspectorHeapAgent::~InspectorHeapAgent()52 {53 }54 55 51 void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) 56 52 { -
trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
r239427 r243150 48 48 public: 49 49 InspectorHeapAgent(AgentContext&); 50 virtual ~InspectorHeapAgent() ;50 virtual ~InspectorHeapAgent() = default; 51 51 52 52 void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override; -
trunk/Source/WebCore/ChangeLog
r243146 r243150 1 2019-03-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Heap: lazily create the agent 4 https://bugs.webkit.org/show_bug.cgi?id=195590 5 <rdar://problem/48791750> 6 7 Reviewed by Joseph Pecoraro. 8 9 No change in functionality. 10 11 * inspector/agents/page/PageHeapAgent.cpp: 12 (WebCore::PageHeapAgent::disable): 13 * inspector/agents/WebHeapAgent.h: 14 * inspector/agents/WebHeapAgent.cpp: 15 (WebCore::WebHeapAgent::WebHeapAgent): 16 (WebCore::WebHeapAgent::enable): Added. 17 (WebCore::WebHeapAgent::disable): 18 19 * inspector/agents/page/PageConsoleAgent.h: 20 * inspector/agents/page/PageConsoleAgent.cpp: 21 (WebCore::PageConsoleAgent::PageConsoleAgent): 22 * inspector/agents/WebConsoleAgent.h: 23 * inspector/agents/WebConsoleAgent.cpp: 24 (WebCore::WebConsoleAgent::WebConsoleAgent): 25 * inspector/agents/worker/WorkerConsoleAgent.h: 26 * inspector/agents/worker/WorkerConsoleAgent.cpp: 27 (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): 28 29 * inspector/InspectorController.cpp: 30 (WebCore::InspectorController::InspectorController): 31 (WebCore::InspectorController::createLazyAgents): 32 * inspector/WorkerInspectorController.cpp: 33 (WebCore::WorkerInspectorController::WorkerInspectorController): 34 (WebCore::WorkerInspectorController::createLazyAgents): 35 1 36 2019-03-19 Simon Fraser <simon.fraser@apple.com> 2 37 -
trunk/Source/WebCore/inspector/InspectorController.cpp
r243119 r243150 132 132 m_agents.append(WTFMove(domStorageAgentPtr)); 133 133 134 auto heapAgentPtr = std::make_unique<PageHeapAgent>(pageContext);135 InspectorHeapAgent* heapAgent = heapAgentPtr.get();136 m_agents.append(WTFMove(heapAgentPtr));137 138 134 auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext); 139 135 m_instrumentingAgents->setInspectorScriptProfilerAgent(scriptProfilerAgentPtr.get()); 140 136 m_agents.append(WTFMove(scriptProfilerAgentPtr)); 141 137 142 auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, heapAgent,m_domAgent);138 auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, m_domAgent); 143 139 WebConsoleAgent* consoleAgent = consoleAgentPtr.get(); 144 140 m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get()); … … 203 199 m_agents.append(std::make_unique<InspectorCPUProfilerAgent>(pageContext)); 204 200 m_agents.append(std::make_unique<InspectorMemoryAgent>(pageContext)); 201 m_agents.append(std::make_unique<PageHeapAgent>(pageContext)); 205 202 #endif 206 203 m_agents.append(std::make_unique<PageAuditAgent>(pageContext)); -
trunk/Source/WebCore/inspector/WorkerInspectorController.cpp
r242940 r243150 70 70 auto workerContext = workerAgentContext(); 71 71 72 auto heapAgent = std::make_unique<WebHeapAgent>(workerContext); 73 auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext, heapAgent.get()); 74 72 auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext); 75 73 m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get()); 76 74 … … 78 76 m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext)); 79 77 m_agents.append(WTFMove(consoleAgent)); 80 m_agents.append(WTFMove(heapAgent));81 78 82 79 if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost()) … … 179 176 #endif 180 177 178 m_agents.append(std::make_unique<WebHeapAgent>(workerContext)); 181 179 m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext)); 182 180 } -
trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp
r243141 r243150 44 44 using namespace Inspector; 45 45 46 WebConsoleAgent::WebConsoleAgent(AgentContext& context , InspectorHeapAgent* heapAgent)47 : InspectorConsoleAgent(context , heapAgent)46 WebConsoleAgent::WebConsoleAgent(AgentContext& context) 47 : InspectorConsoleAgent(context) 48 48 { 49 49 } -
trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h
r228218 r243150 39 39 WTF_MAKE_FAST_ALLOCATED; 40 40 public: 41 WebConsoleAgent(Inspector::AgentContext& , Inspector::InspectorHeapAgent*);41 WebConsoleAgent(Inspector::AgentContext&); 42 42 virtual ~WebConsoleAgent() = default; 43 43 -
trunk/Source/WebCore/inspector/agents/WebHeapAgent.cpp
r229174 r243150 93 93 } 94 94 95 WebHeapAgent::WebHeapAgent( Inspector::AgentContext& context)95 WebHeapAgent::WebHeapAgent(WebAgentContext& context) 96 96 : InspectorHeapAgent(context) 97 , m_instrumentingAgents(context.instrumentingAgents) 97 98 , m_sendGarbageCollectionEventsTask(std::make_unique<SendGarbageCollectionEventsTask>(*this)) 98 99 { … … 104 105 } 105 106 107 void WebHeapAgent::enable(ErrorString& errorString) 108 { 109 InspectorHeapAgent::enable(errorString); 110 111 if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent()) 112 consoleAgent->setInspectorHeapAgent(this); 113 } 114 106 115 void WebHeapAgent::disable(ErrorString& errorString) 107 116 { 108 117 m_sendGarbageCollectionEventsTask->reset(); 118 119 if (auto* consoleAgent = m_instrumentingAgents.webConsoleAgent()) 120 consoleAgent->setInspectorHeapAgent(nullptr); 109 121 110 122 InspectorHeapAgent::disable(errorString); -
trunk/Source/WebCore/inspector/agents/WebHeapAgent.h
r229174 r243150 26 26 #pragma once 27 27 28 #include "InspectorWebAgentBase.h" 28 29 #include <JavaScriptCore/InspectorHeapAgent.h> 29 30 #include <wtf/Forward.h> … … 40 41 friend class SendGarbageCollectionEventsTask; 41 42 public: 42 WebHeapAgent( Inspector::AgentContext&);43 WebHeapAgent(WebAgentContext&); 43 44 virtual ~WebHeapAgent(); 44 45 45 46 protected: 47 void enable(ErrorString&) override; 46 48 void disable(ErrorString&) override; 47 49 … … 50 52 void dispatchGarbageCollectionEventsAfterDelay(Vector<GarbageCollectionData>&& collections); 51 53 54 InstrumentingAgents& m_instrumentingAgents; 55 52 56 std::unique_ptr<SendGarbageCollectionEventsTask> m_sendGarbageCollectionEventsTask; 53 57 }; -
trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp
r225263 r243150 43 43 using namespace Inspector; 44 44 45 PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, Inspector HeapAgent* heapAgent, InspectorDOMAgent* domAgent)46 : WebConsoleAgent(context , heapAgent)45 PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, InspectorDOMAgent* domAgent) 46 : WebConsoleAgent(context) 47 47 , m_inspectorDOMAgent(domAgent) 48 48 { -
trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h
r224345 r243150 43 43 WTF_MAKE_FAST_ALLOCATED; 44 44 public: 45 PageConsoleAgent(WebAgentContext&, Inspector ::InspectorHeapAgent*, InspectorDOMAgent*);45 PageConsoleAgent(WebAgentContext&, InspectorDOMAgent*); 46 46 virtual ~PageConsoleAgent() = default; 47 47 -
trunk/Source/WebCore/inspector/agents/page/PageHeapAgent.cpp
r225263 r243150 46 46 void PageHeapAgent::disable(ErrorString& errorString) 47 47 { 48 m_instrumentingAgents.setPageHeapAgent(nullptr); 48 49 WebHeapAgent::disable(errorString); 49 m_instrumentingAgents.setPageHeapAgent(nullptr);50 50 } 51 51 -
trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.cpp
r224788 r243150 33 33 using namespace Inspector; 34 34 35 WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context , InspectorHeapAgent* heapAgent)36 : WebConsoleAgent(context , heapAgent)35 WorkerConsoleAgent::WorkerConsoleAgent(WorkerAgentContext& context) 36 : WebConsoleAgent(context) 37 37 { 38 38 ASSERT(context.workerGlobalScope.isContextThread()); -
trunk/Source/WebCore/inspector/agents/worker/WorkerConsoleAgent.h
r224345 r243150 35 35 WTF_MAKE_FAST_ALLOCATED; 36 36 public: 37 WorkerConsoleAgent(WorkerAgentContext& , Inspector::InspectorHeapAgent*);37 WorkerConsoleAgent(WorkerAgentContext&); 38 38 ~WorkerConsoleAgent() = default; 39 39 };
Note: See TracChangeset
for help on using the changeset viewer.