Chromium Code Reviews| Index: ui/compositor/compositor.cc |
| diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc |
| index 6d5e1f1c5b43062db046dc736af49697ff2b4467..4004a537804e6c6062a2ab858fdaf027fe536cdb 100644 |
| --- a/ui/compositor/compositor.cc |
| +++ b/ui/compositor/compositor.cc |
| @@ -131,7 +131,10 @@ Compositor::Compositor(CompositorDelegate* delegate, |
| widget_(widget), |
| root_web_layer_(WebKit::WebLayer::create()), |
| swap_posted_(false), |
| - device_scale_factor_(0.0f) { |
| + device_scale_factor_(0.0f), |
| + last_started_frame_(0), |
| + last_ended_frame_(0), |
| + disable_schedule_composite_(false) { |
| WebKit::WebLayerTreeView::Settings settings; |
| CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| settings.showFPSCounter = |
| @@ -178,9 +181,11 @@ void Compositor::Terminate() { |
| void Compositor::ScheduleDraw() { |
| if (g_compositor_thread) { |
| + disable_schedule_composite_ = true; |
|
piman
2012/06/06 20:17:24
nit: it's probably not useful to do this here, sin
jonathan.backer
2012/06/06 20:31:43
Thanks. Tried to squeeze this in before a meeting.
|
| // TODO(nduca): Temporary while compositor calls |
| // compositeImmediately() directly. |
| layout(); |
| + disable_schedule_composite_ = false; |
| host_.composite(); |
| } else if (delegate_) { |
| delegate_->ScheduleDraw(); |
| @@ -204,6 +209,8 @@ void Compositor::Draw(bool force_clear) { |
| if (!root_layer_) |
| return; |
| + last_started_frame_++; |
| + |
| // TODO(nduca): Temporary while compositor calls |
| // compositeImmediately() directly. |
| layout(); |
| @@ -290,8 +297,12 @@ void Compositor::updateAnimations(double frameBeginTime) { |
| } |
| 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. |
| + disable_schedule_composite_ = true; |
| if (root_layer_) |
| root_layer_->SendDamagedRects(); |
| + disable_schedule_composite_ = false; |
| } |
| void Compositor::applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
| @@ -323,7 +334,8 @@ void Compositor::didCompleteSwapBuffers() { |
| } |
| void Compositor::scheduleComposite() { |
| - ScheduleDraw(); |
| + if (!disable_schedule_composite_) |
| + ScheduleDraw(); |
| } |
| void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
| @@ -350,6 +362,7 @@ void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
| } |
| void Compositor::NotifyEnd() { |
| + last_ended_frame_++; |
| FOR_EACH_OBSERVER(CompositorObserver, |
| observer_list_, |
| OnCompositingEnded(this)); |