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

Unified Diff: cc/animation/animation_host.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_host.h ('k') | cc/animation/animation_host_perftest.cc » ('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 3337253c550f749f9bde920c108eb8bcbf00b250..61489094ce75220abe3115dabc16275306014477 100644
--- a/cc/animation/animation_host.cc
+++ b/cc/animation/animation_host.cc
@@ -43,7 +43,7 @@ AnimationHost::AnimationHost(ThreadInstance thread_instance)
: mutator_host_client_(nullptr),
thread_instance_(thread_instance),
supports_scroll_animations_(false),
- needs_push_properties_(false) {
+ animation_waiting_for_deletion_(false) {
if (thread_instance_ == ThreadInstance::IMPL) {
scroll_offset_animations_impl_ =
base::MakeUnique<ScrollOffsetAnimationsImpl>(this);
@@ -91,7 +91,6 @@ void AnimationHost::AddAnimationTimeline(
timeline->SetAnimationHost(this);
id_to_timeline_map_.insert(
std::make_pair(timeline->id(), std::move(timeline)));
- SetNeedsPushProperties();
}
void AnimationHost::RemoveAnimationTimeline(
@@ -99,7 +98,6 @@ void AnimationHost::RemoveAnimationTimeline(
DCHECK(timeline->id());
EraseTimeline(timeline);
id_to_timeline_map_.erase(timeline->id());
- SetNeedsPushProperties();
}
void AnimationHost::RegisterElement(ElementId element_id,
@@ -161,29 +159,23 @@ void AnimationHost::SetMutatorHostClient(MutatorHostClient* client) {
return;
mutator_host_client_ = client;
+}
- if (needs_push_properties() && mutator_host_client())
- SetNeedsPushProperties();
+void AnimationHost::SetNeedsCommit() {
+ DCHECK(mutator_host_client_);
+ mutator_host_client_->SetMutatorsNeedCommit();
}
-void AnimationHost::SetNeedsPushProperties() {
- if (mutator_host_client_) {
- mutator_host_client_->SetMutatorsNeedCommit();
- // TODO(loyso): Invalidate property trees only if really needed.
- mutator_host_client_->SetMutatorsNeedRebuildPropertyTrees();
- }
- needs_push_properties_ = true;
+void AnimationHost::SetNeedsRebuildPropertyTrees() {
+ DCHECK(mutator_host_client_);
+ mutator_host_client_->SetMutatorsNeedRebuildPropertyTrees();
}
void AnimationHost::PushPropertiesTo(AnimationHost* host_impl) {
- if (needs_push_properties_) {
- needs_push_properties_ = false;
- PushTimelinesToImplThread(host_impl);
- RemoveTimelinesFromImplThread(host_impl);
- PushPropertiesToImplThread(host_impl);
- // This is redundant but used in tests.
- host_impl->needs_push_properties_ = false;
- }
+ PushTimelinesToImplThread(host_impl);
+ RemoveTimelinesFromImplThread(host_impl);
+ PushPropertiesToImplThread(host_impl);
+ animation_waiting_for_deletion_ = false;
}
void AnimationHost::PushTimelinesToImplThread(AnimationHost* host_impl) const {
@@ -220,24 +212,19 @@ void AnimationHost::PushPropertiesToImplThread(AnimationHost* host_impl) {
// to happen before the element animations are synced below.
for (auto& kv : id_to_timeline_map_) {
AnimationTimeline* timeline = kv.second.get();
- if (timeline->needs_push_properties()) {
- AnimationTimeline* timeline_impl =
- host_impl->GetTimelineById(timeline->id());
- if (timeline_impl)
- timeline->PushPropertiesTo(timeline_impl);
- }
+ AnimationTimeline* timeline_impl =
+ host_impl->GetTimelineById(timeline->id());
+ if (timeline_impl)
+ timeline->PushPropertiesTo(timeline_impl);
}
// Sync properties for created ElementAnimations.
for (auto& kv : element_to_animations_map_) {
const auto& element_animations = kv.second;
- if (element_animations->needs_push_properties()) {
- auto element_animations_impl =
- host_impl->GetElementAnimationsForElementId(kv.first);
- if (element_animations_impl)
- element_animations->PushPropertiesTo(
- std::move(element_animations_impl));
- }
+ auto element_animations_impl =
+ host_impl->GetElementAnimationsForElementId(kv.first);
+ if (element_animations_impl)
+ element_animations->PushPropertiesTo(std::move(element_animations_impl));
}
// Update the impl-only scroll offset animations.
@@ -581,4 +568,8 @@ AnimationHost::all_element_animations_for_testing() const {
return element_to_animations_map_;
}
+void AnimationHost::OnAnimationWaitingForDeletion() {
+ animation_waiting_for_deletion_ = true;
+}
+
} // namespace cc
« no previous file with comments | « cc/animation/animation_host.h ('k') | cc/animation/animation_host_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698