Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp

Issue 1746393003: [DevTools] Postpone more agents instantiation until attached. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp b/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
index 47854d4a0d065dfd785f0ed120fd8f2e35ab1461..cd49b0209f25a38391c3a3de840b89d41f17f720 100644
--- a/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp
@@ -49,7 +49,6 @@ namespace blink {
PageRuntimeAgent::PageRuntimeAgent(Client* client, V8Debugger* debugger, InspectedFrames* inspectedFrames)
: InspectorRuntimeAgent(debugger, client)
, m_inspectedFrames(inspectedFrames)
- , m_mainWorldContextCreated(false)
{
}
@@ -66,23 +65,18 @@ DEFINE_TRACE(PageRuntimeAgent)
InspectorRuntimeAgent::trace(visitor);
}
-void PageRuntimeAgent::init()
-{
- InspectorRuntimeAgent::init();
- m_instrumentingAgents->setPageRuntimeAgent(this);
-}
-
void PageRuntimeAgent::enable(ErrorString* errorString)
{
if (m_enabled)
return;
InspectorRuntimeAgent::enable(errorString);
+ m_instrumentingAgents->setPageRuntimeAgent(this);
// Only report existing contexts if the page did commit load, otherwise we may
// unintentionally initialize contexts in the frames which may trigger some listeners
// that are expected to be triggered only after the load is committed, see http://crbug.com/131623
- if (m_mainWorldContextCreated)
+ if (m_client->didCommitLoadFired())
reportExecutionContextCreation();
}
@@ -90,17 +84,13 @@ void PageRuntimeAgent::disable(ErrorString* errorString)
{
if (!m_enabled)
return;
+ m_instrumentingAgents->setPageRuntimeAgent(nullptr);
InspectorRuntimeAgent::disable(errorString);
}
void PageRuntimeAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
{
- m_mainWorldContextCreated = true;
-
- if (!m_enabled)
- return;
ASSERT(frontend());
-
if (frame == m_inspectedFrames->root())
m_v8RuntimeAgent->clearInspectedObjects();
frame->script().initializeMainWorld();
@@ -108,8 +98,6 @@ void PageRuntimeAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
void PageRuntimeAgent::didCreateScriptContext(LocalFrame* frame, ScriptState* scriptState, SecurityOrigin* origin, int worldId)
{
- if (!m_enabled)
- return;
ASSERT(frontend());
bool isMainWorld = worldId == MainWorldId;
String originString = origin ? origin->toRawString() : "";

Powered by Google App Engine
This is Rietveld 408576698