Changeset 243119 in webkit
- Timestamp:
- Mar 18, 2019 5:31:24 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243118 r243119 1 2019-03-18 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Timeline: lazily create the agent 4 https://bugs.webkit.org/show_bug.cgi?id=195865 5 <rdar://problem/48965403> 6 7 Reviewed by Joseph Pecoraro. 8 9 No change in functionality. 10 11 * inspector/agents/InspectorTimelineAgent.h: 12 * inspector/agents/InspectorTimelineAgent.cpp: 13 (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): 14 (WebCore::InspectorTimelineAgent::toggleScriptProfilerInstrument): 15 (WebCore::InspectorTimelineAgent::toggleHeapInstrument): 16 (WebCore::InspectorTimelineAgent::setFrameIdentifier): 17 18 * inspector/InspectorInstrumentation.h: 19 (WebCore::InspectorInstrumentation::startProfiling): 20 (WebCore::InspectorInstrumentation::stopProfiling): 21 (WebCore::InspectorInstrumentation::didRequestAnimationFrame): 22 (WebCore::InspectorInstrumentation::didCancelAnimationFrame): 23 24 * inspector/InstrumentingAgents.h: 25 (WebCore::InstrumentingAgents::inspectorScriptProfilerAgent const): Added. 26 (WebCore::InstrumentingAgents::setInspectorScriptProfilerAgent): Added. 27 * inspector/InstrumentingAgents.cpp: 28 (WebCore::InstrumentingAgents::reset): 29 30 * inspector/InspectorController.cpp: 31 (WebCore::InspectorController::InspectorController): 32 (WebCore::InspectorController::createLazyAgents): 33 1 34 2019-03-18 Darin Adler <darin@apple.com> 2 35 -
trunk/Source/WebCore/inspector/InspectorController.cpp
r242940 r243119 137 137 138 138 auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext); 139 InspectorScriptProfilerAgent* scriptProfilerAgent = scriptProfilerAgentPtr.get();139 m_instrumentingAgents->setInspectorScriptProfilerAgent(scriptProfilerAgentPtr.get()); 140 140 m_agents.append(WTFMove(scriptProfilerAgentPtr)); 141 141 … … 144 144 m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get()); 145 145 m_agents.append(WTFMove(consoleAgentPtr)); 146 147 m_agents.append(std::make_unique<InspectorTimelineAgent>(pageContext, scriptProfilerAgent, heapAgent, pageAgent));148 146 149 147 ASSERT(m_injectedScriptManager->commandLineAPIHost()); … … 208 206 m_agents.append(std::make_unique<PageAuditAgent>(pageContext)); 209 207 m_agents.append(std::make_unique<InspectorCanvasAgent>(pageContext)); 208 m_agents.append(std::make_unique<InspectorTimelineAgent>(pageContext)); 210 209 } 211 210 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r242992 r243119 1409 1409 inline void InspectorInstrumentation::startProfiling(Page& page, JSC::ExecState* exec, const String &title) 1410 1410 { 1411 FAST_RETURN_IF_NO_FRONTENDS(void()); 1411 1412 startProfilingImpl(instrumentingAgentsForPage(page), exec, title); 1412 1413 } … … 1414 1415 inline void InspectorInstrumentation::stopProfiling(Page& page, JSC::ExecState* exec, const String &title) 1415 1416 { 1417 FAST_RETURN_IF_NO_FRONTENDS(void()); 1416 1418 stopProfilingImpl(instrumentingAgentsForPage(page), exec, title); 1417 1419 } … … 1426 1428 inline void InspectorInstrumentation::didRequestAnimationFrame(Document& document, int callbackId) 1427 1429 { 1430 FAST_RETURN_IF_NO_FRONTENDS(void()); 1428 1431 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 1429 1432 didRequestAnimationFrameImpl(*instrumentingAgents, callbackId, document); … … 1432 1435 inline void InspectorInstrumentation::didCancelAnimationFrame(Document& document, int callbackId) 1433 1436 { 1437 FAST_RETURN_IF_NO_FRONTENDS(void()); 1434 1438 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 1435 1439 didCancelAnimationFrameImpl(*instrumentingAgents, callbackId, document); -
trunk/Source/WebCore/inspector/InstrumentingAgents.cpp
r240457 r243119 54 54 m_inspectorNetworkAgent = nullptr; 55 55 m_pageRuntimeAgent = nullptr; 56 m_inspectorScriptProfilerAgent = nullptr; 56 57 m_inspectorTimelineAgent = nullptr; 57 58 m_persistentInspectorTimelineAgent = nullptr; -
trunk/Source/WebCore/inspector/InstrumentingAgents.h
r240457 r243119 40 40 class InspectorAgent; 41 41 class InspectorDebuggerAgent; 42 class InspectorScriptProfilerAgent; 42 43 } 43 44 … … 103 104 void setPageRuntimeAgent(PageRuntimeAgent* agent) { m_pageRuntimeAgent = agent; } 104 105 106 Inspector::InspectorScriptProfilerAgent* inspectorScriptProfilerAgent() const { return m_inspectorScriptProfilerAgent; } 107 void setInspectorScriptProfilerAgent(Inspector::InspectorScriptProfilerAgent* agent) { m_inspectorScriptProfilerAgent = agent; } 108 105 109 InspectorTimelineAgent* inspectorTimelineAgent() const { return m_inspectorTimelineAgent; } 106 110 void setInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_inspectorTimelineAgent = agent; } … … 158 162 InspectorNetworkAgent* m_inspectorNetworkAgent { nullptr }; 159 163 PageRuntimeAgent* m_pageRuntimeAgent { nullptr }; 164 Inspector::InspectorScriptProfilerAgent* m_inspectorScriptProfilerAgent { nullptr }; 160 165 InspectorTimelineAgent* m_inspectorTimelineAgent { nullptr }; 161 166 InspectorTimelineAgent* m_persistentInspectorTimelineAgent { nullptr }; -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
r240457 r243119 42 42 #include "InstrumentingAgents.h" 43 43 #include "JSDOMWindow.h" 44 #include "PageHeapAgent.h" 44 45 #include "PageScriptDebugServer.h" 45 46 #include "RenderView.h" … … 49 50 #include <JavaScriptCore/ConsoleMessage.h> 50 51 #include <JavaScriptCore/InspectorDebuggerAgent.h> 51 #include <JavaScriptCore/InspectorHeapAgent.h>52 52 #include <JavaScriptCore/InspectorScriptProfilerAgent.h> 53 53 #include <JavaScriptCore/ScriptBreakpoint.h> … … 84 84 #endif 85 85 86 InspectorTimelineAgent::InspectorTimelineAgent(WebAgentContext& context , InspectorScriptProfilerAgent* scriptProfileAgent, InspectorHeapAgent* heapAgent, InspectorPageAgent* pageAgent)86 InspectorTimelineAgent::InspectorTimelineAgent(WebAgentContext& context) 87 87 : InspectorAgentBase("Timeline"_s, context) 88 88 , m_frontendDispatcher(std::make_unique<Inspector::TimelineFrontendDispatcher>(context.frontendRouter)) 89 89 , m_backendDispatcher(Inspector::TimelineBackendDispatcher::create(context.backendDispatcher, this)) 90 , m_scriptProfilerAgent(scriptProfileAgent)91 , m_heapAgent(heapAgent)92 , m_pageAgent(pageAgent)93 90 { 94 91 } … … 533 530 void InspectorTimelineAgent::toggleScriptProfilerInstrument(InstrumentState state) 534 531 { 535 if ( m_scriptProfilerAgent) {532 if (auto* scriptProfilerAgent = m_instrumentingAgents.inspectorScriptProfilerAgent()) { 536 533 ErrorString unused; 537 534 if (state == InstrumentState::Start) { 538 535 const bool includeSamples = true; 539 m_scriptProfilerAgent->startTracking(unused, &includeSamples);536 scriptProfilerAgent->startTracking(unused, &includeSamples); 540 537 } else 541 m_scriptProfilerAgent->stopTracking(unused);538 scriptProfilerAgent->stopTracking(unused); 542 539 } 543 540 } … … 545 542 void InspectorTimelineAgent::toggleHeapInstrument(InstrumentState state) 546 543 { 547 if ( m_heapAgent) {544 if (auto* heapAgent = m_instrumentingAgents.pageHeapAgent()) { 548 545 ErrorString unused; 549 546 if (state == InstrumentState::Start) { 550 547 if (m_autoCapturePhase == AutoCapturePhase::None || m_autoCapturePhase == AutoCapturePhase::FirstNavigation) 551 m_heapAgent->startTracking(unused);548 heapAgent->startTracking(unused); 552 549 } else 553 m_heapAgent->stopTracking(unused);550 heapAgent->stopTracking(unused); 554 551 } 555 552 } … … 713 710 void InspectorTimelineAgent::setFrameIdentifier(JSON::Object* record, Frame* frame) 714 711 { 715 if (!frame || !m_pageAgent)712 if (!frame) 716 713 return; 717 String frameId; 718 if (frame && m_pageAgent) 719 frameId = m_pageAgent->frameId(frame); 720 record->setString("frameId", frameId); 714 715 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 716 if (!pageAgent) 717 return; 718 719 record->setString("frameId"_s, pageAgent->frameId(frame)); 721 720 } 722 721 -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h
r240457 r243119 41 41 #include <wtf/Vector.h> 42 42 43 namespace Inspector {44 class InspectorHeapAgent;45 class InspectorScriptProfilerAgent;46 }47 48 43 namespace WebCore { 49 44 … … 51 46 class FloatQuad; 52 47 class Frame; 53 class InspectorPageAgent;54 48 class RenderObject; 55 49 class RunLoopObserver; … … 95 89 WTF_MAKE_FAST_ALLOCATED; 96 90 public: 97 InspectorTimelineAgent(WebAgentContext& , Inspector::InspectorScriptProfilerAgent*, Inspector::InspectorHeapAgent*, InspectorPageAgent*);91 InspectorTimelineAgent(WebAgentContext&); 98 92 virtual ~InspectorTimelineAgent(); 99 93 … … 213 207 std::unique_ptr<Inspector::TimelineFrontendDispatcher> m_frontendDispatcher; 214 208 RefPtr<Inspector::TimelineBackendDispatcher> m_backendDispatcher; 215 Inspector::InspectorScriptProfilerAgent* m_scriptProfilerAgent;216 Inspector::InspectorHeapAgent* m_heapAgent;217 InspectorPageAgent* m_pageAgent;218 209 219 210 Vector<TimelineRecordEntry> m_recordStack;
Note: See TracChangeset
for help on using the changeset viewer.