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

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: decouple enable / disable observer from ctor / dtor, to prevent the issue of tasks getting reported… 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..bb0dc718a4cac5afa140b7dcfca9a1e55b896266 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp
@@ -16,11 +16,19 @@ namespace blink {
InspectorWebPerfAgent::InspectorWebPerfAgent(InspectedFrames* inspectedFrames)
: m_inspectedFrames(inspectedFrames)
{
+}
+
+InspectorWebPerfAgent::~InspectorWebPerfAgent()
+{
dgozman 2016/09/17 01:11:00 Let's either call disableObserver() from here or D
panicker 2016/09/17 03:04:00 How's this?
panicker 2016/09/18 17:49:59 hmm it's not okay to access potentially finalized
dgozman 2016/09/19 17:55:59 Both. I propose to have |enabled_| field, update i
panicker 2016/09/20 12:00:39 Done.
+}
+
+void InspectorWebPerfAgent::enableObserver()
+{
Platform::current()->currentThread()->addTaskTimeObserver(this);
Platform::current()->currentThread()->addTaskObserver(this);
}
-InspectorWebPerfAgent::~InspectorWebPerfAgent()
+void InspectorWebPerfAgent::disableObserver()
{
Platform::current()->currentThread()->removeTaskTimeObserver(this);
Platform::current()->currentThread()->removeTaskObserver(this);

Powered by Google App Engine
This is Rietveld 408576698