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

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: Created 4 years, 2 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/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..45a031a7a3dd587f25ef2b8e22e40f0d23be5c75 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"
@@ -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);
@@ -551,6 +554,18 @@ bool LocalFrame::isCrossOriginSubframe() const {
top->securityContext()->getSecurityOrigin());
}
+void LocalFrame::enableInspectorWebPerfAgent() {
+ m_inspectorWebPerfAgentObservers++;
+ if (!inspectorWebPerfAgent()->isEnabled())
caseq 2016/10/26 21:19:41 can we perhaps get rid of enable/disable methods a
panicker 2016/10/27 23:06:53 It could be created and destroyed multiple times d
+ inspectorWebPerfAgent()->enable();
+}
+
+void LocalFrame::disableInspectorWebPerfAgent() {
+ m_inspectorWebPerfAgentObservers--;
+ if (m_inspectorWebPerfAgentObservers == 0)
+ inspectorWebPerfAgent()->disable();
+}
+
void LocalFrame::setPrinting(bool printing,
const FloatSize& pageSize,
const FloatSize& originalPageSize,
@@ -864,12 +879,16 @@ inline LocalFrame::LocalFrame(FrameLoaderClient* client,
m_pageZoomFactor(parentPageZoomFactor(this)),
m_textZoomFactor(parentTextZoomFactor(this)),
m_inViewSourceMode(false),
+ m_inspectorWebPerfAgentObservers(false),
caseq 2016/10/26 21:19:41 that's a fancy way to initialize an int :-)
panicker 2016/10/28 00:09:24 :) not needed anymore
m_interfaceProvider(interfaceProvider),
m_interfaceRegistry(interfaceRegistry) {
- if (isLocalRoot())
+ if (isLocalRoot()) {
m_instrumentingAgents = new InstrumentingAgents();
- else
+ m_inspectorWebPerfAgent =
+ new InspectorWebPerfAgent(InspectedFrames::create(this));
+ } else {
m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
+ }
}
WebFrameScheduler* LocalFrame::frameScheduler() {

Powered by Google App Engine
This is Rietveld 408576698