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

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

Issue 892693006: Revert of DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/frame/FrameHost.h" 37 #include "core/frame/FrameHost.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/inspector/IdentifiersFactory.h" 40 #include "core/inspector/IdentifiersFactory.h"
41 #include "core/inspector/InspectorNodeIds.h" 41 #include "core/inspector/InspectorNodeIds.h"
42 #include "core/inspector/InspectorPageAgent.h"
43 #include "core/inspector/InspectorState.h" 42 #include "core/inspector/InspectorState.h"
44 #include "core/inspector/InstrumentingAgents.h" 43 #include "core/inspector/InstrumentingAgents.h"
45 #include "core/layout/compositing/CompositedLayerMapping.h" 44 #include "core/layout/compositing/CompositedLayerMapping.h"
46 #include "core/layout/compositing/RenderLayerCompositor.h" 45 #include "core/layout/compositing/RenderLayerCompositor.h"
47 #include "core/loader/DocumentLoader.h" 46 #include "core/loader/DocumentLoader.h"
47 #include "core/page/Page.h"
48 #include "core/rendering/RenderPart.h" 48 #include "core/rendering/RenderPart.h"
49 #include "core/rendering/RenderView.h" 49 #include "core/rendering/RenderView.h"
50 #include "platform/geometry/IntRect.h" 50 #include "platform/geometry/IntRect.h"
51 #include "platform/graphics/CompositingReasons.h" 51 #include "platform/graphics/CompositingReasons.h"
52 #include "platform/graphics/PictureSnapshot.h" 52 #include "platform/graphics/PictureSnapshot.h"
53 #include "platform/graphics/paint/DisplayItemList.h" 53 #include "platform/graphics/paint/DisplayItemList.h"
54 #include "platform/image-encoders/skia/PNGImageEncoder.h" 54 #include "platform/image-encoders/skia/PNGImageEncoder.h"
55 #include "platform/transforms/TransformationMatrix.h" 55 #include "platform/transforms/TransformationMatrix.h"
56 #include "public/platform/WebFloatPoint.h" 56 #include "public/platform/WebFloatPoint.h"
57 #include "public/platform/WebLayer.h" 57 #include "public/platform/WebLayer.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 else 137 else
138 layerObject->setAnchorY(0.0); 138 layerObject->setAnchorY(0.0);
139 layerObject->setAnchorZ(transformOrigin.z()); 139 layerObject->setAnchorZ(transformOrigin.z());
140 } 140 }
141 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer); 141 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer);
142 if (scrollRects) 142 if (scrollRects)
143 layerObject->setScrollRects(scrollRects.release()); 143 layerObject->setScrollRects(scrollRects.release());
144 return layerObject; 144 return layerObject;
145 } 145 }
146 146
147 InspectorLayerTreeAgent::InspectorLayerTreeAgent(InspectorPageAgent* pageAgent) 147 InspectorLayerTreeAgent::InspectorLayerTreeAgent(Page* page)
148 : InspectorBaseAgent<InspectorLayerTreeAgent>("LayerTree") 148 : InspectorBaseAgent<InspectorLayerTreeAgent>("LayerTree")
149 , m_frontend(0) 149 , m_frontend(0)
150 , m_pageAgent(pageAgent) 150 , m_page(page)
151 { 151 {
152 } 152 }
153 153
154 InspectorLayerTreeAgent::~InspectorLayerTreeAgent() 154 InspectorLayerTreeAgent::~InspectorLayerTreeAgent()
155 { 155 {
156 } 156 }
157 157
158 void InspectorLayerTreeAgent::trace(Visitor* visitor) 158 void InspectorLayerTreeAgent::trace(Visitor* visitor)
159 { 159 {
160 visitor->trace(m_pageAgent); 160 visitor->trace(m_page);
161 InspectorBaseAgent::trace(visitor); 161 InspectorBaseAgent::trace(visitor);
162 } 162 }
163 163
164 void InspectorLayerTreeAgent::setFrontend(InspectorFrontend* frontend) 164 void InspectorLayerTreeAgent::setFrontend(InspectorFrontend* frontend)
165 { 165 {
166 m_frontend = frontend->layertree(); 166 m_frontend = frontend->layertree();
167 } 167 }
168 168
169 void InspectorLayerTreeAgent::clearFrontend() 169 void InspectorLayerTreeAgent::clearFrontend()
170 { 170 {
171 m_frontend = nullptr; 171 m_frontend = nullptr;
172 disable(0); 172 disable(0);
173 } 173 }
174 174
175 void InspectorLayerTreeAgent::restore() 175 void InspectorLayerTreeAgent::restore()
176 { 176 {
177 // We do not re-enable layer agent automatically after navigation. This is b ecause 177 // We do not re-enable layer agent automatically after navigation. This is b ecause
178 // it depends on DOMAgent and node ids in particular, so we let front-end re quest document 178 // it depends on DOMAgent and node ids in particular, so we let front-end re quest document
179 // and re-enable the agent manually after this. 179 // and re-enable the agent manually after this.
180 } 180 }
181 181
182 void InspectorLayerTreeAgent::enable(ErrorString*) 182 void InspectorLayerTreeAgent::enable(ErrorString*)
183 { 183 {
184 m_instrumentingAgents->setInspectorLayerTreeAgent(this); 184 m_instrumentingAgents->setInspectorLayerTreeAgent(this);
185 if (LocalFrame* frame = m_pageAgent->inspectedFrame()) { 185 if (LocalFrame* frame = m_page->deprecatedLocalMainFrame()) {
186 Document* document = frame->document(); 186 Document* document = frame->document();
187 if (document && document->lifecycle().state() >= DocumentLifecycle::Comp ositingClean) 187 if (document && document->lifecycle().state() >= DocumentLifecycle::Comp ositingClean)
188 layerTreeDidChange(); 188 layerTreeDidChange();
189 } 189 }
190 } 190 }
191 191
192 void InspectorLayerTreeAgent::disable(ErrorString*) 192 void InspectorLayerTreeAgent::disable(ErrorString*)
193 { 193 {
194 m_instrumentingAgents->setInspectorLayerTreeAgent(0); 194 m_instrumentingAgents->setInspectorLayerTreeAgent(0);
195 m_snapshotById.clear(); 195 m_snapshotById.clear();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers); 259 gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers);
260 } 260 }
261 261
262 int InspectorLayerTreeAgent::idForNode(Node* node) 262 int InspectorLayerTreeAgent::idForNode(Node* node)
263 { 263 {
264 return InspectorNodeIds::idForNode(node); 264 return InspectorNodeIds::idForNode(node);
265 } 265 }
266 266
267 RenderLayerCompositor* InspectorLayerTreeAgent::renderLayerCompositor() 267 RenderLayerCompositor* InspectorLayerTreeAgent::renderLayerCompositor()
268 { 268 {
269 RenderView* renderView = m_pageAgent->inspectedFrame()->contentRenderer(); 269 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer ();
270 RenderLayerCompositor* compositor = renderView ? renderView->compositor() : nullptr; 270 RenderLayerCompositor* compositor = renderView ? renderView->compositor() : nullptr;
271 return compositor; 271 return compositor;
272 } 272 }
273 273
274 GraphicsLayer* InspectorLayerTreeAgent::rootGraphicsLayer() 274 GraphicsLayer* InspectorLayerTreeAgent::rootGraphicsLayer()
275 { 275 {
276 if (m_pageAgent->frameHost()->settings().pinchVirtualViewportEnabled()) 276 if (m_page->settings().pinchVirtualViewportEnabled())
277 return m_pageAgent->frameHost()->pinchViewport().rootGraphicsLayer(); 277 return m_page->frameHost().pinchViewport().rootGraphicsLayer();
278 278
279 return renderLayerCompositor()->rootGraphicsLayer(); 279 return renderLayerCompositor()->rootGraphicsLayer();
280 } 280 }
281 281
282 static GraphicsLayer* findLayerById(GraphicsLayer* root, int layerId) 282 static GraphicsLayer* findLayerById(GraphicsLayer* root, int layerId)
283 { 283 {
284 if (root->platformLayer()->id() == layerId) 284 if (root->platformLayer()->id() == layerId)
285 return root; 285 return root;
286 if (root->replicaLayer()) { 286 if (root->replicaLayer()) {
287 if (GraphicsLayer* layer = findLayerById(root->replicaLayer(), layerId)) 287 if (GraphicsLayer* layer = findLayerById(root->replicaLayer(), layerId))
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) 486 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer)
487 { 487 {
488 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); 488 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id());
489 if (index == WTF::kNotFound) 489 if (index == WTF::kNotFound)
490 return; 490 return;
491 m_pageOverlayLayerIds.remove(index); 491 m_pageOverlayLayerIds.remove(index);
492 } 492 }
493 493
494 494
495 } // namespace blink 495 } // 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