Changeset 243243 in webkit
- Timestamp:
- Mar 20, 2019, 2:53:06 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp (modified) (3 diffs)
-
JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp (modified) (1 diff)
-
JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h (modified) (2 diffs)
-
JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp (modified) (1 diff)
-
JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/inspector/InspectorController.cpp (modified) (2 diffs)
-
WebCore/inspector/WorkerInspectorController.cpp (modified) (2 diffs)
-
WebCore/inspector/agents/page/PageRuntimeAgent.cpp (modified) (4 diffs)
-
WebCore/inspector/agents/page/PageRuntimeAgent.h (modified) (3 diffs)
-
WebCore/inspector/agents/worker/WorkerRuntimeAgent.cpp (modified) (1 diff)
-
WebCore/inspector/agents/worker/WorkerRuntimeAgent.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243237 r243243 1 2019-03-20 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Runtime: lazily create the agent 4 https://bugs.webkit.org/show_bug.cgi?id=195972 5 <rdar://problem/49039655> 6 7 Reviewed by Timothy Hatcher. 8 9 * inspector/JSGlobalObjectInspectorController.cpp: 10 (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): 11 (Inspector::JSGlobalObjectInspectorController::createLazyAgents): 12 13 * inspector/agents/InspectorRuntimeAgent.h: 14 (Inspector::InspectorRuntimeAgent::enabled): Deleted. 15 * inspector/agents/InspectorRuntimeAgent.cpp: 16 (Inspector::InspectorRuntimeAgent::didCreateFrontendAndBackend): Added. 17 (Inspector::InspectorRuntimeAgent::willDestroyFrontendAndBackend): 18 19 * inspector/agents/JSGlobalObjectRuntimeAgent.h: 20 * inspector/agents/JSGlobalObjectRuntimeAgent.cpp: 21 (Inspector::JSGlobalObjectRuntimeAgent::didCreateFrontendAndBackend): Deleted. 22 1 23 2019-03-20 Michael Saboff <msaboff@apple.com> 2 24 -
trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
r243192 r243243 73 73 74 74 auto inspectorAgent = std::make_unique<InspectorAgent>(context); 75 auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);76 75 auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context); 77 76 … … 81 80 82 81 m_agents.append(WTFMove(inspectorAgent)); 83 m_agents.append(WTFMove(runtimeAgent));84 82 m_agents.append(WTFMove(consoleAgent)); 85 83 … … 310 308 auto context = jsAgentContext(); 311 309 310 m_agents.append(std::make_unique<JSGlobalObjectRuntimeAgent>(context)); 311 312 312 auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, m_consoleAgent); 313 313 m_debuggerAgent = debuggerAgent.get(); -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
r241633 r243243 333 333 } 334 334 335 void InspectorRuntimeAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) 336 { 337 } 338 335 339 void InspectorRuntimeAgent::willDestroyFrontendAndBackend(DisconnectReason reason) 336 340 { 337 341 if (reason != DisconnectReason::InspectedTargetDestroyed && m_isTypeProfilingEnabled) 338 342 setTypeProfilerEnabledState(false); 343 344 String unused; 345 disable(unused); 339 346 } 340 347 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
r241633 r243243 54 54 virtual ~InspectorRuntimeAgent(); 55 55 56 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override; 56 57 void willDestroyFrontendAndBackend(DisconnectReason) override; 57 58 … … 75 76 void disableControlFlowProfiler(ErrorString&) override; 76 77 void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& out_basicBlocks) override; 77 78 bool enabled() const { return m_enabled; }79 78 80 79 protected: -
trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp
r233122 r243243 43 43 } 44 44 45 void JSGlobalObjectRuntimeAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)46 {47 }48 49 45 InjectedScript JSGlobalObjectRuntimeAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId) 50 46 { -
trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h
r225263 r243243 41 41 JSGlobalObjectRuntimeAgent(JSAgentContext&); 42 42 43 void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;44 45 43 InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override; 46 44 -
trunk/Source/WebCore/ChangeLog
r243239 r243243 1 2019-03-20 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Runtime: lazily create the agent 4 https://bugs.webkit.org/show_bug.cgi?id=195972 5 <rdar://problem/49039655> 6 7 Reviewed by Timothy Hatcher. 8 9 No change in functionality. 10 11 * inspector/InspectorController.cpp: 12 (WebCore::InspectorController::InspectorController): 13 (WebCore::InspectorController::createLazyAgents): 14 15 * inspector/WorkerInspectorController.cpp: 16 (WebCore::WorkerInspectorController::WorkerInspectorController): 17 (WebCore::WorkerInspectorController::createLazyAgents): 18 19 * inspector/agents/page/PageRuntimeAgent.h: 20 * inspector/agents/page/PageRuntimeAgent.cpp: 21 (WebCore::PageRuntimeAgent::PageRuntimeAgent): 22 (WebCore::PageRuntimeAgent::enable): 23 (WebCore::PageRuntimeAgent::disable): 24 (WebCore::PageRuntimeAgent::didCreateMainWorldContext): 25 (WebCore::PageRuntimeAgent::reportExecutionContextCreation): 26 (WebCore::PageRuntimeAgent::didCreateFrontendAndBackend): Deleted. 27 (WebCore::PageRuntimeAgent::willDestroyFrontendAndBackend): Deleted. 28 29 * inspector/agents/worker/WorkerRuntimeAgent.h: 30 * inspector/agents/worker/WorkerRuntimeAgent.cpp: 31 (WebCore::WorkerRuntimeAgent::didCreateFrontendAndBackend): Deleted. 32 (WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend): Deleted. 33 1 34 2019-03-19 Ryosuke Niwa <rniwa@webkit.org> 2 35 -
trunk/Source/WebCore/inspector/InspectorController.cpp
r243219 r243243 116 116 m_agents.append(WTFMove(pageAgentPtr)); 117 117 118 auto runtimeAgent = std::make_unique<PageRuntimeAgent>(pageContext, pageAgent);119 m_instrumentingAgents->setPageRuntimeAgent(runtimeAgent.get());120 m_agents.append(WTFMove(runtimeAgent));121 122 118 auto domAgentPtr = std::make_unique<InspectorDOMAgent>(pageContext, pageAgent, m_overlay.get()); 123 119 m_domAgent = domAgentPtr.get(); … … 170 166 auto pageContext = pageAgentContext(); 171 167 168 m_agents.append(std::make_unique<PageRuntimeAgent>(pageContext)); 169 172 170 auto debuggerAgent = std::make_unique<PageDebuggerAgent>(pageContext, m_pageAgent); 173 171 auto debuggerAgentPtr = debuggerAgent.get(); 174 175 172 m_agents.append(WTFMove(debuggerAgent)); 173 176 174 m_agents.append(std::make_unique<PageNetworkAgent>(pageContext, m_pageAgent)); 177 175 m_agents.append(std::make_unique<InspectorCSSAgent>(pageContext, m_domAgent)); -
trunk/Source/WebCore/inspector/WorkerInspectorController.cpp
r243219 r243243 72 72 auto consoleAgent = std::make_unique<WorkerConsoleAgent>(workerContext); 73 73 m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get()); 74 75 m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext));76 74 m_agents.append(WTFMove(consoleAgent)); 77 75 … … 168 166 auto workerContext = workerAgentContext(); 169 167 168 m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext)); 169 170 170 #if ENABLE(SERVICE_WORKER) 171 171 if (is<ServiceWorkerGlobalScope>(m_workerGlobalScope)) { -
trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp
r241633 r243243 54 54 using namespace Inspector; 55 55 56 PageRuntimeAgent::PageRuntimeAgent(PageAgentContext& context , InspectorPageAgent* pageAgent)56 PageRuntimeAgent::PageRuntimeAgent(PageAgentContext& context) 57 57 : InspectorRuntimeAgent(context) 58 58 , m_frontendDispatcher(std::make_unique<Inspector::RuntimeFrontendDispatcher>(context.frontendRouter)) 59 59 , m_backendDispatcher(Inspector::RuntimeBackendDispatcher::create(context.backendDispatcher, this)) 60 , m_ pageAgent(pageAgent)60 , m_instrumentingAgents(context.instrumentingAgents) 61 61 , m_inspectedPage(context.inspectedPage) 62 62 { 63 63 } 64 64 65 void PageRuntimeAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)66 {67 }68 69 void PageRuntimeAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason reason)70 {71 String unused;72 disable(unused);73 74 InspectorRuntimeAgent::willDestroyFrontendAndBackend(reason);75 }76 77 65 void PageRuntimeAgent::enable(ErrorString& errorString) 78 66 { 79 if (enabled()) 80 return; 67 bool enabled = m_instrumentingAgents.pageRuntimeAgent() == this; 81 68 82 69 InspectorRuntimeAgent::enable(errorString); 83 70 84 // Only report existing contexts if the page did commit load, otherwise we may 85 // unintentionally initialize contexts in the frames which may trigger some listeners 86 // that are expected to be triggered only after the load is committed, see http://crbug.com/131623 87 if (m_mainWorldContextCreated) 71 m_instrumentingAgents.setPageRuntimeAgent(this); 72 73 if (!enabled) 88 74 reportExecutionContextCreation(); 89 75 } … … 91 77 void PageRuntimeAgent::disable(ErrorString& errorString) 92 78 { 93 if (!enabled()) 94 return; 79 m_instrumentingAgents.setPageRuntimeAgent(nullptr); 95 80 96 81 InspectorRuntimeAgent::disable(errorString); … … 99 84 void PageRuntimeAgent::didCreateMainWorldContext(Frame& frame) 100 85 { 101 m_mainWorldContextCreated = true; 102 103 if (!enabled()) 86 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 87 if (!pageAgent) 104 88 return; 105 89 106 String frameId = m_pageAgent->frameId(&frame);107 JSC::ExecState* scriptState = mainWorldExecState(&frame);90 auto frameId = pageAgent->frameId(&frame); 91 auto* scriptState = mainWorldExecState(&frame); 108 92 notifyContextCreated(frameId, scriptState, nullptr, true); 109 93 } … … 137 121 void PageRuntimeAgent::reportExecutionContextCreation() 138 122 { 123 auto* pageAgent = m_instrumentingAgents.inspectorPageAgent(); 124 if (!pageAgent) 125 return; 126 139 127 Vector<std::pair<JSC::ExecState*, SecurityOrigin*>> isolatedContexts; 140 128 for (Frame* frame = &m_inspectedPage.mainFrame(); frame; frame = frame->tree().traverseNext()) { 141 129 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 142 130 continue; 143 String frameId = m_pageAgent->frameId(frame);131 String frameId = pageAgent->frameId(frame); 144 132 145 133 JSC::ExecState* scriptState = mainWorldExecState(frame); -
trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.h
r241633 r243243 42 42 namespace WebCore { 43 43 44 class InspectorPageAgent;45 44 class Frame; 46 45 class Page; … … 52 51 WTF_MAKE_FAST_ALLOCATED; 53 52 public: 54 PageRuntimeAgent(PageAgentContext& , InspectorPageAgent*);53 PageRuntimeAgent(PageAgentContext&); 55 54 virtual ~PageRuntimeAgent() = default; 56 55 57 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override; 58 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override; 56 // RuntimeBackendDispatcherHandler 59 57 void enable(ErrorString&) override; 60 58 void disable(ErrorString&) override; … … 73 71 std::unique_ptr<Inspector::RuntimeFrontendDispatcher> m_frontendDispatcher; 74 72 RefPtr<Inspector::RuntimeBackendDispatcher> m_backendDispatcher; 75 InspectorPageAgent* m_pageAgent; 73 74 InstrumentingAgents& m_instrumentingAgents; 76 75 77 76 Page& m_inspectedPage; 78 79 bool m_mainWorldContextCreated { false };80 77 }; 81 78 -
trunk/Source/WebCore/inspector/agents/worker/WorkerRuntimeAgent.cpp
r237766 r243243 50 50 } 51 51 52 void WorkerRuntimeAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)53 {54 }55 56 void WorkerRuntimeAgent::willDestroyFrontendAndBackend(DisconnectReason reason)57 {58 InspectorRuntimeAgent::willDestroyFrontendAndBackend(reason);59 }60 61 52 InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId) 62 53 { -
trunk/Source/WebCore/inspector/agents/worker/WorkerRuntimeAgent.h
r228218 r243243 47 47 ~WorkerRuntimeAgent() = default; 48 48 49 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;50 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;51 52 49 private: 53 50 Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
Note:
See TracChangeset
for help on using the changeset viewer.