OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 num_dependents_need_push_properties_(0), | 68 num_dependents_need_push_properties_(0), |
69 sorting_context_id_(0), | 69 sorting_context_id_(0), |
70 current_draw_mode_(DRAW_MODE_NONE) { | 70 current_draw_mode_(DRAW_MODE_NONE) { |
71 DCHECK_GT(layer_id_, 0); | 71 DCHECK_GT(layer_id_, 0); |
72 DCHECK(layer_tree_impl_); | 72 DCHECK(layer_tree_impl_); |
73 layer_tree_impl_->RegisterLayer(this); | 73 layer_tree_impl_->RegisterLayer(this); |
74 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); | 74 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); |
75 layer_animation_controller_ = | 75 layer_animation_controller_ = |
76 registrar->GetAnimationControllerForId(layer_id_); | 76 registrar->GetAnimationControllerForId(layer_id_); |
77 layer_animation_controller_->AddValueObserver(this); | 77 layer_animation_controller_->AddValueObserver(this); |
78 if (IsActive()) | 78 if (IsActive()) { |
79 layer_animation_controller_->set_value_provider(this); | 79 layer_animation_controller_->set_value_provider(this); |
| 80 layer_animation_controller_->set_layer_animation_delegate(this); |
| 81 } |
80 SetNeedsPushProperties(); | 82 SetNeedsPushProperties(); |
81 } | 83 } |
82 | 84 |
83 LayerImpl::~LayerImpl() { | 85 LayerImpl::~LayerImpl() { |
84 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); | 86 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); |
85 | 87 |
86 layer_animation_controller_->RemoveValueObserver(this); | 88 layer_animation_controller_->RemoveValueObserver(this); |
87 layer_animation_controller_->remove_value_provider(this); | 89 layer_animation_controller_->remove_value_provider(this); |
| 90 layer_animation_controller_->remove_layer_animation_delegate(this); |
88 | 91 |
89 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) | 92 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) |
90 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); | 93 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); |
91 layer_tree_impl_->UnregisterLayer(this); | 94 layer_tree_impl_->UnregisterLayer(this); |
92 | 95 |
93 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 96 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
94 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); | 97 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); |
95 } | 98 } |
96 | 99 |
97 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { | 100 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 | 1487 |
1485 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1488 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1486 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1489 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1487 AsValueInto(state.get()); | 1490 AsValueInto(state.get()); |
1488 return state.PassAs<base::Value>(); | 1491 return state.PassAs<base::Value>(); |
1489 } | 1492 } |
1490 | 1493 |
1491 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1494 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1492 benchmark->RunOnLayer(this); | 1495 benchmark->RunOnLayer(this); |
1493 } | 1496 } |
| 1497 |
| 1498 void LayerImpl::NotifyAnimationFinished( |
| 1499 base::TimeTicks monotonic_time, |
| 1500 Animation::TargetProperty target_property) { |
| 1501 if (target_property == Animation::ScrollOffset) |
| 1502 layer_tree_impl_->InputScrollAnimationFinished(); |
| 1503 } |
| 1504 |
1494 } // namespace cc | 1505 } // namespace cc |
OLD | NEW |