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

Unified Diff: cc/layer_tree_host.cc

Issue 11830056: Enable accelerated animations for orphaned layers (Closed) Base URL: http://git.chromium.org/chromium/src.git@MakeLayerTreeHostAnimateLayersTakeWallClockTime
Patch Set: Created 7 years, 11 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
Index: cc/layer_tree_host.cc
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 44833e72ec30c0458846626996c9dc5d533ce00a..6062aae6c520c63a40aa608c062aa6babe17a1e4 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -89,8 +89,9 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
, m_backgroundColor(SK_ColorWHITE)
, m_hasTransparentBackground(false)
, m_partialTextureUpdateRequests(0)
- , m_animationRegistrar(AnimationRegistrar::create())
{
+ if (m_settings.acceleratedAnimationEnabled)
+ m_animationRegistrar = AnimationRegistrar::create();
numLayerTreeInstances++;
}
@@ -867,9 +868,16 @@ void LayerTreeHost::animateLayers(base::TimeTicks monotonicTime, base::Time wall
double monotonicTimeInSeconds = (monotonicTime - base::TimeTicks()).InSecondsF();
+ scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->active_animation_controllers();
for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(); ++iter)
- (*iter).second->animate(monotonicTimeInSeconds, 0);
+ if ((*iter).second->hasNonOrphanedObserver())
+ (*iter).second->animate(monotonicTimeInSeconds, 0);
+ else
+ (*iter).second->animate(monotonicTimeInSeconds, events.get());
+
+ if (!events->empty())
+ setAnimationEvents(events.Pass(), wallClockTime);
}
void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& events, Layer* layer, base::Time wallClockTime)

Powered by Google App Engine
This is Rietveld 408576698