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

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

Issue 58543002: Use a boolean hasCompositedLayerMapping() accessor instead of the pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment for hasCompositedLayerMapping Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void InspectorLayerTreeAgent::layerTreeDidChange() 147 void InspectorLayerTreeAgent::layerTreeDidChange()
148 { 148 {
149 m_frontend->layerTreeDidChange(buildLayerTree()); 149 m_frontend->layerTreeDidChange(buildLayerTree());
150 } 150 }
151 151
152 void InspectorLayerTreeAgent::didPaint(RenderObject*, const GraphicsLayer* graph icsLayer, GraphicsContext*, const LayoutRect& rect) 152 void InspectorLayerTreeAgent::didPaint(RenderObject*, const GraphicsLayer* graph icsLayer, GraphicsContext*, const LayoutRect& rect)
153 { 153 {
154 // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that. 154 // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that.
155 if (!graphicsLayer) 155 if (!graphicsLayer)
156 return; 156 return;
157
157 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() 158 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create()
158 .setX(rect.x()) 159 .setX(rect.x())
159 .setY(rect.y()) 160 .setY(rect.y())
160 .setWidth(rect.width()) 161 .setWidth(rect.width())
161 .setHeight(rect.height()); 162 .setHeight(rect.height());
162 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); 163 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release());
163 } 164 }
164 165
165 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre eAgent::buildLayerTree() 166 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre eAgent::buildLayerTree()
166 { 167 {
167 RenderLayerCompositor* compositor = renderLayerCompositor(); 168 RenderLayerCompositor* compositor = renderLayerCompositor();
168 if (!compositor || !compositor->inCompositingMode()) 169 if (!compositor || !compositor->inCompositingMode())
169 return 0; 170 return 0;
170 LayerIdToNodeIdMap layerIdToNodeIdMap; 171 LayerIdToNodeIdMap layerIdToNodeIdMap;
171 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil der::Array<TypeBuilder::LayerTree::Layer>::create(); 172 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil der::Array<TypeBuilder::LayerTree::Layer>::create();
172 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); 173 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap);
173 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la yers); 174 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la yers);
174 return layers.release(); 175 return layers.release();
175 } 176 }
176 177
177 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId ToNodeIdMap& layerIdToNodeIdMap) 178 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId ToNodeIdMap& layerIdToNodeIdMap)
178 { 179 {
179 if (root->compositedLayerMapping()) { 180 if (root->hasCompositedLayerMapping()) {
180 if (Node* node = root->renderer()->generatingNode()) { 181 if (Node* node = root->renderer()->generatingNode()) {
181 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); 182 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers();
182 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo de(node)); 183 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo de(node));
183 } 184 }
184 } 185 }
185 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl ing()) 186 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl ing())
186 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); 187 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap);
187 if (!root->renderer()->isRenderIFrame()) 188 if (!root->renderer()->isRenderIFrame())
188 return; 189 return;
189 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi dget()); 190 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi dget());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 continue; 296 continue;
296 reasonStrings->addItem(compositingReasonNames[i].protocolName); 297 reasonStrings->addItem(compositingReasonNames[i].protocolName);
297 #ifndef _NDEBUG 298 #ifndef _NDEBUG
298 reasonsBitmask &= ~compositingReasonNames[i].mask; 299 reasonsBitmask &= ~compositingReasonNames[i].mask;
299 #endif 300 #endif
300 } 301 }
301 ASSERT(!reasonsBitmask); 302 ASSERT(!reasonsBitmask);
302 } 303 }
303 304
304 } // namespace WebCore 305 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698