Index: cc/layers/layer.cc |
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
index 56b8c739e4f24004b59bf8a138f3cd3606cb7bf9..c605e0dc9e1ec5da2c69f9ede347e6f103df8066 100644 |
--- a/cc/layers/layer.cc |
+++ b/cc/layers/layer.cc |
@@ -34,6 +34,8 @@ namespace cc { |
base::StaticAtomicSequenceNumber g_next_layer_id; |
+bool g_compositor_animation_timelines_enabled = false; |
+ |
scoped_refptr<Layer> Layer::Create() { |
return make_scoped_refptr(new Layer()); |
} |
@@ -83,9 +85,11 @@ Layer::Layer() |
raster_scale_(0.f), |
client_(nullptr), |
frame_timing_requests_dirty_(false) { |
- layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
- layer_animation_controller_->AddValueObserver(this); |
- layer_animation_controller_->set_value_provider(this); |
+ if (!g_compositor_animation_timelines_enabled) { |
+ layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
+ layer_animation_controller_->AddValueObserver(this); |
+ layer_animation_controller_->set_value_provider(this); |
+ } |
} |
Layer::~Layer() { |
@@ -96,8 +100,10 @@ Layer::~Layer() { |
// reference to us. |
DCHECK(!layer_tree_host()); |
- layer_animation_controller_->RemoveValueObserver(this); |
- layer_animation_controller_->remove_value_provider(this); |
+ if (layer_animation_controller_) { |
+ layer_animation_controller_->RemoveValueObserver(this); |
+ layer_animation_controller_->remove_value_provider(this); |
+ } |
RemoveFromScrollTree(); |
RemoveFromClipTree(); |
@@ -136,9 +142,7 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
replica_layer_->SetLayerTreeHost(host); |
if (host) { |
- layer_animation_controller_->SetAnimationRegistrar( |
- host->animation_registrar()); |
- |
+ RegisterForAnimations(host->animation_registrar(), host->settings()); |
danakj
2015/05/08 18:21:40
if (layer_animation_controller_)?
loyso (OOO)
2015/05/11 06:59:42
Done in RegisterForAnimations.
|
if (host->settings().layer_transforms_should_scale_layer_contents) |
reset_raster_scale_to_unknown(); |
} |
@@ -1349,7 +1353,13 @@ bool Layer::IsActive() const { |
return true; |
} |
+// static |
+void Layer::SetCompositorAnimationTimelinesEnabled(bool enabled) { |
+ g_compositor_animation_timelines_enabled = enabled; |
+} |
+ |
bool Layer::AddAnimation(scoped_ptr <Animation> animation) { |
+ DCHECK(layer_animation_controller_); |
if (!layer_animation_controller_->animation_registrar()) |
return false; |
@@ -1394,13 +1404,20 @@ bool Layer::HasActiveAnimation() const { |
return layer_animation_controller_->HasActiveAnimation(); |
} |
+void Layer::RegisterForAnimations(AnimationRegistrar* registrar, |
+ const LayerTreeSettings& settings) { |
danakj
2015/05/08 18:21:40
why are settings coming here but not being used?
loyso (OOO)
2015/05/11 06:59:43
Sorry, the CL was in inconsistent state (while pro
|
+ layer_animation_controller_->SetAnimationRegistrar(registrar); |
+} |
+ |
void Layer::AddLayerAnimationEventObserver( |
LayerAnimationEventObserver* animation_observer) { |
+ DCHECK(layer_animation_controller_); |
layer_animation_controller_->AddEventObserver(animation_observer); |
} |
void Layer::RemoveLayerAnimationEventObserver( |
LayerAnimationEventObserver* animation_observer) { |
+ DCHECK(layer_animation_controller_); |
layer_animation_controller_->RemoveEventObserver(animation_observer); |
} |