| Index: content/renderer/render_widget.cc
|
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
|
| index b44c0f720b1ee01250a1afca997ca48cad9844cc..47fa6c9e7dfb59261e43ee84eb6eab5dea334833 100644
|
| --- a/content/renderer/render_widget.cc
|
| +++ b/content/renderer/render_widget.cc
|
| @@ -562,6 +562,34 @@ 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 (is_accelerated_compositing_active_ &&
|
| + RenderThreadImpl::current()->compositor_message_loop_proxy().get()) {
|
| + DCHECK(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::ScheduleCompositeWithForcedRedraw() {
|
| if (compositor_) {
|
| // Regardless of whether threaded compositing is enabled, always
|
| @@ -570,7 +598,7 @@ void RenderWidget::ScheduleCompositeWithForcedRedraw() {
|
| // non-threaded case.
|
| compositor_->SetNeedsForcedRedraw();
|
| }
|
| - scheduleComposite();
|
| + ScheduleComposite();
|
| }
|
|
|
| bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
|
| @@ -805,9 +833,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();
|
| }
|
| }
|
|
|
| @@ -967,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() {
|
| @@ -1923,30 +1949,15 @@ 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));
|
| - }
|
| -}
|
| +// Renamed. Staged for removal.
|
| +void RenderWidget::scheduleAnimation() { scheduleUpdate(); }
|
|
|
| -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::scheduleUpdate() {
|
| + if (is_accelerated_compositing_active_) {
|
| + DCHECK(compositor_);
|
| + compositor_->setNeedsUpdateLayers();
|
| + } else {
|
| + ScheduleAnimation();
|
| }
|
| }
|
|
|
| @@ -2352,7 +2363,7 @@ void RenderWidget::SetDeviceScaleFactor(float device_scale_factor) {
|
| if (!is_accelerated_compositing_active_) {
|
| didInvalidateRect(gfx::Rect(size_.width(), size_.height()));
|
| } else {
|
| - scheduleComposite();
|
| + ScheduleComposite();
|
| }
|
| }
|
|
|
|
|