From 69698f992d3c6b2badd01f718c71df7a52b099fb Mon Sep 17 00:00:00 2001 From: jbroman Date: Fri, 20 Nov 2015 09:43:58 -0800 Subject: Remove blink::WebLayerClient and WebGraphicsLayerDebugInfo. It is now legal for Blink to provide an implementation of cc::LayerClient. CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1419913002 Cr-Commit-Position: refs/heads/master@{#360855} --- cc/blink/web_layer_impl.cc | 42 ++++-------------------------------------- cc/blink/web_layer_impl.h | 11 +++-------- cc/layers/layer.cc | 2 +- cc/layers/layer_client.h | 9 ++++++--- 4 files changed, 14 insertions(+), 50 deletions(-) (limited to 'cc') diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc index 726cfa6..bde0bdf 100644 --- a/cc/blink/web_layer_impl.cc +++ b/cc/blink/web_layer_impl.cc @@ -25,8 +25,6 @@ #include "cc/trees/layer_tree_host.h" #include "third_party/WebKit/public/platform/WebFloatPoint.h" #include "third_party/WebKit/public/platform/WebFloatRect.h" -#include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" -#include "third_party/WebKit/public/platform/WebLayerClient.h" #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" #include "third_party/WebKit/public/platform/WebSize.h" @@ -54,20 +52,15 @@ base::LazyInstance g_layer_settings = WebLayerImpl::WebLayerImpl() : layer_(Layer::Create(LayerSettings())), contents_opaque_is_fixed_(false) { - web_layer_client_ = nullptr; - layer_->SetLayerClient(this); } WebLayerImpl::WebLayerImpl(scoped_refptr layer) : layer_(layer), contents_opaque_is_fixed_(false) { - web_layer_client_ = nullptr; - layer_->SetLayerClient(this); } WebLayerImpl::~WebLayerImpl() { if (animation_delegate_adapter_.get()) layer_->set_layer_animation_delegate(nullptr); - web_layer_client_ = nullptr; layer_->SetLayerClient(nullptr); } @@ -493,39 +486,12 @@ bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } -void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { - web_layer_client_ = client; +void WebLayerImpl::setLayerClient(cc::LayerClient* client) { + layer_->SetLayerClient(client); } -class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat { - public: - // This object takes ownership of the debug_info object. - explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) - : debug_info_(debug_info) {} - void AppendAsTraceFormat(std::string* out) const override { - DCHECK(thread_checker_.CalledOnValidThread()); - blink::WebString web_string; - debug_info_->appendAsTraceFormat(&web_string); - out->append(web_string.utf8()); - } - - private: - ~TracedDebugInfo() override {} - scoped_ptr debug_info_; - base::ThreadChecker thread_checker_; -}; - -scoped_refptr -WebLayerImpl::TakeDebugInfo() { - if (!web_layer_client_) - return nullptr; - blink::WebGraphicsLayerDebugInfo* debug_info = - web_layer_client_->takeDebugInfoFor(this); - - if (debug_info) - return new TracedDebugInfo(debug_info); - else - return nullptr; +const cc::Layer* WebLayerImpl::ccLayer() const { + return layer_.get(); } void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { diff --git a/cc/blink/web_layer_impl.h b/cc/blink/web_layer_impl.h index e9f79c0..eb5be7e 100644 --- a/cc/blink/web_layer_impl.h +++ b/cc/blink/web_layer_impl.h @@ -27,7 +27,6 @@ namespace blink { class WebFilterOperations; -class WebLayerClient; struct WebFloatRect; } @@ -46,7 +45,7 @@ namespace cc_blink { class WebToCCAnimationDelegateAdapter; -class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { +class WebLayerImpl : public blink::WebLayer { public: CC_BLINK_EXPORT WebLayerImpl(); CC_BLINK_EXPORT explicit WebLayerImpl(scoped_refptr); @@ -146,18 +145,14 @@ class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { blink::WebLayerPositionConstraint positionConstraint() const override; void setScrollClient(blink::WebLayerScrollClient* client) override; bool isOrphan() const override; - void setWebLayerClient(blink::WebLayerClient* client) override; - - // LayerClient implementation. - scoped_refptr TakeDebugInfo() - override; + void setLayerClient(cc::LayerClient* client) override; + const cc::Layer* ccLayer() const override; void setScrollParent(blink::WebLayer* parent) override; void setClipParent(blink::WebLayer* parent) override; protected: scoped_refptr layer_; - blink::WebLayerClient* web_layer_client_; bool contents_opaque_is_fixed_; diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 68b34df..d6b1fb0 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -1531,7 +1531,7 @@ bool Layer::IsSuitableForGpuRasterization() const { scoped_refptr Layer::TakeDebugInfo() { if (client_) - return client_->TakeDebugInfo(); + return client_->TakeDebugInfo(this); else return nullptr; } diff --git a/cc/layers/layer_client.h b/cc/layers/layer_client.h index bcdf1c3..524399d 100644 --- a/cc/layers/layer_client.h +++ b/cc/layers/layer_client.h @@ -5,8 +5,6 @@ #ifndef CC_LAYERS_LAYER_CLIENT_H_ #define CC_LAYERS_LAYER_CLIENT_H_ -#include - #include "base/memory/ref_counted.h" #include "cc/base/cc_export.h" @@ -18,14 +16,19 @@ class ConvertableToTraceFormat; namespace cc { +class Layer; + class CC_EXPORT LayerClient { public: // Returns a pointer to a debug info object, if one has been computed. // If not, returns nullptr. // If the returned pointer is non-nullptr, the caller takes // ownership of the pointer. + // + // A pointer to the layer is provided for the convenience of layer clients + // which service multiple layers. virtual scoped_refptr - TakeDebugInfo() = 0; + TakeDebugInfo(Layer* layer) = 0; protected: virtual ~LayerClient() {} -- cgit v1.1