Chromium Code Reviews| Index: ui/compositor/compositor.cc |
| diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc |
| index 7a1b2928a8890ac7d73b46511fa8191782788865..d9cdec0586e12c2a8f8ab73bd52dd3ff2fca55ea 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" |
| @@ -97,6 +98,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) { |
| Init(); |
| } |
| @@ -117,6 +119,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) { |
| Init(); |
| } |
| @@ -256,8 +259,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(); |
| @@ -317,6 +322,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. |
| @@ -382,6 +393,10 @@ void Compositor::DidAbortSwapBuffers() { |
| OnCompositingAborted(this)); |
| } |
| +void Compositor::ScheduleAnimationForLayerCollection() { |
| + ScheduleAnimation(); |
|
ajuma
2014/05/26 14:43:23
host_->SetNeedsAnimate()
sadrul
2014/05/28 21:41:22
Done (I assume you meant 'instead of' ScheduleAnim
|
| +} |
| + |
| const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const { |
| return host_->debug_state(); |
| } |