Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index 7a23e6618a9dd8dba589f35c5e2e9f08a56e2d31..bd9a2d7b21e220c3ff93f4e866d2599d8b709a6f 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/debug/trace_event_argument.h" |
#include "base/json/json_reader.h" |
#include "base/strings/stringprintf.h" |
#include "cc/animation/animation_registrar.h" |
@@ -1390,7 +1391,7 @@ void LayerImpl::RemoveDependentNeedsPushProperties() { |
parent_->RemoveDependentNeedsPushProperties(); |
} |
-void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
+void LayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
state, |
@@ -1398,50 +1399,75 @@ void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
LayerTypeAsString(), |
this); |
state->SetInteger("layer_id", id()); |
- state->Set("bounds", MathUtil::AsValue(bounds_).release()); |
- state->Set("position", MathUtil::AsValue(position_).release()); |
+ state->BeginDictionary("bounds"); |
+ MathUtil::AddToTracedValue(bounds_, state); |
+ state->EndDictionary(); |
+ |
+ state->BeginArray("position"); |
+ MathUtil::AddToTracedValue(position_, state); |
+ state->EndArray(); |
+ |
state->SetInteger("draws_content", DrawsContent()); |
state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
- state->Set("scroll_offset", MathUtil::AsValue(scroll_offset_).release()); |
- state->Set("transform_origin", |
- MathUtil::AsValue(transform_origin_).release()); |
+ |
+ state->BeginArray("scroll_offset"); |
+ MathUtil::AddToTracedValue(scroll_offset_, state); |
+ state->EndArray(); |
+ |
+ state->BeginArray("transform_origin"); |
+ MathUtil::AddToTracedValue(transform_origin_, state); |
+ state->EndArray(); |
bool clipped; |
gfx::QuadF layer_quad = MathUtil::MapQuad( |
screen_space_transform(), |
gfx::QuadF(gfx::Rect(content_bounds())), |
&clipped); |
- state->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); |
- |
+ state->BeginArray("layer_quad"); |
+ MathUtil::AddToTracedValue(layer_quad, state); |
+ state->EndArray(); |
if (!touch_event_handler_region_.IsEmpty()) { |
- state->Set("touch_event_handler_region", |
- touch_event_handler_region_.AsValue().release()); |
+ state->BeginArray("touch_event_handler_region"); |
+ touch_event_handler_region_.AsValueInto(state); |
+ state->EndArray(); |
} |
if (have_wheel_event_handlers_) { |
gfx::Rect wheel_rect(content_bounds()); |
Region wheel_region(wheel_rect); |
- state->Set("wheel_event_handler_region", |
- wheel_region.AsValue().release()); |
+ state->BeginArray("wheel_event_handler_region"); |
+ wheel_region.AsValueInto(state); |
+ state->EndArray(); |
} |
if (have_scroll_event_handlers_) { |
gfx::Rect scroll_rect(content_bounds()); |
Region scroll_region(scroll_rect); |
- state->Set("scroll_event_handler_region", |
- scroll_region.AsValue().release()); |
+ state->BeginArray("scroll_event_handler_region"); |
+ scroll_region.AsValueInto(state); |
+ state->EndArray(); |
} |
if (!non_fast_scrollable_region_.IsEmpty()) { |
- state->Set("non_fast_scrollable_region", |
- non_fast_scrollable_region_.AsValue().release()); |
+ state->BeginArray("non_fast_scrollable_region"); |
+ non_fast_scrollable_region_.AsValueInto(state); |
+ state->EndArray(); |
} |
- scoped_ptr<base::ListValue> children_list(new base::ListValue()); |
- for (size_t i = 0; i < children_.size(); ++i) |
- children_list->Append(children_[i]->AsValue().release()); |
- state->Set("children", children_list.release()); |
- if (mask_layer_) |
- state->Set("mask_layer", mask_layer_->AsValue().release()); |
- if (replica_layer_) |
- state->Set("replica_layer", replica_layer_->AsValue().release()); |
+ state->BeginArray("children"); |
+ for (size_t i = 0; i < children_.size(); ++i) { |
+ state->BeginDictionary(); |
+ children_[i]->AsValueInto(state); |
+ state->EndDictionary(); |
+ } |
+ state->EndArray(); |
+ if (mask_layer_) { |
+ state->BeginDictionary("mask_layer"); |
+ mask_layer_->AsValueInto(state); |
+ state->EndDictionary(); |
+ } |
+ if (replica_layer_) { |
+ state->BeginDictionary("replica_layer"); |
+ replica_layer_->AsValueInto(state); |
+ state->EndDictionary(); |
+ } |
if (scroll_parent_) |
state->SetInteger("scroll_parent", scroll_parent_->id()); |
@@ -1457,8 +1483,11 @@ void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
layer_animation_controller()->HasAnimationThatInflatesBounds()); |
gfx::BoxF box; |
- if (LayerUtils::GetAnimationBounds(*this, &box)) |
- state->Set("animation_bounds", MathUtil::AsValue(box).release()); |
+ if (LayerUtils::GetAnimationBounds(*this, &box)) { |
+ state->BeginArray("animation_bounds"); |
+ MathUtil::AddToTracedValue(box, state); |
+ state->EndArray(); |
+ } |
if (debug_info_.get()) { |
std::string str; |
@@ -1471,7 +1500,10 @@ void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
bool converted_to_dictionary = |
debug_info_value->GetAsDictionary(&dictionary_value); |
DCHECK(converted_to_dictionary); |
- state->MergeDictionary(dictionary_value); |
+ for (base::DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd(); |
+ it.Advance()) { |
+ state->SetValue(it.key().data(), it.value().DeepCopy()); |
+ } |
} else { |
NOTREACHED(); |
} |
@@ -1485,12 +1517,6 @@ bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const { |
size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
-scoped_ptr<base::Value> LayerImpl::AsValue() const { |
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
- AsValueInto(state.get()); |
- return state.PassAs<base::Value>(); |
-} |
- |
void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
benchmark->RunOnLayer(this); |
} |