diff options
author | chrishtr@gmail.com <chrishtr@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 03:53:22 +0000 |
---|---|---|
committer | chrishtr@gmail.com <chrishtr@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 03:53:22 +0000 |
commit | 9f3be435e302cbbb2ba263fc98b00aa3faa2d5ca (patch) | |
tree | 1580c45ae974f37c4894fb727e50e07d6c7972a9 /webkit/renderer/compositor_bindings | |
parent | 35ecbac2d35afa5ac9dc02098375931e7dc73f68 (diff) | |
download | chromium_src-9f3be435e302cbbb2ba263fc98b00aa3faa2d5ca.zip chromium_src-9f3be435e302cbbb2ba263fc98b00aa3faa2d5ca.tar.gz chromium_src-9f3be435e302cbbb2ba263fc98b00aa3faa2d5ca.tar.bz2 |
Plumbing for layout rectangle debug info. Companion to
https://code.google.com/p/chromium/issues/detail?id=314945
Patch from Chris Harrelson <chrishtr@gmail.com>
BUG=314945
..
..
Plumbing for for layout rectangle debug information.
BUG=
Review URL: https://codereview.chromium.org/61883006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/renderer/compositor_bindings')
-rw-r--r-- | webkit/renderer/compositor_bindings/web_layer_impl.cc | 34 | ||||
-rw-r--r-- | webkit/renderer/compositor_bindings/web_layer_impl.h | 8 |
2 files changed, 42 insertions, 0 deletions
diff --git a/webkit/renderer/compositor_bindings/web_layer_impl.cc b/webkit/renderer/compositor_bindings/web_layer_impl.cc index 950f76e..fdf719e 100644 --- a/webkit/renderer/compositor_bindings/web_layer_impl.cc +++ b/webkit/renderer/compositor_bindings/web_layer_impl.cc @@ -5,7 +5,9 @@ #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 "base/threading/thread_checker.h" #include "cc/animation/animation.h" #include "cc/base/region.h" #include "cc/layers/layer.h" @@ -13,6 +15,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 +375,37 @@ 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 { + DCHECK(thread_checker_.CalledOnValidThread()); + blink::WebString web_string; + debug_info_->appendAsTraceFormat(&web_string); + out->append(web_string.utf8()); + } + private: + virtual ~TracedDebugInfo() {} + scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; + base::ThreadChecker thread_checker_; +}; + +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 new TracedDebugInfo(debug_info); + else + return NULL; +} + std::string WebLayerImpl::DebugName() { if (!web_layer_client_) return std::string(); diff --git a/webkit/renderer/compositor_bindings/web_layer_impl.h b/webkit/renderer/compositor_bindings/web_layer_impl.h index abccf8f..e189a70 100644 --- a/webkit/renderer/compositor_bindings/web_layer_impl.h +++ b/webkit/renderer/compositor_bindings/web_layer_impl.h @@ -35,6 +35,12 @@ class WebLayerClient; struct WebFloatRect; } +namespace base { +namespace debug { +class ConvertableToTraceFormat; +} +} + namespace webkit { class WebToCCAnimationDelegateAdapter; @@ -125,6 +131,8 @@ class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { // LayerClient implementation. virtual std::string DebugName() OVERRIDE; + virtual scoped_refptr<base::debug::ConvertableToTraceFormat> + TakeDebugInfo() OVERRIDE; virtual void setScrollParent(blink::WebLayer* parent); virtual void setClipParent(blink::WebLayer* parent); |