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

Unified Diff: Source/core/rendering/RenderLayerBacking.cpp

Issue 18473002: Add an API to report debugName in GraphicsLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: clear setName Created 7 years, 5 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: Source/core/rendering/RenderLayerBacking.cpp
diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp
index a5a84c2b7768a81120c75fe9546c869b246ec6c4..3f01323d123d8876f4e62636dc8ce3a1727a633d 100644
--- a/Source/core/rendering/RenderLayerBacking.cpp
+++ b/Source/core/rendering/RenderLayerBacking.cpp
@@ -123,7 +123,7 @@ RenderLayerBacking::~RenderLayerBacking()
destroyGraphicsLayers();
}
-PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, CompositingReasons reasons)
+PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(CompositingReasons reasons)
{
GraphicsLayerFactory* graphicsLayerFactory = 0;
if (Page* page = renderer()->frame()->page())
@@ -131,12 +131,6 @@ PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String&
OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, this);
-#ifndef NDEBUG
- graphicsLayer->setName(name);
-#else
- UNUSED_PARAM(name);
-#endif
-
graphicsLayer->setCompositingReasons(reasons);
return graphicsLayer.release();
@@ -188,12 +182,7 @@ void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaint
void RenderLayerBacking::createPrimaryGraphicsLayer()
{
- String layerName;
-#ifndef NDEBUG
- layerName = m_owningLayer->debugName();
-#endif
-
- m_graphicsLayer = createGraphicsLayer(layerName, m_owningLayer->compositingReasons());
+ m_graphicsLayer = createGraphicsLayer(m_owningLayer->compositingReasons());
#if !OS(ANDROID)
if (m_isMainFrameRenderViewLayer)
@@ -854,7 +843,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
if (needsAncestorClip) {
if (!m_ancestorClippingLayer) {
- m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Layer", CompositingReasonLayerForClip);
+ m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForClip);
m_ancestorClippingLayer->setMasksToBounds(true);
layersChanged = true;
}
@@ -866,7 +855,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
if (needsDescendantClip) {
if (!m_childContainmentLayer) {
- m_childContainmentLayer = createGraphicsLayer("Child clipping Layer", CompositingReasonLayerForClip);
+ m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForClip);
m_childContainmentLayer->setMasksToBounds(true);
layersChanged = true;
}
@@ -889,7 +878,7 @@ bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
bool horizontalScrollbarLayerChanged = false;
if (needsHorizontalScrollbarLayer) {
if (!m_layerForHorizontalScrollbar) {
- m_layerForHorizontalScrollbar = createGraphicsLayer("horizontal scrollbar", CompositingReasonLayerForScrollbar);
+ m_layerForHorizontalScrollbar = createGraphicsLayer(CompositingReasonLayerForScrollbar);
horizontalScrollbarLayerChanged = true;
}
} else if (m_layerForHorizontalScrollbar) {
@@ -900,7 +889,7 @@ bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
bool verticalScrollbarLayerChanged = false;
if (needsVerticalScrollbarLayer) {
if (!m_layerForVerticalScrollbar) {
- m_layerForVerticalScrollbar = createGraphicsLayer("vertical scrollbar", CompositingReasonLayerForScrollbar);
+ m_layerForVerticalScrollbar = createGraphicsLayer(CompositingReasonLayerForScrollbar);
verticalScrollbarLayerChanged = true;
}
} else if (m_layerForVerticalScrollbar) {
@@ -911,7 +900,7 @@ bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
bool scrollCornerLayerChanged = false;
if (needsScrollCornerLayer) {
if (!m_layerForScrollCorner) {
- m_layerForScrollCorner = createGraphicsLayer("scroll corner", CompositingReasonLayerForScrollbar);
+ m_layerForScrollCorner = createGraphicsLayer(CompositingReasonLayerForScrollbar);
scrollCornerLayerChanged = true;
}
} else if (m_layerForScrollCorner) {
@@ -984,11 +973,7 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
bool layerChanged = false;
if (needsForegroundLayer) {
if (!m_foregroundLayer) {
- String layerName;
-#ifndef NDEBUG
- layerName = m_owningLayer->debugName() + " (foreground)";
-#endif
- m_foregroundLayer = createGraphicsLayer(layerName, CompositingReasonLayerForForeground);
+ m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForForeground);
m_foregroundLayer->setDrawsContent(true);
m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
layerChanged = true;
@@ -1010,11 +995,7 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
bool layerChanged = false;
if (needsBackgroundLayer) {
if (!m_backgroundLayer) {
- String layerName;
-#ifndef NDEBUG
- layerName = m_owningLayer->debugName() + " (background)";
-#endif
- m_backgroundLayer = createGraphicsLayer(layerName, CompositingReasonLayerForBackground);
+ m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
m_backgroundLayer->setDrawsContent(true);
m_backgroundLayer->setAnchorPoint(FloatPoint3D());
m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
@@ -1022,11 +1003,7 @@ bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
}
if (!m_contentsContainmentLayer) {
- String layerName;
-#ifndef NDEBUG
- layerName = m_owningLayer->debugName() + " (contents containment)";
-#endif
- m_contentsContainmentLayer = createGraphicsLayer(layerName, CompositingReasonLayerForBackground);
+ m_contentsContainmentLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
layerChanged = true;
}
} else {
@@ -1050,7 +1027,7 @@ bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer)
bool layerChanged = false;
if (needsMaskLayer) {
if (!m_maskLayer) {
- m_maskLayer = createGraphicsLayer("Mask", CompositingReasonLayerForMask);
+ m_maskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
m_maskLayer->setDrawsContent(true);
m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
layerChanged = true;
@@ -1074,12 +1051,12 @@ bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers)
if (needsScrollingLayers) {
if (!m_scrollingLayer) {
// Outer layer which corresponds with the scroll view.
- m_scrollingLayer = createGraphicsLayer("Scrolling container", CompositingReasonLayerForClip);
+ m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForClip);
m_scrollingLayer->setDrawsContent(false);
m_scrollingLayer->setMasksToBounds(true);
// Inner layer which renders the content that scrolls.
- m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents", CompositingReasonLayerForScrollingContainer);
+ m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContainer);
m_scrollingContentsLayer->setDrawsContent(true);
GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
if (!m_foregroundLayer)
@@ -1969,4 +1946,36 @@ void RenderLayerBacking::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c
info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer");
}
+String RenderLayerBacking::debugName(const GraphicsLayer* graphicsLayer)
+{
+ String name;
+ if (graphicsLayer == m_graphicsLayer.get()) {
+ name = m_owningLayer->debugName();
+ } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
+ name = "Ancestor Clipping Layer";
+ } else if (graphicsLayer == m_contentsContainmentLayer.get()) {
+ name = "Contents Containment Layer";
+ } else if (graphicsLayer == m_foregroundLayer.get()) {
+ name = m_owningLayer->debugName() + " (foreground) Layer";
+ } else if (graphicsLayer == m_backgroundLayer.get()) {
+ name = m_owningLayer->debugName() + " (background) Layer";
+ } else if (graphicsLayer == m_childContainmentLayer.get()) {
+ name = "Child Containment Layer";
+ } else if (graphicsLayer == m_maskLayer.get()) {
+ name = "Mask Layer";
+ } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
+ name = "Horizontal Scrollbar Layer";
+ } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
+ name = "Vertical Scrollbar Layer";
+ } else if (graphicsLayer == m_layerForScrollCorner.get()) {
+ name = "Scroll Corner Layer";
+ } else if (graphicsLayer == m_scrollingLayer.get()) {
+ name = "Scrolling Layer";
+ } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
+ name = "Scrolling Contents Layer";
+ }
+
+ return name;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698