Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index f8882291dd32f9a0b1e6451b0d23485091f77786..092300b08a48725f889f57bd823b3d830465d498 100644 |
--- a/cc/layers/layer_impl.cc |
+++ b/cc/layers/layer_impl.cc |
@@ -5,6 +5,7 @@ |
#include "cc/layers/layer_impl.h" |
#include "base/debug/trace_event.h" |
+#include "base/json/json_reader.h" |
#include "base/strings/stringprintf.h" |
#include "cc/animation/animation_registrar.h" |
#include "cc/animation/scrollbar_animation_controller.h" |
@@ -155,6 +156,11 @@ void LayerImpl::SetScrollParent(LayerImpl* parent) { |
scroll_parent_ = parent; |
} |
+void LayerImpl::SetDebugInfo( |
+ scoped_refptr<base::debug::ConvertableToTraceFormat> other) { |
+ debug_info_ = other; |
+} |
+ |
void LayerImpl::SetScrollChildren(std::set<LayerImpl*>* children) { |
if (scroll_children_.get() == children) |
return; |
@@ -590,6 +596,8 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) { |
// Reset any state that should be cleared for the next update. |
stacking_order_changed_ = false; |
update_rect_ = gfx::RectF(); |
+ |
+ layer->SetDebugInfo(debug_info_); |
} |
base::DictionaryValue* LayerImpl::LayerTreeAsJson() const { |
@@ -1364,6 +1372,19 @@ void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
if (layer_animation_controller_->AnimatedBoundsForBox(box, &inflated)) |
state->Set("animated_bounds", MathUtil::AsValue(inflated).release()); |
} |
+ |
+ if (debug_info_.get()) { |
+ std::string str; |
+ debug_info_->AppendAsTraceFormat(&str); |
+ base::JSONReader json_reader; |
+ // Parsing the JSON and re-encoding it is not very efficient, |
+ // but it's the simplest way to achieve the desired effect, which |
+ // is to output: |
+ // {..., layout_rects: [{geometry_rect: ...}, ...], ...} |
+ // rather than: |
+ // {layout_rects: "[{geometry_rect: ...}, ...]", ...} |
+ state->Set("layout_rects", json_reader.ReadToValue(str)); |
+ } |
} |
size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |