Chromium Code Reviews| Index: webkit/renderer/compositor_bindings/web_layer_impl.cc |
| diff --git a/webkit/renderer/compositor_bindings/web_layer_impl.cc b/webkit/renderer/compositor_bindings/web_layer_impl.cc |
| index 950f76e93a3e441b73ec5637a8c943ea2cdc44ab..f987b32d75f9ab134038a744f9f7361f69f8b0e5 100644 |
| --- a/webkit/renderer/compositor_bindings/web_layer_impl.cc |
| +++ b/webkit/renderer/compositor_bindings/web_layer_impl.cc |
| @@ -5,6 +5,7 @@ |
| #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| #include "base/bind.h" |
| +#include "base/debug/trace_event_impl.h" |
| #include "base/strings/string_util.h" |
| #include "cc/animation/animation.h" |
| #include "cc/base/region.h" |
| @@ -13,6 +14,7 @@ |
| #include "third_party/WebKit/public/platform/WebCompositingReasons.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" |
| @@ -372,6 +374,36 @@ void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { |
| web_layer_client_ = client; |
| } |
| +// TODO(chrishtr): move DebugName into this class. |
| +class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { |
| + public: |
| + // This object takes ownership of the debug_info object. |
| + explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) : |
| + debug_info_(debug_info) {} |
| + virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { |
| + blink::WebString web_string; |
| + debug_info_->appendAsTraceFormat(&web_string); |
| + out->append(web_string.utf8()); |
| + } |
| + private: |
| + virtual ~TracedDebugInfo() {} |
| + scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; |
| +}; |
| + |
| +scoped_refptr<base::debug::ConvertableToTraceFormat> |
| + WebLayerImpl::TakeDebugInfo() { |
| + if (!web_layer_client_) |
| + return NULL; |
| + blink::WebGraphicsLayerDebugInfo* debug_info = |
| + web_layer_client_->takeDebugInfo(); |
| + |
| + if (debug_info) |
| + return scoped_refptr<base::debug::ConvertableToTraceFormat>( |
|
danakj
2013/12/03 00:38:18
nit: you don't need to wrap this with the construc
chrishtr_gmail.com
2013/12/03 00:44:08
Done.
|
| + new TracedDebugInfo(debug_info)); |
| + else |
| + return NULL; |
| +} |
| + |
| std::string WebLayerImpl::DebugName() { |
| if (!web_layer_client_) |
| return std::string(); |