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

Side by Side Diff: Source/core/inspector/InspectorLayerTreeAgent.cpp

Issue 1118963002: Revert of DevTools: remove dependency of most agents on InspectorPageAgent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 21 matching lines...) Expand all
32 #include "config.h" 32 #include "config.h"
33 33
34 #include "core/inspector/InspectorLayerTreeAgent.h" 34 #include "core/inspector/InspectorLayerTreeAgent.h"
35 35
36 #include "core/dom/DOMNodeIds.h" 36 #include "core/dom/DOMNodeIds.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/frame/FrameHost.h" 38 #include "core/frame/FrameHost.h"
39 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
40 #include "core/frame/Settings.h" 40 #include "core/frame/Settings.h"
41 #include "core/inspector/IdentifiersFactory.h" 41 #include "core/inspector/IdentifiersFactory.h"
42 #include "core/inspector/InspectorPageAgent.h"
42 #include "core/inspector/InspectorState.h" 43 #include "core/inspector/InspectorState.h"
43 #include "core/inspector/InstrumentingAgents.h" 44 #include "core/inspector/InstrumentingAgents.h"
44 #include "core/layout/LayoutPart.h" 45 #include "core/layout/LayoutPart.h"
45 #include "core/layout/LayoutView.h" 46 #include "core/layout/LayoutView.h"
46 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" 47 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
47 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 48 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
48 #include "core/loader/DocumentLoader.h" 49 #include "core/loader/DocumentLoader.h"
49 #include "platform/geometry/IntRect.h" 50 #include "platform/geometry/IntRect.h"
50 #include "platform/graphics/CompositingReasons.h" 51 #include "platform/graphics/CompositingReasons.h"
51 #include "platform/graphics/GraphicsLayer.h" 52 #include "platform/graphics/GraphicsLayer.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 else 139 else
139 layerObject->setAnchorY(0.0); 140 layerObject->setAnchorY(0.0);
140 layerObject->setAnchorZ(transformOrigin.z()); 141 layerObject->setAnchorZ(transformOrigin.z());
141 } 142 }
142 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer); 143 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer);
143 if (scrollRects) 144 if (scrollRects)
144 layerObject->setScrollRects(scrollRects.release()); 145 layerObject->setScrollRects(scrollRects.release());
145 return layerObject; 146 return layerObject;
146 } 147 }
147 148
148 InspectorLayerTreeAgent::InspectorLayerTreeAgent(LocalFrame* inspectedFrame) 149 InspectorLayerTreeAgent::InspectorLayerTreeAgent(InspectorPageAgent* pageAgent)
149 : InspectorBaseAgent<InspectorLayerTreeAgent, InspectorFrontend::LayerTree>( "LayerTree") 150 : InspectorBaseAgent<InspectorLayerTreeAgent, InspectorFrontend::LayerTree>( "LayerTree")
150 , m_inspectedFrame(inspectedFrame) 151 , m_pageAgent(pageAgent)
151 { 152 {
152 } 153 }
153 154
154 InspectorLayerTreeAgent::~InspectorLayerTreeAgent() 155 InspectorLayerTreeAgent::~InspectorLayerTreeAgent()
155 { 156 {
156 } 157 }
157 158
158 DEFINE_TRACE(InspectorLayerTreeAgent) 159 DEFINE_TRACE(InspectorLayerTreeAgent)
159 { 160 {
160 visitor->trace(m_inspectedFrame); 161 visitor->trace(m_pageAgent);
161 InspectorBaseAgent::trace(visitor); 162 InspectorBaseAgent::trace(visitor);
162 } 163 }
163 164
164 void InspectorLayerTreeAgent::restore() 165 void InspectorLayerTreeAgent::restore()
165 { 166 {
166 // We do not re-enable layer agent automatically after navigation. This is b ecause 167 // We do not re-enable layer agent automatically after navigation. This is b ecause
167 // it depends on DOMAgent and node ids in particular, so we let front-end re quest document 168 // it depends on DOMAgent and node ids in particular, so we let front-end re quest document
168 // and re-enable the agent manually after this. 169 // and re-enable the agent manually after this.
169 } 170 }
170 171
171 void InspectorLayerTreeAgent::enable(ErrorString*) 172 void InspectorLayerTreeAgent::enable(ErrorString*)
172 { 173 {
173 m_instrumentingAgents->setInspectorLayerTreeAgent(this); 174 m_instrumentingAgents->setInspectorLayerTreeAgent(this);
174 Document* document = m_inspectedFrame->document(); 175 if (LocalFrame* frame = m_pageAgent->inspectedFrame()) {
175 if (document && document->lifecycle().state() >= DocumentLifecycle::Composit ingClean) 176 Document* document = frame->document();
176 layerTreeDidChange(); 177 if (document && document->lifecycle().state() >= DocumentLifecycle::Comp ositingClean)
178 layerTreeDidChange();
179 }
177 } 180 }
178 181
179 void InspectorLayerTreeAgent::disable(ErrorString*) 182 void InspectorLayerTreeAgent::disable(ErrorString*)
180 { 183 {
181 m_instrumentingAgents->setInspectorLayerTreeAgent(0); 184 m_instrumentingAgents->setInspectorLayerTreeAgent(0);
182 m_snapshotById.clear(); 185 m_snapshotById.clear();
183 ErrorString unused; 186 ErrorString unused;
184 } 187 }
185 188
186 void InspectorLayerTreeAgent::layerTreeDidChange() 189 void InspectorLayerTreeAgent::layerTreeDidChange()
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); 249 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers);
247 } 250 }
248 251
249 int InspectorLayerTreeAgent::idForNode(Node* node) 252 int InspectorLayerTreeAgent::idForNode(Node* node)
250 { 253 {
251 return DOMNodeIds::idForNode(node); 254 return DOMNodeIds::idForNode(node);
252 } 255 }
253 256
254 DeprecatedPaintLayerCompositor* InspectorLayerTreeAgent::deprecatedPaintLayerCom positor() 257 DeprecatedPaintLayerCompositor* InspectorLayerTreeAgent::deprecatedPaintLayerCom positor()
255 { 258 {
256 LayoutView* layoutView = m_inspectedFrame->contentRenderer(); 259 LayoutView* layoutView = m_pageAgent->inspectedFrame()->contentRenderer();
257 DeprecatedPaintLayerCompositor* compositor = layoutView ? layoutView->compos itor() : nullptr; 260 DeprecatedPaintLayerCompositor* compositor = layoutView ? layoutView->compos itor() : nullptr;
258 return compositor; 261 return compositor;
259 } 262 }
260 263
261 GraphicsLayer* InspectorLayerTreeAgent::rootGraphicsLayer() 264 GraphicsLayer* InspectorLayerTreeAgent::rootGraphicsLayer()
262 { 265 {
263 return m_inspectedFrame->host()->pinchViewport().rootGraphicsLayer(); 266 return m_pageAgent->frameHost()->pinchViewport().rootGraphicsLayer();
264 } 267 }
265 268
266 static GraphicsLayer* findLayerById(GraphicsLayer* root, int layerId) 269 static GraphicsLayer* findLayerById(GraphicsLayer* root, int layerId)
267 { 270 {
268 if (root->platformLayer()->id() == layerId) 271 if (root->platformLayer()->id() == layerId)
269 return root; 272 return root;
270 if (root->replicaLayer()) { 273 if (root->replicaLayer()) {
271 if (GraphicsLayer* layer = findLayerById(root->replicaLayer(), layerId)) 274 if (GraphicsLayer* layer = findLayerById(root->replicaLayer(), layerId))
272 return layer; 275 return layer;
273 } 276 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) 464 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer)
462 { 465 {
463 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); 466 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id());
464 if (index == WTF::kNotFound) 467 if (index == WTF::kNotFound)
465 return; 468 return;
466 m_pageOverlayLayerIds.remove(index); 469 m_pageOverlayLayerIds.remove(index);
467 } 470 }
468 471
469 472
470 } // namespace blink 473 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorLayerTreeAgent.h ('k') | Source/core/inspector/InspectorPageAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698