Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 } | 145 } |
| 146 | 146 |
| 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* renderer, GraphicsContext*, const LayoutRect& rect) | 152 void InspectorLayerTreeAgent::didPaint(RenderObject* renderer, GraphicsContext*, const LayoutRect& rect) |
| 153 { | 153 { |
| 154 RenderLayer* renderLayer = toRenderLayerModelObject(renderer)->layer(); | 154 RenderLayer* renderLayer = toRenderLayerModelObject(renderer)->layer(); |
| 155 CompositedLayerMapping* compositedLayerMapping = renderLayer->compositedLaye rMapping(); | |
| 156 // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that. | 155 // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that. |
| 157 if (!compositedLayerMapping) | 156 if (renderLayer->compositingState() != PaintsIntoOwnBacking) |
|
shawnsingh
2013/11/05 10:20:27
It makes sense if this would never be called when
Ian Vollick
2013/11/08 03:35:12
Yep, I'm pretty certain. I've updated the code wit
| |
| 158 return; | 157 return; |
| 159 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 158 GraphicsLayer* graphicsLayer = renderLayer->compositedLayerMapping()->mainGr aphicsLayer(); |
| 160 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() | 159 RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create() |
| 161 .setX(rect.x()) | 160 .setX(rect.x()) |
| 162 .setY(rect.y()) | 161 .setY(rect.y()) |
| 163 .setWidth(rect.width()) | 162 .setWidth(rect.width()) |
| 164 .setHeight(rect.height()); | 163 .setHeight(rect.height()); |
| 165 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); | 164 m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release()); |
| 166 } | 165 } |
| 167 | 166 |
| 168 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre eAgent::buildLayerTree() | 167 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre eAgent::buildLayerTree() |
| 169 { | 168 { |
| 170 RenderLayerCompositor* compositor = renderLayerCompositor(); | 169 RenderLayerCompositor* compositor = renderLayerCompositor(); |
| 171 if (!compositor || !compositor->inCompositingMode()) | 170 if (!compositor || !compositor->inCompositingMode()) |
| 172 return 0; | 171 return 0; |
| 173 LayerIdToNodeIdMap layerIdToNodeIdMap; | 172 LayerIdToNodeIdMap layerIdToNodeIdMap; |
| 174 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil der::Array<TypeBuilder::LayerTree::Layer>::create(); | 173 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuil der::Array<TypeBuilder::LayerTree::Layer>::create(); |
| 175 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); | 174 buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap); |
| 176 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la yers); | 175 gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, la yers); |
| 177 return layers.release(); | 176 return layers.release(); |
| 178 } | 177 } |
| 179 | 178 |
| 180 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId ToNodeIdMap& layerIdToNodeIdMap) | 179 void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(RenderLayer* root, LayerId ToNodeIdMap& layerIdToNodeIdMap) |
| 181 { | 180 { |
| 182 if (root->compositedLayerMapping()) { | 181 if (root->compositingState() == PaintsIntoOwnBacking) { |
|
shawnsingh
2013/11/05 10:20:27
I don't think this one is correct. The previous c
Ian Vollick
2013/11/08 03:35:12
I think there may have been a bug in the old code.
| |
| 183 if (Node* node = root->renderer()->generatingNode()) { | 182 if (Node* node = root->renderer()->generatingNode()) { |
| 184 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); | 183 GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->child ForSuperlayers(); |
| 185 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo de(node)); | 184 layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNo de(node)); |
| 186 } | 185 } |
| 187 } | 186 } |
| 188 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl ing()) | 187 for (RenderLayer* child = root->firstChild(); child; child = child->nextSibl ing()) |
| 189 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); | 188 buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap); |
| 190 if (!root->renderer()->isRenderIFrame()) | 189 if (!root->renderer()->isRenderIFrame()) |
| 191 return; | 190 return; |
| 192 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi dget()); | 191 FrameView* childFrameView = toFrameView(toRenderWidget(root->renderer())->wi dget()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 continue; | 297 continue; |
| 299 reasonStrings->addItem(compositingReasonNames[i].protocolName); | 298 reasonStrings->addItem(compositingReasonNames[i].protocolName); |
| 300 #ifndef _NDEBUG | 299 #ifndef _NDEBUG |
| 301 reasonsBitmask &= ~compositingReasonNames[i].mask; | 300 reasonsBitmask &= ~compositingReasonNames[i].mask; |
| 302 #endif | 301 #endif |
| 303 } | 302 } |
| 304 ASSERT(!reasonsBitmask); | 303 ASSERT(!reasonsBitmask); |
| 305 } | 304 } |
| 306 | 305 |
| 307 } // namespace WebCore | 306 } // namespace WebCore |
| OLD | NEW |