Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: content/renderer/render_widget.cc

Issue 133263004: Unifies LayerTreeHost::SetNeedsUpdateLayers and SetNeedsAnimate -- V2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mojo build Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/shell/renderer/test_runner/WebTestProxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 184e76a4dca69895367327d16d254c28bde8e1ab..42afb410d5dd1aa1d3211bcdb7cde3a1f1cab6a7 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -566,6 +566,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
@@ -574,7 +602,7 @@ void RenderWidget::ScheduleCompositeWithForcedRedraw() {
// non-threaded case.
compositor_->SetNeedsForcedRedraw();
}
- scheduleComposite();
+ ScheduleComposite();
}
bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
@@ -811,9 +839,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();
}
}
@@ -973,7 +999,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() {
@@ -1935,30 +1961,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));
- }
-}
-
-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 (is_accelerated_compositing_active_) {
+ DCHECK(compositor_);
+ compositor_->setNeedsUpdateLayers();
+ } else {
+ ScheduleAnimation();
}
}
@@ -2364,7 +2375,7 @@ void RenderWidget::SetDeviceScaleFactor(float device_scale_factor) {
if (!is_accelerated_compositing_active_) {
didInvalidateRect(gfx::Rect(size_.width(), size_.height()));
} else {
- scheduleComposite();
+ ScheduleComposite();
}
}
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/shell/renderer/test_runner/WebTestProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698