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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2449673002: Refactor InspectorWebPerfAgent: update lifecycle management to be per Local Frame root; replace hea… (Closed)
Patch Set: sync and rebase Created 4 years, 1 month 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/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index 3011eaa553a9e220ba546d56e460a14eafe3574e..5c1c6c7a397edea5e18b32bfb3c0bbbf70a28a4f 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -54,6 +54,7 @@
#include "core/html/HTMLPlugInElement.h"
#include "core/input/EventHandler.h"
#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/InspectorWebPerfAgent.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutView.h"
#include "core/layout/api/LayoutPartItem.h"
@@ -71,6 +72,7 @@
#include "core/paint/PaintLayer.h"
#include "core/paint/TransformRecorder.h"
#include "core/svg/SVGDocumentExtensions.h"
+#include "core/timing/Performance.h"
#include "platform/DragImage.h"
#include "platform/PluginScriptForbiddenScope.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -329,6 +331,7 @@ LocalFrame::~LocalFrame() {
DEFINE_TRACE(LocalFrame) {
visitor->trace(m_instrumentingAgents);
+ visitor->trace(m_inspectorWebPerfAgent);
visitor->trace(m_loader);
visitor->trace(m_navigationScheduler);
visitor->trace(m_view);
@@ -556,6 +559,23 @@ bool LocalFrame::isCrossOriginSubframe() const {
top->securityContext()->getSecurityOrigin());
}
+void LocalFrame::enableInspectorWebPerfAgent(Performance* performance) {
+ if (!m_inspectorWebPerfAgent) {
+ m_inspectorWebPerfAgent = new InspectorWebPerfAgent(this);
+ m_inspectorWebPerfAgent->enable();
+ }
+ m_inspectorWebPerfAgent->addWebPerformanceObserver(performance);
+}
+
+void LocalFrame::disableInspectorWebPerfAgent(Performance* performance) {
+ DCHECK(m_inspectorWebPerfAgent->isEnabled());
+ m_inspectorWebPerfAgent->removeWebPerformanceObserver(performance);
+ if (!m_inspectorWebPerfAgent->hasWebPerformanceObservers()) {
+ m_inspectorWebPerfAgent->disable();
+ m_inspectorWebPerfAgent = nullptr;
+ }
+}
+
void LocalFrame::setPrinting(bool printing,
const FloatSize& pageSize,
const FloatSize& originalPageSize,

Powered by Google App Engine
This is Rietveld 408576698