Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: ui/compositor/layer.cc

Issue 11896017: Thread ui opacity animations (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Correctly deal with sequences meant to start together Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698