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() |