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

Unified Diff: Source/core/platform/graphics/GraphicsLayer.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/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index dc61fd0eac9a4bd370f9c0d947fdf0fb703582d0..05746a4b082a98b80af3821687185bcc31f7fe58 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -144,6 +144,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
m_layer = adoptPtr(Platform::current()->compositorSupport()->createContentLayer(m_opaqueRectTrackingContentLayerDelegate.get()));
m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
m_layer->layer()->setScrollClient(this);
+ m_layer->layer()->setWebLayerClient(this);
m_layer->setAutomaticallyComputeRasterScale(true);
}
@@ -151,6 +152,7 @@ GraphicsLayer::~GraphicsLayer()
{
if (m_linkHighlight) {
m_linkHighlight->clearCurrentGraphicsLayer();
+ m_linkHighlight->layer()->setWebLayerClient(0);
m_linkHighlight = 0;
}
@@ -555,21 +557,6 @@ int GraphicsLayer::validateTransformOperations(const KeyframeValueList& valueLis
return firstIndex;
}
-void GraphicsLayer::updateNames()
-{
- String debugName = "Layer for " + m_nameBase;
- m_layer->layer()->setDebugName(debugName);
-
- if (WebLayer* contentsLayer = contentsLayerIfRegistered()) {
- String debugName = "ContentsLayer for " + m_nameBase;
- contentsLayer->setDebugName(debugName);
- }
- if (m_linkHighlight) {
- String debugName = "LinkHighlight for " + m_nameBase;
- m_linkHighlight->layer()->setDebugName(debugName);
- }
-}
-
void GraphicsLayer::updateChildList()
{
WebLayer* childHost = m_layer->layer();
@@ -661,6 +648,7 @@ void GraphicsLayer::setContentsTo(ContentsLayerPurpose purpose, WebLayer* layer)
childrenChanged = true;
// The old contents layer will be removed via updateChildList.
+ m_contentsLayer->setWebLayerClient(0);
m_contentsLayer = 0;
}
}
@@ -675,6 +663,7 @@ void GraphicsLayer::setupContentsLayer(WebLayer* contentsLayer)
m_contentsLayerId = m_contentsLayer->id();
if (m_contentsLayer) {
+ m_contentsLayer->setWebLayerClient(this);
m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
m_contentsLayer->setUseParentBackfaceVisibility(true);
@@ -686,7 +675,6 @@ void GraphicsLayer::setupContentsLayer(WebLayer* contentsLayer)
// shadow content that must display in front of the video.
m_layer->layer()->insertChild(m_contentsLayer, 0);
}
- updateNames();
}
void GraphicsLayer::clearContentsLayerIfUnregistered()
@@ -694,6 +682,8 @@ void GraphicsLayer::clearContentsLayerIfUnregistered()
if (!m_contentsLayerId || s_registeredLayerSet->contains(m_contentsLayerId))
return;
+ if (m_contentsLayer)
+ m_contentsLayer->setWebLayerClient(0);
m_contentsLayer = 0;
m_contentsLayerId = 0;
}
@@ -748,7 +738,7 @@ void GraphicsLayer::dumpLayer(TextStream& ts, int indent, LayerTreeFlags flags)
if (flags & LayerTreeIncludesDebugInfo) {
ts << " " << static_cast<void*>(const_cast<GraphicsLayer*>(this));
- ts << " \"" << m_name << "\"";
+ ts << " \"" << m_client->debugName(this) << "\"";
}
ts << "\n";
@@ -937,8 +927,6 @@ void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_replicaLayer, "replicaLayer");
info.addMember(m_replicatedLayer, "replicatedLayer");
info.ignoreMember(m_client);
- info.addMember(m_name, "name");
- info.addMember(m_nameBase, "nameBase");
info.addMember(m_layer, "layer");
info.addMember(m_imageLayer, "imageLayer");
info.addMember(m_contentsLayer, "contentsLayer");
@@ -948,11 +936,17 @@ void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_scrollableArea, "scrollableArea");
}
-void GraphicsLayer::setName(const String& name)
+WebKit::WebString GraphicsLayer::debugName(WebKit::WebLayer* webLayer)
{
- m_nameBase = name;
- m_name = String::format("GraphicsLayer(%p) ", this) + name;
- updateNames();
+ String name = "";
+ if (webLayer == m_contentsLayer) {
+ name = "ContentsLayer for " + m_client->debugName(this);
+ } else if (m_linkHighlight && webLayer == m_linkHighlight->layer()) {
+ name = "LinkHighlight for " + m_client->debugName(this);
+ } else if (webLayer == m_layer->layer()) {
+ name = m_client->debugName(this);
+ }
+ return name;
}
int GraphicsLayer::debugID() const
@@ -1146,6 +1140,8 @@ void GraphicsLayer::setContentsToImage(Image* image)
m_imageLayer.clear();
}
// The old contents layer will be removed via updateChildList.
+ if (m_contentsLayer)
+ m_contentsLayer->setWebLayerClient(0);
m_contentsLayer = 0;
}
@@ -1334,6 +1330,8 @@ void GraphicsLayer::setBackgroundFilters(const FilterOperations& filters)
void GraphicsLayer::setLinkHighlight(LinkHighlightClient* linkHighlight)
{
m_linkHighlight = linkHighlight;
+ if (m_linkHighlight)
+ m_linkHighlight->layer()->setWebLayerClient(this);
updateChildList();
}

Powered by Google App Engine
This is Rietveld 408576698