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

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

Issue 2343553005: enable / disable Long Task instrumentation based on presence of LongTask observer (Closed)
Patch Set: address review comments Created 4 years, 3 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/InspectorWebPerfAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp
index 3e085f1dad921f58b49bdf0dda7b619061c1993c..b7ae43cbda1edd731a87069bf0d2fa42defc2e2e 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp
@@ -4,6 +4,7 @@
#include "core/inspector/InspectorWebPerfAgent.h"
+#include "core/InstrumentingAgents.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
#include "core/frame/LocalFrame.h"
@@ -16,14 +17,27 @@ namespace blink {
InspectorWebPerfAgent::InspectorWebPerfAgent(InspectedFrames* inspectedFrames)
: m_inspectedFrames(inspectedFrames)
{
+}
+
+InspectorWebPerfAgent::~InspectorWebPerfAgent()
+{
+ DCHECK(!m_enabled);
+}
+
+void InspectorWebPerfAgent::enable()
+{
Platform::current()->currentThread()->addTaskTimeObserver(this);
Platform::current()->currentThread()->addTaskObserver(this);
+ m_inspectedFrames->root()->instrumentingAgents()->addInspectorWebPerfAgent(this);
+ m_enabled = true;
}
-InspectorWebPerfAgent::~InspectorWebPerfAgent()
+void InspectorWebPerfAgent::disable()
{
Platform::current()->currentThread()->removeTaskTimeObserver(this);
Platform::current()->currentThread()->removeTaskObserver(this);
+ m_inspectedFrames->root()->instrumentingAgents()->removeInspectorWebPerfAgent(this);
+ m_enabled = false;
}
void InspectorWebPerfAgent::willExecuteScript(ExecutionContext* context)
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.h ('k') | third_party/WebKit/Source/core/timing/Performance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698