Chromium Code Reviews| Index: third_party/WebKit/Source/core/timing/Performance.cpp |
| diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp |
| index 8b236f6a17d02988229c54ca22ea9e3099acbee9..88f16636a45bdd295037c7eb9036be1363fcc6a7 100644 |
| --- a/third_party/WebKit/Source/core/timing/Performance.cpp |
| +++ b/third_party/WebKit/Source/core/timing/Performance.cpp |
| @@ -31,8 +31,11 @@ |
| #include "core/timing/Performance.h" |
| +#include "core/InstrumentingAgents.h" |
| #include "core/dom/Document.h" |
| #include "core/frame/LocalFrame.h" |
| +#include "core/inspector/InspectedFrames.h" |
| +#include "core/inspector/InspectorWebPerfAgent.h" |
| #include "core/loader/DocumentLoader.h" |
| #include "core/timing/PerformanceTiming.h" |
| @@ -92,10 +95,32 @@ PerformanceTiming* Performance::timing() const |
| return m_timing.get(); |
| } |
| +void Performance::enableLongTaskInstrumentation() |
| +{ |
| + if (!hasObserverFor(PerformanceEntry::LongTask) || m_longTaskInspectorAgent) |
| + return; |
| + m_longTaskInspectorAgent = new InspectorWebPerfAgent( |
| + InspectedFrames::create(frame())); |
| + m_longTaskInspectorAgent->enableObserver(); |
| + frame()->instrumentingAgents()->addInspectorWebPerfAgent( |
|
dgozman
2016/09/17 01:11:00
I'd move this call into enableObserver.
panicker
2016/09/17 03:04:00
Done.
|
| + m_longTaskInspectorAgent); |
| +} |
| + |
| +void Performance::disableLongTaskInstrumentation() |
| +{ |
| + if (hasObserverFor(PerformanceEntry::LongTask) || !m_longTaskInspectorAgent) |
| + return; |
| + m_longTaskInspectorAgent->disableObserver(); |
| + frame()->instrumentingAgents()->removeInspectorWebPerfAgent( |
|
dgozman
2016/09/17 01:11:00
Similar here.
panicker
2016/09/17 03:04:00
Done.
|
| + m_longTaskInspectorAgent); |
| + m_longTaskInspectorAgent = nullptr; |
| +} |
| + |
| DEFINE_TRACE(Performance) |
| { |
| visitor->trace(m_navigation); |
| visitor->trace(m_timing); |
| + visitor->trace(m_longTaskInspectorAgent); |
| DOMWindowProperty::trace(visitor); |
| PerformanceBase::trace(visitor); |
| } |