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

Unified Diff: chrome/renderer/render_widget.cc

Issue 6007006: Support for requestAnimationFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 12 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 | « chrome/renderer/render_widget.h ('k') | chrome/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_widget.cc
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 2f145765acd5eb0195223f4e01e4cd675e1c6dbb..5adc812d9b1831417e211e6c843163a55983edeb 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -487,8 +487,7 @@ void RenderWidget::CallDoDeferredUpdate() {
}
void RenderWidget::DoDeferredUpdate() {
- if (!webwidget_ || !paint_aggregator_.HasPendingUpdate() ||
- update_reply_pending())
+ if (!webwidget_ || update_reply_pending())
return;
// Suppress updating when we are hidden.
@@ -498,11 +497,20 @@ void RenderWidget::DoDeferredUpdate() {
return;
}
+ // Request animation updates.
+ // TODO(jamesr): Do we wanna throttle?
+ webwidget_->animate();
+
// Layout may generate more invalidation. It may also enable the
// GPU acceleration, so make sure to run layout before we send the
// GpuRenderingActivated message.
webwidget_->layout();
+ // Suppress painting if nothing is dirty. This has to be done after updating
+ // animations running layout as these may generate further invalidations.
+ if (!paint_aggregator_.HasPendingUpdate())
+ return;
+
// OK, save the pending update to a local since painting may cause more
// invalidation. Some WebCore rendering objects only layout when painted.
PaintAggregator::PendingUpdate update;
@@ -681,6 +689,12 @@ void RenderWidget::scheduleComposite() {
didInvalidateRect(WebRect(0, 0, 1, 1));
}
+void RenderWidget::scheduleAnimation() {
+ // TODO(jamesr): Come up with a more intelligent scheduling algorithm.
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
+ this, &RenderWidget::scheduleComposite));
+}
+
void RenderWidget::didChangeCursor(const WebCursorInfo& cursor_info) {
// TODO(darin): Eliminate this temporary.
WebCursor cursor(cursor_info);
« no previous file with comments | « chrome/renderer/render_widget.h ('k') | chrome/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698