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

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: Update unittests 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 ac001d67b038935366a3c684038eb211ed2e1b4c..48a139002d2d7398cfc139ce28f34b55a66902e4 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -53,7 +53,9 @@
#include "core/html/HTMLFrameElementBase.h"
#include "core/html/HTMLPlugInElement.h"
#include "core/input/EventHandler.h"
+#include "core/inspector/InspectedFrames.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 +73,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 +332,8 @@ LocalFrame::~LocalFrame() {
DEFINE_TRACE(LocalFrame) {
visitor->trace(m_instrumentingAgents);
+ visitor->trace(m_inspectorWebPerfAgent);
+ visitor->trace(m_webPerformanceObservers);
visitor->trace(m_loader);
visitor->trace(m_navigationScheduler);
visitor->trace(m_view);
@@ -551,6 +556,25 @@ bool LocalFrame::isCrossOriginSubframe() const {
top->securityContext()->getSecurityOrigin());
}
+void LocalFrame::enableInspectorWebPerfAgent(Performance* performance) {
+ m_webPerformanceObservers.add(performance);
+ if (!m_inspectorWebPerfAgent) {
+ m_inspectorWebPerfAgent =
+ new InspectorWebPerfAgent(InspectedFrames::create(this));
+ m_inspectorWebPerfAgent->enable();
+ }
+}
+
+void LocalFrame::disableInspectorWebPerfAgent(Performance* performance) {
+ auto perfEntry = m_webPerformanceObservers.find(performance);
+ DCHECK(perfEntry != m_webPerformanceObservers.end());
+ m_webPerformanceObservers.remove(perfEntry);
+ if (m_webPerformanceObservers.size() == 0) {
+ 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