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

Unified Diff: cc/animation/animation_player.cc

Issue 2291463003: Revert "CC Animation: Introduce some dirty flags to optimize PushProperties on commit" (Closed)
Patch Set: Created 4 years, 4 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 05c6c3f739a4e270e91496f307640b43e05e2cea..4cbd2a027aa23f0c8d1af605ef48d56d72a963d7 100644
--- a/cc/animation/animation_player.cc
+++ b/cc/animation/animation_player.cc
@@ -22,8 +22,7 @@ AnimationPlayer::AnimationPlayer(int id)
animation_timeline_(),
element_animations_(),
animation_delegate_(),
- id_(id),
- needs_push_properties_(false) {
+ id_(id) {
DCHECK(id_);
}
@@ -105,16 +104,15 @@ void AnimationPlayer::BindElementAnimations() {
DCHECK(element_animations_);
// Pass all accumulated animations to ElementAnimations.
- for (auto& animation : animations_)
+ for (auto& animation : animations_) {
element_animations_->AddAnimation(std::move(animation));
+ }
+ if (!animations_.empty())
+ SetNeedsCommit();
animations_.clear();
-
- SetNeedsPushProperties();
}
void AnimationPlayer::UnbindElementAnimations() {
- SetNeedsPushProperties();
-
element_animations_ = nullptr;
DCHECK(animations_.empty());
}
@@ -125,7 +123,7 @@ void AnimationPlayer::AddAnimation(std::unique_ptr<Animation> animation) {
if (element_animations_) {
element_animations_->AddAnimation(std::move(animation));
- SetNeedsPushProperties();
+ SetNeedsCommit();
} else {
animations_.push_back(std::move(animation));
}
@@ -135,13 +133,13 @@ void AnimationPlayer::PauseAnimation(int animation_id, double time_offset) {
DCHECK(element_animations_);
element_animations_->PauseAnimation(
animation_id, base::TimeDelta::FromSecondsD(time_offset));
- SetNeedsPushProperties();
+ SetNeedsCommit();
}
void AnimationPlayer::RemoveAnimation(int animation_id) {
if (element_animations_) {
element_animations_->RemoveAnimation(animation_id);
- SetNeedsPushProperties();
+ SetNeedsCommit();
} else {
auto animations_to_remove = std::remove_if(
animations_.begin(), animations_.end(),
@@ -155,14 +153,14 @@ void AnimationPlayer::RemoveAnimation(int animation_id) {
void AnimationPlayer::AbortAnimation(int animation_id) {
DCHECK(element_animations_);
element_animations_->AbortAnimation(animation_id);
- SetNeedsPushProperties();
+ SetNeedsCommit();
}
void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property,
bool needs_completion) {
if (element_animations_) {
element_animations_->AbortAnimations(target_property, needs_completion);
- SetNeedsPushProperties();
+ SetNeedsCommit();
} else {
auto animations_to_remove = std::remove_if(
animations_.begin(), animations_.end(),
@@ -174,10 +172,6 @@ void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property,
}
void AnimationPlayer::PushPropertiesTo(AnimationPlayer* player_impl) {
- if (!needs_push_properties_)
- return;
- needs_push_properties_ = false;
-
if (element_id_ != player_impl->element_id()) {
if (player_impl->element_id())
player_impl->DetachElement();
@@ -213,19 +207,11 @@ void AnimationPlayer::NotifyAnimationAborted(
group);
}
-void AnimationPlayer::NotifyAnimationWaitingForDeletion() {
- // We need to purge animations marked for deletion.
- SetNeedsPushProperties();
-}
-
void AnimationPlayer::NotifyAnimationTakeover(
base::TimeTicks monotonic_time,
TargetProperty::Type target_property,
double animation_start_time,
std::unique_ptr<AnimationCurve> curve) {
- // We need to purge animations marked for deletion on CT.
- SetNeedsPushProperties();
-
if (animation_delegate_) {
DCHECK(curve);
animation_delegate_->NotifyAnimationTakeover(
@@ -234,14 +220,10 @@ void AnimationPlayer::NotifyAnimationTakeover(
}
}
-void AnimationPlayer::SetNeedsPushProperties() {
- needs_push_properties_ = true;
-
- DCHECK(animation_timeline_);
- animation_timeline_->SetNeedsPushProperties();
-
- DCHECK(element_animations_);
- element_animations_->SetNeedsPushProperties();
+void AnimationPlayer::SetNeedsCommit() {
+ DCHECK(animation_host_);
+ animation_host_->SetNeedsCommit();
+ animation_host_->SetNeedsRebuildPropertyTrees();
}
} // namespace cc
« 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