Chromium Code Reviews| Index: ui/compositor/compositor.cc |
| diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc |
| index 190a949b3fd27e85ee5f4aea4ec4e430111cd742..6c2bd60f81a25175465c02c620800ef8e50cb6c5 100644 |
| --- a/ui/compositor/compositor.cc |
| +++ b/ui/compositor/compositor.cc |
| @@ -61,14 +61,6 @@ void CompositorLock::CancelLock() { |
| compositor_ = NULL; |
| } |
| -} // namespace ui |
| - |
| -namespace { |
| - |
| -} // namespace |
| - |
| -namespace ui { |
| - |
| Compositor::Compositor(gfx::AcceleratedWidget widget, |
| ui::ContextFactory* context_factory) |
| : context_factory_(context_factory), |
| @@ -81,10 +73,6 @@ Compositor::Compositor(gfx::AcceleratedWidget widget, |
| last_ended_frame_(0), |
|
danakj
2014/06/19 17:20:36
if this is needed, why isn't it important for us t
enne (OOO)
2014/06/19 20:32:28
I'll just remove it. This is a good catch too bec
|
| disable_schedule_composite_(false), |
| compositor_lock_(NULL), |
| - defer_draw_scheduling_(false), |
| - waiting_on_compositing_end_(false), |
| - draw_on_compositing_end_(false), |
| - swap_state_(SWAP_NONE), |
| layer_animator_collection_(this), |
| schedule_draw_factory_(this) { |
|
danakj
2014/06/19 17:20:36
this var can go
enne (OOO)
2014/06/19 20:32:28
Done.
|
| root_web_layer_ = cc::Layer::Create(); |
| @@ -170,14 +158,7 @@ Compositor::~Compositor() { |
| } |
| void Compositor::ScheduleDraw() { |
| - if (compositor_thread_loop_) { |
| - host_->SetNeedsCommit(); |
| - } else if (!defer_draw_scheduling_) { |
| - defer_draw_scheduling_ = true; |
| - base::MessageLoop::current()->PostTask( |
| - FROM_HERE, |
| - base::Bind(&Compositor::Draw, schedule_draw_factory_.GetWeakPtr())); |
| - } |
| + host_->SetNeedsCommit(); |
| } |
| void Compositor::SetRootLayer(Layer* root_layer) { |
| @@ -198,37 +179,6 @@ void Compositor::SetHostHasTransparentBackground( |
| host_->set_has_transparent_background(host_has_transparent_background); |
| } |
| -void Compositor::Draw() { |
| - DCHECK(!compositor_thread_loop_); |
| - |
| - defer_draw_scheduling_ = false; |
| - if (waiting_on_compositing_end_) { |
| - draw_on_compositing_end_ = true; |
| - return; |
| - } |
| - waiting_on_compositing_end_ = true; |
| - |
| - TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1); |
| - |
| - if (!root_layer_) |
| - return; |
| - |
| - DCHECK_NE(swap_state_, SWAP_POSTED); |
| - swap_state_ = SWAP_NONE; |
| - |
| - last_started_frame_++; |
| - if (!IsLocked()) { |
| - // TODO(nduca): Temporary while compositor calls |
| - // compositeImmediately() directly. |
| - base::TimeTicks now = gfx::FrameTime::Now(); |
| - Animate(now); |
| - Layout(); |
| - host_->Composite(now); |
| - } |
| - if (swap_state_ == SWAP_NONE) |
| - NotifyEnd(); |
| -} |
| - |
| void Compositor::ScheduleFullRedraw() { |
| host_->SetNeedsRedraw(); |
| } |
| @@ -317,38 +267,16 @@ void Compositor::DidCommitAndDrawFrame() { |
| } |
| void Compositor::DidCompleteSwapBuffers() { |
| - if (compositor_thread_loop_) { |
| - NotifyEnd(); |
| - } else { |
| - DCHECK_EQ(swap_state_, SWAP_POSTED); |
| - NotifyEnd(); |
| - swap_state_ = SWAP_COMPLETED; |
| - } |
| -} |
| - |
| -void Compositor::ScheduleComposite() { |
| - if (!disable_schedule_composite_) |
| - ScheduleDraw(); |
| -} |
| - |
| -void Compositor::ScheduleAnimation() { |
| - ScheduleComposite(); |
| + last_ended_frame_++; |
| + TRACE_EVENT_ASYNC_END0("ui", "Compositor::Draw", last_ended_frame_); |
| + FOR_EACH_OBSERVER( |
| + CompositorObserver, observer_list_, OnCompositingEnded(this)); |
| } |
| void Compositor::DidPostSwapBuffers() { |
| - DCHECK(!compositor_thread_loop_); |
| - DCHECK_EQ(swap_state_, SWAP_NONE); |
| - swap_state_ = SWAP_POSTED; |
| } |
| void Compositor::DidAbortSwapBuffers() { |
| - if (!compositor_thread_loop_) { |
| - if (swap_state_ == SWAP_POSTED) { |
| - NotifyEnd(); |
| - swap_state_ = SWAP_COMPLETED; |
| - } |
| - } |
| - |
| FOR_EACH_OBSERVER(CompositorObserver, |
| observer_list_, |
| OnCompositingAborted(this)); |
| @@ -370,8 +298,7 @@ void Compositor::SetLayerTreeDebugState( |
| scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { |
| if (!compositor_lock_) { |
| compositor_lock_ = new CompositorLock(this); |
| - if (compositor_thread_loop_) |
| - host_->SetDeferCommits(true); |
| + host_->SetDeferCommits(true); |
| FOR_EACH_OBSERVER(CompositorObserver, |
| observer_list_, |
| OnCompositingLockStateChanged(this)); |
| @@ -382,8 +309,7 @@ scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { |
| void Compositor::UnlockCompositor() { |
| DCHECK(compositor_lock_); |
| compositor_lock_ = NULL; |
| - if (compositor_thread_loop_) |
| - host_->SetDeferCommits(false); |
| + host_->SetDeferCommits(false); |
| FOR_EACH_OBSERVER(CompositorObserver, |
| observer_list_, |
| OnCompositingLockStateChanged(this)); |
| @@ -394,21 +320,4 @@ void Compositor::CancelCompositorLock() { |
| compositor_lock_->CancelLock(); |
| } |
| -void Compositor::NotifyEnd() { |
| - last_ended_frame_++; |
| - TRACE_EVENT_ASYNC_END0("ui", "Compositor::Draw", last_ended_frame_); |
| - waiting_on_compositing_end_ = false; |
| - if (draw_on_compositing_end_) { |
| - draw_on_compositing_end_ = false; |
| - |
| - // Call ScheduleDraw() instead of Draw() in order to allow other |
| - // CompositorObservers to be notified before starting another |
| - // draw cycle. |
| - ScheduleDraw(); |
| - } |
| - FOR_EACH_OBSERVER(CompositorObserver, |
| - observer_list_, |
| - OnCompositingEnded(this)); |
| -} |
| - |
| } // namespace ui |