Index: ui/compositor/layer.cc |
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
index 119a1cfa868390103209691c432da434f32c665f..a777e32caf5976da804d0c585124b3adf2b241e5 100644 |
--- a/ui/compositor/layer.cc |
+++ b/ui/compositor/layer.cc |
@@ -108,6 +108,7 @@ Layer::~Layer() { |
layer_mask_back_link_->SetMaskLayer(NULL); |
for (size_t i = 0; i < children_.size(); ++i) |
children_[i]->parent_ = NULL; |
+ cc_layer_->removeLayerAnimationEventObserver(this); |
cc_layer_->removeFromParent(); |
} |
@@ -430,7 +431,9 @@ void Layer::SetExternalTexture(Texture* texture) { |
DCHECK(parent_->cc_layer_); |
parent_->cc_layer_->replaceChild(cc_layer_, new_layer); |
} |
+ cc_layer_->removeLayerAnimationEventObserver(this); |
cc_layer_= new_layer; |
+ cc_layer_->addLayerAnimationEventObserver(this); |
cc_layer_is_accelerated_ = layer_updated_externally_; |
for (size_t i = 0; i < children_.size(); ++i) { |
DCHECK(children_[i]->cc_layer_); |
@@ -550,6 +553,11 @@ void Layer::SetForceRenderSurface(bool force) { |
cc_layer_->setForceRenderSurface(force_render_surface_); |
} |
+void Layer::OnAnimationStarted(const cc::AnimationEvent& event) { |
+ if (animator_) |
+ animator_->OnThreadedAnimationStarted(event); |
+} |
+ |
void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) { |
DCHECK_NE(child, other); |
DCHECK_EQ(this, child->parent()); |
@@ -741,6 +749,16 @@ SkColor Layer::GetColorForAnimation() const { |
solid_color_layer_->backgroundColor() : SK_ColorBLACK; |
} |
+void Layer::AddThreadedAnimation(scoped_ptr<cc::Animation> animation) { |
+ DCHECK(cc_layer_); |
+ cc_layer_->addAnimation(animation.Pass()); |
+} |
+ |
+void Layer::RemoveThreadedAnimation(int animation_id) { |
+ DCHECK(cc_layer_); |
+ cc_layer_->removeAnimation(animation_id); |
+} |
+ |
void Layer::CreateWebLayer() { |
if (type_ == LAYER_SOLID_COLOR) { |
solid_color_layer_ = cc::SolidColorLayer::create(); |
@@ -753,6 +771,7 @@ void Layer::CreateWebLayer() { |
cc_layer_->setAnchorPoint(gfx::PointF()); |
cc_layer_->setContentsOpaque(true); |
cc_layer_->setIsDrawable(type_ != LAYER_NOT_DRAWN); |
+ cc_layer_->addLayerAnimationEventObserver(this); |
} |
void Layer::RecomputeTransform() { |