OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DCHECK_GT(layer_id_, 0); | 62 DCHECK_GT(layer_id_, 0); |
63 DCHECK(layer_tree_impl_); | 63 DCHECK(layer_tree_impl_); |
64 layer_tree_impl_->RegisterLayer(this); | 64 layer_tree_impl_->RegisterLayer(this); |
65 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); | 65 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); |
66 layer_animation_controller_ = | 66 layer_animation_controller_ = |
67 registrar->GetAnimationControllerForId(layer_id_); | 67 registrar->GetAnimationControllerForId(layer_id_); |
68 layer_animation_controller_->AddValueObserver(this); | 68 layer_animation_controller_->AddValueObserver(this); |
69 } | 69 } |
70 | 70 |
71 LayerImpl::~LayerImpl() { | 71 LayerImpl::~LayerImpl() { |
| 72 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 73 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); |
72 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); | 74 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); |
73 | 75 |
74 layer_tree_impl_->UnregisterLayer(this); | 76 layer_tree_impl_->UnregisterLayer(this); |
75 layer_animation_controller_->RemoveValueObserver(this); | 77 layer_animation_controller_->RemoveValueObserver(this); |
76 } | 78 } |
77 | 79 |
78 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { | 80 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { |
79 child->set_parent(this); | 81 child->set_parent(this); |
80 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); | 82 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); |
81 children_.push_back(child.Pass()); | 83 children_.push_back(child.Pass()); |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 "has a composited background"); | 1108 "has a composited background"); |
1107 } | 1109 } |
1108 | 1110 |
1109 if (reasons & kCompositingReasonLayerForMask) | 1111 if (reasons & kCompositingReasonLayerForMask) |
1110 reason_list->AppendString("Is a mask layer"); | 1112 reason_list->AppendString("Is a mask layer"); |
1111 | 1113 |
1112 return reason_list.PassAs<base::Value>(); | 1114 return reason_list.PassAs<base::Value>(); |
1113 } | 1115 } |
1114 | 1116 |
1115 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { | 1117 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
1116 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); | 1118 TracedValue::MakeDictIntoImplicitSnapshot( |
| 1119 TRACE_DISABLED_BY_DEFAULT("cc.debug"), state, LayerTypeAsString(), this); |
1117 state->SetInteger("layer_id", id()); | 1120 state->SetInteger("layer_id", id()); |
1118 state->Set("bounds", MathUtil::AsValue(bounds()).release()); | 1121 state->Set("bounds", MathUtil::AsValue(bounds()).release()); |
1119 state->SetInteger("draws_content", DrawsContent()); | 1122 state->SetInteger("draws_content", DrawsContent()); |
1120 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 1123 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
1121 state->Set("compositing_reasons", | 1124 state->Set("compositing_reasons", |
1122 CompositingReasonsAsValue(compositing_reasons_).release()); | 1125 CompositingReasonsAsValue(compositing_reasons_).release()); |
1123 | 1126 |
1124 bool clipped; | 1127 bool clipped; |
1125 gfx::QuadF layer_quad = MathUtil::MapQuad( | 1128 gfx::QuadF layer_quad = MathUtil::MapQuad( |
1126 screen_space_transform(), | 1129 screen_space_transform(), |
(...skipping 14 matching lines...) Expand all Loading... |
1141 | 1144 |
1142 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1145 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1143 | 1146 |
1144 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1147 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1145 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1148 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1146 AsValueInto(state.get()); | 1149 AsValueInto(state.get()); |
1147 return state.PassAs<base::Value>(); | 1150 return state.PassAs<base::Value>(); |
1148 } | 1151 } |
1149 | 1152 |
1150 } // namespace cc | 1153 } // namespace cc |
OLD | NEW |