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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 13613003: cc: Make animations tick regardless of drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop extra statemachine function Created 7 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/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index d38df8b35eaea7e6871a0568075edd44797279c8..68083c24dafe6019465669ab945cdfbb997c1e47 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -112,6 +112,9 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now());
+ layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true);
+ bool start_ready_animations = true;
+ layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
layer_tree_host_impl_->BeginNextFrame();
}
@@ -675,7 +678,11 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
return draw_frame;
}
-void LayerTreeHostImpl::SetBackgroundTickingEnabled(bool enabled) {
+void LayerTreeHostImpl::UpdateBackgroundAnimateTicking(
+ bool should_background_tick) {
+ bool enabled = should_background_tick &&
+ !animation_registrar_->active_animation_controllers().empty();
+
// Lazily create the time_source adapter so that we can vary the interval for
// testing.
if (!time_source_client_adapter_) {
@@ -1042,7 +1049,6 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
DidDrawDamagedArea();
}
active_tree_->root_layer()->ResetAllChangeTrackingForSubtree();
- UpdateAnimationState();
}
void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) {
@@ -1247,10 +1253,6 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
return;
renderer_->SetVisible(visible);
-
- SetBackgroundTickingEnabled(
- !visible_ &&
- !animation_registrar_->active_animation_controllers().empty());
}
bool LayerTreeHostImpl::InitializeRenderer(
@@ -1822,12 +1824,9 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time,
(*iter).second->Animate(monotonic_seconds);
client_->SetNeedsRedrawOnImplThread();
- SetBackgroundTickingEnabled(
- !visible_ &&
- !animation_registrar_->active_animation_controllers().empty());
}
-void LayerTreeHostImpl::UpdateAnimationState() {
+void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
if (!settings_.accelerated_animation_enabled ||
animation_registrar_->active_animation_controllers().empty() ||
!active_tree_->root_layer())
@@ -1841,7 +1840,7 @@ void LayerTreeHostImpl::UpdateAnimationState() {
for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
iter != copy.end();
++iter)
- (*iter).second->UpdateState(events.get());
+ (*iter).second->UpdateState(start_ready_animations, events.get());
if (!events->empty()) {
client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass(),
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698