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

Unified Diff: ui/compositor/compositor.cc

Issue 291843012: compositor: Tick the UI animations from cc, instead of from timer callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | « ui/compositor/compositor.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 325425cf47d40fce656615e85fdb60a1e79f7401..b511e6d2eb460b562b247db1f12105415607fef1 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -26,6 +26,7 @@
#include "ui/compositor/compositor_vsync_manager.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
+#include "ui/compositor/layer_animator_collection.h"
#include "ui/gfx/frame_time.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_switches.h"
@@ -84,6 +85,7 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
waiting_on_compositing_end_(false),
draw_on_compositing_end_(false),
swap_state_(SWAP_NONE),
+ layer_animator_collection_(this),
schedule_draw_factory_(this) {
root_web_layer_ = cc::Layer::Create();
root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f));
@@ -217,8 +219,10 @@ void Compositor::Draw() {
if (!IsLocked()) {
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
+ base::TimeTicks now = gfx::FrameTime::Now();
+ Animate(now);
Layout();
- host_->Composite(gfx::FrameTime::Now());
+ host_->Composite(now);
}
if (swap_state_ == SWAP_NONE)
NotifyEnd();
@@ -278,6 +282,12 @@ bool Compositor::HasObserver(CompositorObserver* observer) {
return observer_list_.HasObserver(observer);
}
+void Compositor::Animate(base::TimeTicks frame_begin_time) {
+ layer_animator_collection_.Progress(frame_begin_time);
+ if (layer_animator_collection_.HasActiveAnimators())
+ host_->SetNeedsAnimate();
+}
+
void Compositor::Layout() {
// We're sending damage that will be addressed during this composite
// cycle, so we don't need to schedule another composite to address it.
@@ -343,6 +353,10 @@ void Compositor::DidAbortSwapBuffers() {
OnCompositingAborted(this));
}
+void Compositor::ScheduleAnimationForLayerCollection() {
+ host_->SetNeedsAnimate();
+}
+
const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const {
return host_->debug_state();
}
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698