Chromium Code Reviews| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); | |
|
ajuma
2014/07/08 18:45:32
Like the previous line, this needs to happen only
skobes
2014/07/08 21:21:58
Done.
| |
| 80 SetNeedsPushProperties(); | 81 SetNeedsPushProperties(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 LayerImpl::~LayerImpl() { | 84 LayerImpl::~LayerImpl() { |
| 84 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); | 85 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); |
| 85 | 86 |
| 86 layer_animation_controller_->RemoveValueObserver(this); | 87 layer_animation_controller_->RemoveValueObserver(this); |
| 87 layer_animation_controller_->remove_value_provider(this); | 88 layer_animation_controller_->remove_value_provider(this); |
|
ajuma
2014/07/08 18:45:32
The animation delegate needs to be cleared here (i
skobes
2014/07/08 21:21:58
Done.
| |
| 88 | 89 |
| 89 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) | 90 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) |
| 90 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); | 91 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); |
| 91 layer_tree_impl_->UnregisterLayer(this); | 92 layer_tree_impl_->UnregisterLayer(this); |
| 92 | 93 |
| 93 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 94 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 94 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); | 95 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); |
| 95 } | 96 } |
| 96 | 97 |
| 97 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { | 98 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 | 1486 |
| 1486 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1487 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1487 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1488 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1488 AsValueInto(state.get()); | 1489 AsValueInto(state.get()); |
| 1489 return state.PassAs<base::Value>(); | 1490 return state.PassAs<base::Value>(); |
| 1490 } | 1491 } |
| 1491 | 1492 |
| 1492 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1493 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1493 benchmark->RunOnLayer(this); | 1494 benchmark->RunOnLayer(this); |
| 1494 } | 1495 } |
| 1496 | |
| 1497 void LayerImpl::NotifyAnimationFinished( | |
| 1498 base::TimeTicks monotonic_time, | |
| 1499 Animation::TargetProperty target_property) { | |
| 1500 if (target_property == Animation::ScrollOffset) | |
| 1501 layer_tree_impl_->ScrollOffsetAnimationFinished(); | |
| 1502 } | |
| 1503 | |
| 1495 } // namespace cc | 1504 } // namespace cc |
| OLD | NEW |