Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index 17512f263c2a9fe29376d460b10eec1b871e21c6..5121b4807b151ef1d88527eb73429d58d0802de6 100644 |
| --- a/content/renderer/render_widget.cc |
| +++ b/content/renderer/render_widget.cc |
| @@ -558,6 +558,33 @@ void RenderWidget::OnShowHostContextMenu(ContextMenuParams* params) { |
| screen_metrics_emulator_->OnShowContextMenu(params); |
| } |
| +void RenderWidget::ScheduleAnimation() { |
| + if (animation_update_pending_) |
| + return; |
| + |
| + TRACE_EVENT0("gpu", "RenderWidget::ScheduleAnimation"); |
| + animation_update_pending_ = true; |
| + if (!animation_timer_.IsRunning()) { |
| + animation_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(0), this, |
| + &RenderWidget::AnimationCallback); |
| + } |
| +} |
| + |
| +void RenderWidget::ScheduleComposite() { |
| + if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() && |
| + compositor_) { |
| + compositor_->setNeedsAnimate(); |
|
danakj
2013/12/05 18:28:16
git cl format
trchen
2013/12/06 03:42:39
Done.
|
| + } else { |
| + // TODO(nduca): replace with something a little less hacky. The reason this |
| + // hack is still used is because the Invalidate-DoDeferredUpdate loop |
| + // contains a lot of host-renderer synchronization logic that is still |
| + // important for the accelerated compositing case. The option of simply |
| + // duplicating all that code is less desirable than "faking out" the |
| + // invalidation path using a magical damage rect. |
| + didInvalidateRect(WebRect(0, 0, 1, 1)); |
| + } |
| +} |
| + |
| void RenderWidget::ScheduleCompositeWithForcedRedraw() { |
| if (compositor_) { |
| // Regardless of whether threaded compositing is enabled, always |
| @@ -566,7 +593,7 @@ void RenderWidget::ScheduleCompositeWithForcedRedraw() { |
| // non-threaded case. |
| compositor_->SetNeedsForcedRedraw(); |
| } |
| - scheduleComposite(); |
| + ScheduleComposite(); |
| } |
| bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
| @@ -801,9 +828,7 @@ void RenderWidget::OnWasShown(bool needs_repainting) { |
| if (!is_accelerated_compositing_active_) { |
| didInvalidateRect(gfx::Rect(size_.width(), size_.height())); |
| } else { |
| - if (compositor_) |
| - compositor_->SetNeedsForcedRedraw(); |
| - scheduleComposite(); |
| + ScheduleCompositeWithForcedRedraw(); |
| } |
| } |
| @@ -968,7 +993,7 @@ void RenderWidget::OnSwapBuffersAborted() { |
| num_swapbuffers_complete_pending_ = 0; |
| using_asynchronous_swapbuffers_ = false; |
| // Schedule another frame so the compositor learns about it. |
| - scheduleComposite(); |
| + ScheduleComposite(); |
| } |
| void RenderWidget::OnSwapBuffersPosted() { |
| @@ -1915,31 +1940,14 @@ void RenderWidget::didCompleteSwapBuffers() { |
| need_update_rect_for_auto_resize_ = false; |
| } |
| -void RenderWidget::scheduleComposite() { |
| - if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() && |
| - compositor_) { |
| - compositor_->setNeedsAnimate(); |
| - } else { |
| - // TODO(nduca): replace with something a little less hacky. The reason this |
| - // hack is still used is because the Invalidate-DoDeferredUpdate loop |
| - // contains a lot of host-renderer synchronization logic that is still |
| - // important for the accelerated compositing case. The option of simply |
| - // duplicating all that code is less desirable than "faking out" the |
| - // invalidation path using a magical damage rect. |
| - didInvalidateRect(WebRect(0, 0, 1, 1)); |
| - } |
| -} |
| - |
| -void RenderWidget::scheduleAnimation() { |
| - if (animation_update_pending_) |
| - return; |
| +// Renamed. Staged for removal. |
| +void RenderWidget::scheduleAnimation() { scheduleUpdate(); } |
| - TRACE_EVENT0("gpu", "RenderWidget::scheduleAnimation"); |
| - animation_update_pending_ = true; |
| - if (!animation_timer_.IsRunning()) { |
| - animation_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(0), this, |
| - &RenderWidget::AnimationCallback); |
| - } |
| +void RenderWidget::scheduleUpdate() { |
| + if (compositor_) |
| + compositor_->setNeedsUpdateLayers(); |
| + else |
| + ScheduleAnimation(); |
| } |
| void RenderWidget::didChangeCursor(const WebCursorInfo& cursor_info) { |
| @@ -2344,7 +2352,7 @@ void RenderWidget::SetDeviceScaleFactor(float device_scale_factor) { |
| if (!is_accelerated_compositing_active_) { |
| didInvalidateRect(gfx::Rect(size_.width(), size_.height())); |
| } else { |
| - scheduleComposite(); |
| + ScheduleComposite(); |
| } |
| } |