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

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 2238883005: POC for InspectorInstrumentation adding InspectorWebPerfAgent Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add task observer to WebPerfAgent Created 4 years, 4 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/timing/PerformanceBase.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index 2ebfe14288d3c697beb95b292b619a925edd2f0c..fce966d9f07eb32e0b25b55ee0e87b4a143e260a 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -58,6 +58,7 @@ PerformanceBase::PerformanceBase(double timeOrigin)
, m_userTiming(nullptr)
, m_observerFilterOptions(PerformanceEntry::Invalid)
, m_deliverObservationsTimer(this, &PerformanceBase::deliverObservationsTimerFired)
+ , m_inspectorInstrumentationEnabled(false)
{
}
@@ -75,6 +76,10 @@ PerformanceTiming* PerformanceBase::timing() const
return nullptr;
}
+void PerformanceBase::enableInspectorInstrumentation() const
+{
+}
+
PerformanceEntryVector PerformanceBase::getEntries() const
{
PerformanceEntryVector entries;
@@ -356,6 +361,16 @@ void PerformanceBase::registerPerformanceObserver(PerformanceObserver& observer)
{
m_observerFilterOptions |= observer.filterOptions();
m_observers.add(&observer);
+
+ // If this is the first long task observer then enable tracking of LongTaskTiming.
+ if (!m_inspectorInstrumentationEnabled
+ && hasObserverFor(PerformanceEntry::Mark)) { // PerformanceEntry::LongTask
+ fprintf(stderr, "\n^^^On observe(): enableInspectorInstrumentation");
+ enableInspectorInstrumentation();
+ m_inspectorInstrumentationEnabled = true;
+ } else {
+ fprintf(stderr, "\n^^^On observe(): NOT enableInspectorInstrumentation");
+ }
}
void PerformanceBase::unregisterPerformanceObserver(PerformanceObserver& oldObserver)
@@ -368,6 +383,11 @@ void PerformanceBase::unregisterPerformanceObserver(PerformanceObserver& oldObse
}
m_observers.remove(&oldObserver);
updatePerformanceObserverFilterOptions();
+
+ if (m_inspectorInstrumentationEnabled
+ && !hasObserverFor(PerformanceEntry::Mark)) { // PerformanceEntry::LongTask
+ //disableInspectorInstrumentation();
+ }
}
void PerformanceBase::updatePerformanceObserverFilterOptions()

Powered by Google App Engine
This is Rietveld 408576698