Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
| index 20e0e4a531b09665fd025cf309a806006661f9bf..90daea4443cd5c77fbed0d97036bbdb76cf83539 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
| @@ -28,7 +28,9 @@ |
| #include "SkImageFilter.h" |
| #include "SkMatrix44.h" |
| +#include "base/trace_event/trace_event_argument.h" |
| #include "platform/DragImage.h" |
| +#include "platform/JSONValues.h" |
| #include "platform/TraceEvent.h" |
| #include "platform/geometry/FloatRect.h" |
| #include "platform/geometry/LayoutRect.h" |
| @@ -49,7 +51,6 @@ |
| #include "public/platform/WebFilterOperations.h" |
| #include "public/platform/WebFloatPoint.h" |
| #include "public/platform/WebFloatRect.h" |
| -#include "public/platform/WebGraphicsLayerDebugInfo.h" |
| #include "public/platform/WebLayer.h" |
| #include "public/platform/WebPoint.h" |
| #include "public/platform/WebSize.h" |
| @@ -122,7 +123,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) |
| m_contentLayerDelegate = adoptPtr(new ContentLayerDelegate(this)); |
| m_layer = adoptPtr(Platform::current()->compositorSupport()->createContentLayer(m_contentLayerDelegate.get())); |
| m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); |
| - m_layer->layer()->setWebLayerClient(this); |
| + m_layer->layer()->setLayerClient(this); |
| m_layer->setAutomaticallyComputeRasterScale(true); |
| // TODO(rbyers): Expose control over this to the web - crbug.com/489802: |
| @@ -434,7 +435,7 @@ void GraphicsLayer::setupContentsLayer(WebLayer* contentsLayer) |
| m_contentsLayer = contentsLayer; |
| m_contentsLayerId = m_contentsLayer->id(); |
| - m_contentsLayer->setWebLayerClient(this); |
| + m_contentsLayer->setLayerClient(this); |
| m_contentsLayer->setTransformOrigin(FloatPoint3D()); |
| m_contentsLayer->setUseParentBackfaceVisibility(true); |
| @@ -465,13 +466,6 @@ GraphicsLayerDebugInfo& GraphicsLayer::debugInfo() |
| return m_debugInfo; |
| } |
| -WebGraphicsLayerDebugInfo* GraphicsLayer::takeDebugInfoFor(WebLayer* layer) |
| -{ |
| - GraphicsLayerDebugInfo* clone = m_debugInfo.clone(); |
| - clone->setDebugName(debugName(layer)); |
| - return clone; |
| -} |
| - |
| WebLayer* GraphicsLayer::contentsLayerIfRegistered() |
| { |
| clearContentsLayerIfUnregistered(); |
| @@ -751,7 +745,12 @@ String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const |
| return json->toPrettyJSONString(); |
| } |
| -String GraphicsLayer::debugName(WebLayer* webLayer) const |
| +static const cc::Layer* ccLayerForWebLayer(const WebLayer* webLayer) |
| +{ |
| + return webLayer ? webLayer->ccLayer() : nullptr; |
| +} |
| + |
| +String GraphicsLayer::debugName(cc::Layer* layer) const |
| { |
| String name; |
| if (!m_client) |
| @@ -759,17 +758,17 @@ String GraphicsLayer::debugName(WebLayer* webLayer) const |
| String highlightDebugName; |
| for (size_t i = 0; i < m_linkHighlights.size(); ++i) { |
| - if (webLayer == m_linkHighlights[i]->layer()) { |
| + if (layer == ccLayerForWebLayer(m_linkHighlights[i]->layer())) { |
| highlightDebugName = "LinkHighlight[" + String::number(i) + "] for " + m_client->debugName(this); |
| break; |
| } |
| } |
| - if (webLayer == m_contentsLayer) { |
| + if (layer == ccLayerForWebLayer(m_contentsLayer)) { |
| name = "ContentsLayer for " + m_client->debugName(this); |
| } else if (!highlightDebugName.isEmpty()) { |
| name = highlightDebugName; |
| - } else if (webLayer == m_layer->layer()) { |
| + } else if (layer == ccLayerForWebLayer(m_layer->layer())) { |
| name = m_client->debugName(this); |
| } else { |
| ASSERT_NOT_REACHED(); |
| @@ -1120,7 +1119,7 @@ void GraphicsLayer::addLinkHighlight(LinkHighlight* linkHighlight) |
| { |
| ASSERT(linkHighlight && !m_linkHighlights.contains(linkHighlight)); |
| m_linkHighlights.append(linkHighlight); |
| - linkHighlight->layer()->setWebLayerClient(this); |
| + linkHighlight->layer()->setLayerClient(this); |
| updateChildList(); |
| } |
| @@ -1168,6 +1167,14 @@ void GraphicsLayer::didScroll() |
| } |
| } |
| +scoped_refptr<base::trace_event::ConvertableToTraceFormat> GraphicsLayer::TakeDebugInfo(cc::Layer* layer) |
| +{ |
| + CString layerName = debugName(layer).utf8(); |
| + scoped_refptr<base::trace_event::TracedValue> tracedValue = m_debugInfo.asTracedValue(); |
| + tracedValue->SetString("layer_name", std::string(layerName.data(), layerName.length())); |
|
esprehn
2015/10/23 19:17:41
fyi: this is multiple copies of the string, once i
jbroman
2015/10/23 19:26:24
I know; maybe I should have left a TODO. There are
|
| + return tracedValue; |
| +} |
| + |
| PaintController* GraphicsLayer::paintController() |
| { |
| if (!m_paintController) |