Chromium Code Reviews| Index: cc/layers/layer_impl.cc |
| diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
| index 99f950293ce7da829a371f41af2a36cff9eba440..9af940ffbe360e398e96cb7511cb2100a8259457 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" |
| @@ -153,6 +154,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; |
| @@ -585,6 +591,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 { |
| @@ -1341,6 +1349,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); |
|
enne (OOO)
2013/11/25 20:16:45
You could at least hide this internally with a deb
chrishtr_gmail.com
2013/11/25 22:48:25
Adding AsValue to ConvertableToTraceFormat would w
|
| + 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; } |