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

Unified Diff: cc/animation/animation_host.cc

Issue 2554773002: CC Animation: Rename Active Players to Ticking Players. (Closed)
Patch Set: Rename the argument. Created 4 years 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_host.h ('k') | cc/animation/animation_player.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/animation_host.cc
diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc
index cc68c340502ab1839bc0bff2d2c69da5880a1841..5d30516a53c3289fed11f5e317c4cded11484bca 100644
--- a/cc/animation/animation_host.cc
+++ b/cc/animation/animation_host.cc
@@ -157,7 +157,7 @@ void AnimationHost::UnregisterPlayerForElement(ElementId element_id,
element_animations->SetAnimationHost(nullptr);
}
- DeactivateAnimationPlayer(player);
+ RemoveFromTicking(player);
}
void AnimationHost::SetMutatorHostClient(MutatorHostClient* client) {
@@ -270,44 +270,44 @@ bool AnimationHost::SupportsScrollAnimations() const {
return supports_scroll_animations_;
}
-bool AnimationHost::NeedsAnimateLayers() const {
- return !active_players_.empty();
+bool AnimationHost::NeedsTickAnimations() const {
+ return !ticking_players_.empty();
}
bool AnimationHost::ActivateAnimations() {
- if (!NeedsAnimateLayers())
+ if (!NeedsTickAnimations())
return false;
TRACE_EVENT0("cc", "AnimationHost::ActivateAnimations");
- PlayersList active_active_players_copy = active_players_;
- for (auto& it : active_active_players_copy)
+ PlayersList ticking_players_copy = ticking_players_;
+ for (auto& it : ticking_players_copy)
it->ActivateAnimations();
return true;
}
-bool AnimationHost::AnimateLayers(base::TimeTicks monotonic_time) {
- if (!NeedsAnimateLayers())
+bool AnimationHost::TickAnimations(base::TimeTicks monotonic_time) {
+ if (!NeedsTickAnimations())
return false;
- TRACE_EVENT0("cc", "AnimationHost::AnimateLayers");
- PlayersList active_active_players_copy = active_players_;
- for (auto& it : active_active_players_copy)
- it->Animate(monotonic_time);
+ TRACE_EVENT0("cc", "AnimationHost::TickAnimations");
+ PlayersList ticking_players_copy = ticking_players_;
+ for (auto& it : ticking_players_copy)
+ it->Tick(monotonic_time);
return true;
}
bool AnimationHost::UpdateAnimationState(bool start_ready_animations,
MutatorEvents* mutator_events) {
- if (!NeedsAnimateLayers())
+ if (!NeedsTickAnimations())
return false;
auto animation_events = static_cast<AnimationEvents*>(mutator_events);
TRACE_EVENT0("cc", "AnimationHost::UpdateAnimationState");
- PlayersList active_active_players_copy = active_players_;
- for (auto& it : active_active_players_copy)
+ PlayersList ticking_players_copy = ticking_players_;
+ for (auto& it : ticking_players_copy)
it->UpdateState(start_ready_animations, animation_events);
return true;
@@ -326,9 +326,8 @@ void AnimationHost::SetAnimationEvents(
++event_index) {
ElementId element_id = events->events_[event_index].element_id;
- // Use the map of all ElementAnimations, not just active ones, since
- // non-active ElementAnimations may still receive events for impl-only
- // animations.
+ // Use the map of all ElementAnimations, not just ticking players, since
+ // non-ticking Players may still receive events for impl-only animations.
const ElementToAnimationsMap& all_element_animations =
element_to_animations_map_;
auto iter = all_element_animations.find(element_id);
@@ -520,9 +519,9 @@ bool AnimationHost::HasAnyAnimation(ElementId element_id) const {
return element_animations ? element_animations->HasAnyAnimation() : false;
}
-bool AnimationHost::HasActiveAnimationForTesting(ElementId element_id) const {
+bool AnimationHost::HasTickingAnimationForTesting(ElementId element_id) const {
auto element_animations = GetElementAnimationsForElementId(element_id);
- return element_animations ? element_animations->HasActiveAnimation() : false;
+ return element_animations ? element_animations->HasTickingAnimation() : false;
}
void AnimationHost::ImplOnlyScrollAnimationCreate(
@@ -557,28 +556,26 @@ void AnimationHost::ScrollAnimationAbort(bool needs_completion) {
return scroll_offset_animations_impl_->ScrollAnimationAbort(needs_completion);
}
-void AnimationHost::ActivateAnimationPlayer(
- scoped_refptr<AnimationPlayer> player) {
- DCHECK(std::find(active_players_.begin(), active_players_.end(), player) ==
- active_players_.end());
- active_players_.push_back(player);
+void AnimationHost::AddToTicking(scoped_refptr<AnimationPlayer> player) {
+ DCHECK(std::find(ticking_players_.begin(), ticking_players_.end(), player) ==
+ ticking_players_.end());
+ ticking_players_.push_back(player);
}
-void AnimationHost::DeactivateAnimationPlayer(
- scoped_refptr<AnimationPlayer> player) {
+void AnimationHost::RemoveFromTicking(scoped_refptr<AnimationPlayer> player) {
auto to_erase =
- std::find(active_players_.begin(), active_players_.end(), player);
- if (to_erase != active_players_.end())
- active_players_.erase(to_erase);
+ std::find(ticking_players_.begin(), ticking_players_.end(), player);
+ if (to_erase != ticking_players_.end())
+ ticking_players_.erase(to_erase);
}
-const AnimationHost::PlayersList& AnimationHost::active_players_for_testing()
+const AnimationHost::PlayersList& AnimationHost::ticking_players_for_testing()
const {
- return active_players_;
+ return ticking_players_;
}
const AnimationHost::ElementToAnimationsMap&
-AnimationHost::all_element_animations_for_testing() const {
+AnimationHost::element_animations_for_testing() const {
return element_to_animations_map_;
}
« no previous file with comments | « cc/animation/animation_host.h ('k') | cc/animation/animation_player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698