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

Unified Diff: cc/animation/animation_player.cc

Issue 1922833002: CC Animation: Start replacing int layer_id with ElementId element_id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/animation_player.h ('k') | cc/animation/animation_player_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/animation_player.cc
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc
index 698c6ed2e1e6f9bc071a7001cb26bf3980057ee0..54fc75623d0fd4dd23b8aeaa8228f7ed6c20f605 100644
--- a/cc/animation/animation_player.cc
+++ b/cc/animation/animation_player.cc
@@ -21,7 +21,7 @@ AnimationPlayer::AnimationPlayer(int id)
element_animations_(),
layer_animation_delegate_(),
id_(id),
- layer_id_(0) {
+ element_id_(0) {
DCHECK(id_);
}
@@ -45,21 +45,21 @@ void AnimationPlayer::SetAnimationTimeline(AnimationTimeline* timeline) {
// We need to unregister player to manage ElementAnimations and observers
// properly.
- if (layer_id_ && element_animations_)
+ if (element_id_ && element_animations_)
UnregisterPlayer();
animation_timeline_ = timeline;
// Register player only if layer AND host attached.
- if (layer_id_ && animation_host_)
+ if (element_id_ && animation_host_)
RegisterPlayer();
}
-void AnimationPlayer::AttachLayer(int layer_id) {
- DCHECK_EQ(layer_id_, 0);
- DCHECK(layer_id);
+void AnimationPlayer::AttachLayer(ElementId element_id) {
+ DCHECK_EQ(element_id_, 0);
+ DCHECK(element_id);
- layer_id_ = layer_id;
+ element_id_ = element_id;
// Register player only if layer AND host attached.
if (animation_host_)
@@ -67,39 +67,39 @@ void AnimationPlayer::AttachLayer(int layer_id) {
}
void AnimationPlayer::DetachLayer() {
- DCHECK(layer_id_);
+ DCHECK(element_id_);
if (animation_host_)
UnregisterPlayer();
- layer_id_ = 0;
+ element_id_ = 0;
}
void AnimationPlayer::RegisterPlayer() {
- DCHECK(layer_id_);
+ DCHECK(element_id_);
DCHECK(animation_host_);
DCHECK(!element_animations_);
// Create ElementAnimations or re-use existing.
- animation_host_->RegisterPlayerForLayer(layer_id_, this);
+ animation_host_->RegisterPlayerForLayer(element_id_, this);
// Get local reference to shared ElementAnimations.
BindElementAnimations();
}
void AnimationPlayer::UnregisterPlayer() {
- DCHECK(layer_id_);
+ DCHECK(element_id_);
DCHECK(animation_host_);
DCHECK(element_animations_);
UnbindElementAnimations();
// Destroy ElementAnimations or release it if it's still needed.
- animation_host_->UnregisterPlayerForLayer(layer_id_, this);
+ animation_host_->UnregisterPlayerForLayer(element_id_, this);
}
void AnimationPlayer::BindElementAnimations() {
DCHECK(!element_animations_);
element_animations_ =
- animation_host_->GetElementAnimationsForLayerId(layer_id_);
+ animation_host_->GetElementAnimationsForLayerId(element_id_);
DCHECK(element_animations_);
// Pass all accumulated animations to ElementAnimations.
@@ -171,11 +171,11 @@ void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property,
}
void AnimationPlayer::PushPropertiesTo(AnimationPlayer* player_impl) {
- if (layer_id_ != player_impl->layer_id()) {
- if (player_impl->layer_id())
+ if (element_id_ != player_impl->element_id()) {
+ if (player_impl->element_id())
player_impl->DetachLayer();
- if (layer_id_)
- player_impl->AttachLayer(layer_id_);
+ if (element_id_)
+ player_impl->AttachLayer(element_id_);
}
}
« no previous file with comments | « cc/animation/animation_player.h ('k') | cc/animation/animation_player_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698