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

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

Issue 1921583003: CC Animation: Let MutatorHostClient deals with elements instead of layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@elementid
Patch Set: Rename methods in ElementAnimations Created 4 years, 7 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_player.h ('k') | cc/animation/animation_player_unittest.cc » ('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/animation_player.h" 5 #include "cc/animation/animation_player.h"
6 6
7 #include "cc/animation/animation_delegate.h" 7 #include "cc/animation/animation_delegate.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/animation/animation_timeline.h" 9 #include "cc/animation/animation_timeline.h"
10 #include "cc/animation/element_animations.h" 10 #include "cc/animation/element_animations.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 element_id_ = 0; 75 element_id_ = 0;
76 } 76 }
77 77
78 void AnimationPlayer::RegisterPlayer() { 78 void AnimationPlayer::RegisterPlayer() {
79 DCHECK(element_id_); 79 DCHECK(element_id_);
80 DCHECK(animation_host_); 80 DCHECK(animation_host_);
81 DCHECK(!element_animations_); 81 DCHECK(!element_animations_);
82 82
83 // Create ElementAnimations or re-use existing. 83 // Create ElementAnimations or re-use existing.
84 animation_host_->RegisterPlayerForLayer(element_id_, this); 84 animation_host_->RegisterPlayerForElement(element_id_, this);
85 // Get local reference to shared ElementAnimations. 85 // Get local reference to shared ElementAnimations.
86 BindElementAnimations(); 86 BindElementAnimations();
87 } 87 }
88 88
89 void AnimationPlayer::UnregisterPlayer() { 89 void AnimationPlayer::UnregisterPlayer() {
90 DCHECK(element_id_); 90 DCHECK(element_id_);
91 DCHECK(animation_host_); 91 DCHECK(animation_host_);
92 DCHECK(element_animations_); 92 DCHECK(element_animations_);
93 93
94 UnbindElementAnimations(); 94 UnbindElementAnimations();
95 // Destroy ElementAnimations or release it if it's still needed. 95 // Destroy ElementAnimations or release it if it's still needed.
96 animation_host_->UnregisterPlayerForLayer(element_id_, this); 96 animation_host_->UnregisterPlayerForElement(element_id_, this);
97 } 97 }
98 98
99 void AnimationPlayer::BindElementAnimations() { 99 void AnimationPlayer::BindElementAnimations() {
100 DCHECK(!element_animations_); 100 DCHECK(!element_animations_);
101 element_animations_ = 101 element_animations_ =
102 animation_host_->GetElementAnimationsForLayerId(element_id_); 102 animation_host_->GetElementAnimationsForElementId(element_id_);
103 DCHECK(element_animations_); 103 DCHECK(element_animations_);
104 104
105 // Pass all accumulated animations to ElementAnimations. 105 // Pass all accumulated animations to ElementAnimations.
106 for (auto& animation : animations_) { 106 for (auto& animation : animations_) {
107 element_animations_->AddAnimation(std::move(animation)); 107 element_animations_->AddAnimation(std::move(animation));
108 } 108 }
109 if (!animations_.empty()) 109 if (!animations_.empty())
110 SetNeedsCommit(); 110 SetNeedsCommit();
111 animations_.clear(); 111 animations_.clear();
112 } 112 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 } 220 }
221 221
222 void AnimationPlayer::SetNeedsCommit() { 222 void AnimationPlayer::SetNeedsCommit() {
223 DCHECK(animation_host_); 223 DCHECK(animation_host_);
224 animation_host_->SetNeedsCommit(); 224 animation_host_->SetNeedsCommit();
225 animation_host_->SetNeedsRebuildPropertyTrees(); 225 animation_host_->SetNeedsRebuildPropertyTrees();
226 } 226 }
227 227
228 } // namespace cc 228 } // namespace cc
OLDNEW
« 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