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

Unified Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 354023002: DevTools: disable DOMAgent when profiler is active (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: unnecessary change was removed Created 6 years, 6 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
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.h ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 8541804f0f6467bcea4ba1efcdfc9ebb8935fb92..42db5e9a383349cb05d58fcc6c1c0bee34d2d1c1 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -276,9 +276,10 @@ void InspectorDOMAgent::clearFrontend()
void InspectorDOMAgent::restore()
{
- // Reset document to avoid early return from setDocument.
- m_document = nullptr;
- setDocument(m_pageAgent->mainFrame()->document());
+ if (!enabled())
+ return;
+ innerEnable();
+ notifyDocumentUpdated();
}
Vector<Document*> InspectorDOMAgent::documents()
@@ -486,15 +487,27 @@ Element* InspectorDOMAgent::assertEditableElement(ErrorString* errorString, int
return element;
}
-void InspectorDOMAgent::enable(ErrorString*)
+void InspectorDOMAgent::innerEnable()
{
- if (enabled())
- return;
m_state->setBoolean(DOMAgentState::domAgentEnabled, true);
if (m_listener)
m_listener->domAgentWasEnabled();
}
+void InspectorDOMAgent::enable(ErrorString*)
+{
+ if (enabled())
+ return;
+ innerEnable();
+ notifyDocumentUpdated();
+}
+
+void InspectorDOMAgent::notifyDocumentUpdated()
+{
+ m_document = nullptr;
+ setDocument(m_pageAgent->mainFrame()->document());
+}
+
bool InspectorDOMAgent::enabled() const
{
return m_state->getBoolean(DOMAgentState::domAgentEnabled);
@@ -513,7 +526,8 @@ void InspectorDOMAgent::disable(ErrorString*)
void InspectorDOMAgent::getDocument(ErrorString* errorString, RefPtr<TypeBuilder::DOM::Node>& root)
{
// Backward compatibility. Mark agent as enabled when it requests document.
- enable(errorString);
+ if (!enabled())
+ innerEnable();
if (!m_document) {
*errorString = "Document is not available";
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.h ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698