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

Side by Side Diff: cc/animation/element_animations.cc

Issue 1881373002: CC Animation: Erase AnimationRegistrar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@private
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/animation/animation_registrar.cc ('k') | cc/animation/layer_animation_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/animation/element_animations.h" 5 #include "cc/animation/element_animations.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/animation/animation_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DCHECK(!layer_animation_controller_); 70 DCHECK(!layer_animation_controller_);
71 } 71 }
72 72
73 void ElementAnimations::CreateLayerAnimationController(int layer_id) { 73 void ElementAnimations::CreateLayerAnimationController(int layer_id) {
74 DCHECK(layer_id); 74 DCHECK(layer_id);
75 DCHECK(!layer_animation_controller_); 75 DCHECK(!layer_animation_controller_);
76 DCHECK(animation_host_); 76 DCHECK(animation_host_);
77 77
78 layer_animation_controller_ = 78 layer_animation_controller_ =
79 animation_host_->GetAnimationControllerForId(layer_id); 79 animation_host_->GetAnimationControllerForId(layer_id);
80 animation_host_->SetAnimationRegistrarFor(layer_animation_controller_); 80 layer_animation_controller_->SetAnimationHost(animation_host_);
81 layer_animation_controller_->set_layer_animation_delegate(this); 81 layer_animation_controller_->set_layer_animation_delegate(this);
82 layer_animation_controller_->set_value_provider(this); 82 layer_animation_controller_->set_value_provider(this);
83 83
84 DCHECK(animation_host_->mutator_host_client()); 84 DCHECK(animation_host_->mutator_host_client());
85 if (animation_host_->mutator_host_client()->IsLayerInTree( 85 if (animation_host_->mutator_host_client()->IsLayerInTree(
86 layer_id, LayerTreeType::ACTIVE)) 86 layer_id, LayerTreeType::ACTIVE))
87 CreateActiveValueObserver(); 87 CreateActiveValueObserver();
88 if (animation_host_->mutator_host_client()->IsLayerInTree( 88 if (animation_host_->mutator_host_client()->IsLayerInTree(
89 layer_id, LayerTreeType::PENDING)) 89 layer_id, LayerTreeType::PENDING))
90 CreatePendingValueObserver(); 90 CreatePendingValueObserver();
91 } 91 }
92 92
93 void ElementAnimations::DestroyLayerAnimationController() { 93 void ElementAnimations::DestroyLayerAnimationController() {
94 DCHECK(animation_host_); 94 DCHECK(animation_host_);
95 95
96 if (active_value_observer_) 96 if (active_value_observer_)
97 SetTransformIsPotentiallyAnimatingChanged(LayerTreeType::ACTIVE, false); 97 SetTransformIsPotentiallyAnimatingChanged(LayerTreeType::ACTIVE, false);
98 if (pending_value_observer_) 98 if (pending_value_observer_)
99 SetTransformIsPotentiallyAnimatingChanged(LayerTreeType::PENDING, false); 99 SetTransformIsPotentiallyAnimatingChanged(LayerTreeType::PENDING, false);
100 100
101 DestroyPendingValueObserver(); 101 DestroyPendingValueObserver();
102 DestroyActiveValueObserver(); 102 DestroyActiveValueObserver();
103 103
104 if (layer_animation_controller_) { 104 if (layer_animation_controller_) {
105 layer_animation_controller_->remove_value_provider(this); 105 layer_animation_controller_->remove_value_provider(this);
106 layer_animation_controller_->remove_layer_animation_delegate(this); 106 layer_animation_controller_->remove_layer_animation_delegate(this);
107 animation_host_->ResetAnimationRegistrarFor(layer_animation_controller_); 107 layer_animation_controller_->SetAnimationHost(nullptr);
108 layer_animation_controller_ = nullptr; 108 layer_animation_controller_ = nullptr;
109 } 109 }
110 } 110 }
111 111
112 void ElementAnimations::LayerRegistered(int layer_id, LayerTreeType tree_type) { 112 void ElementAnimations::LayerRegistered(int layer_id, LayerTreeType tree_type) {
113 DCHECK(layer_animation_controller_); 113 DCHECK(layer_animation_controller_);
114 DCHECK_EQ(layer_animation_controller_->id(), layer_id); 114 DCHECK_EQ(layer_animation_controller_->id(), layer_id);
115 115
116 if (tree_type == LayerTreeType::ACTIVE) { 116 if (tree_type == LayerTreeType::ACTIVE) {
117 if (!active_value_observer_) 117 if (!active_value_observer_)
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (animation_host()) { 289 if (animation_host()) {
290 DCHECK(animation_host()->mutator_host_client()); 290 DCHECK(animation_host()->mutator_host_client());
291 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( 291 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation(
292 layer_id()); 292 layer_id());
293 } 293 }
294 294
295 return gfx::ScrollOffset(); 295 return gfx::ScrollOffset();
296 } 296 }
297 297
298 } // namespace cc 298 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_registrar.cc ('k') | cc/animation/layer_animation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698