diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-17 01:46:31 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-17 01:46:31 +0000 |
commit | 0bc1f571fa6242ec413b70d2a10cbbfd07fedd63 (patch) | |
tree | 6762939d087045eb565528ba4442d66193c66fee /content/renderer | |
parent | ce6206d90233a1bc0f732242c5afe70ff52dc448 (diff) | |
download | chromium_src-0bc1f571fa6242ec413b70d2a10cbbfd07fedd63.zip chromium_src-0bc1f571fa6242ec413b70d2a10cbbfd07fedd63.tar.gz chromium_src-0bc1f571fa6242ec413b70d2a10cbbfd07fedd63.tar.bz2 |
Avoid sending empty OnRepaint msgs and propagate window damage correctly
This fixes two issues related to OnRepaint (window damage) messages:
1.) In the case of a renderer-resized widget, the browser's information about
the size of the widget could be out of date. If the browser widget was asked to
paint in compositing mode before it received the proper size it could send a
ViewMsg_OnRepaint with 0x0 size and then set repaint_ack_pending_, expecting the
renderer to reply. The renderer wasn't actually replying with a frame since
damaging a 0x0 rect doesn't actually require painting anything. This suppresses
sending the OnRepaint message if the browser's size is 0x0. Either the size will
at some point become 0x0, triggering a repaint, or the user will never see it.
2.) In compositing mode on the renderer side we weren't plumbing the OnRepaint
window damage rect properly in to the compositor. Thus the compositor could end
up not producing a frame after receiving an OnRepaint message, confusing the
browser rate limiting logic greatly.
BUG=230766
Review URL: https://codereview.chromium.org/13926009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194510 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/gpu/render_widget_compositor.cc | 4 | ||||
-rw-r--r-- | content/renderer/gpu/render_widget_compositor.h | 2 | ||||
-rw-r--r-- | content/renderer/render_widget.cc | 14 | ||||
-rw-r--r-- | content/renderer/render_widget.h | 2 |
4 files changed, 16 insertions, 6 deletions
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index fc2cadd..47587c0 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -334,6 +334,10 @@ void RenderWidgetCompositor::SetOverdrawBottomHeight( layer_tree_host_->SetOverdrawBottomHeight(overdraw_bottom_height); } +void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { + layer_tree_host_->SetNeedsRedrawRect(damage_rect); +} + bool RenderWidgetCompositor::initialize(cc::LayerTreeSettings settings) { scoped_ptr<cc::Thread> impl_thread; scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h index a442526..76686da 100644 --- a/content/renderer/gpu/render_widget_compositor.h +++ b/content/renderer/gpu/render_widget_compositor.h @@ -11,6 +11,7 @@ #include "cc/trees/layer_tree_settings.h" #include "skia/ext/refptr.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" +#include "ui/gfx/rect.h" class SkPicture; @@ -39,6 +40,7 @@ class RenderWidgetCompositor : public WebKit::WebLayerTreeView, bool enable_showing, bool animate); void SetOverdrawBottomHeight(float overdraw_bottom_height); + void SetNeedsRedrawRect(gfx::Rect damage_rect); // WebLayerTreeView implementation. virtual void setSurfaceReady(); diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index f58b8a0..01f9089 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -1871,16 +1871,20 @@ bool RenderWidget::OnSnapshotHelper(const gfx::Rect& src_subrect, return true; } -void RenderWidget::OnRepaint(const gfx::Size& size_to_paint) { +void RenderWidget::OnRepaint(gfx::Size size_to_paint) { // During shutdown we can just ignore this message. if (!webwidget_) return; + // Even if the browser provides an empty damage rect, it's still expecting to + // receive a repaint ack so just damage the entire widget bounds. + if (size_to_paint.IsEmpty()) { + size_to_paint = size_; + } + set_next_paint_is_repaint_ack(); - if (is_accelerated_compositing_active_) { - if (compositor_) - compositor_->setNeedsRedraw(); - scheduleComposite(); + if (is_accelerated_compositing_active_ && compositor_) { + compositor_->SetNeedsRedrawRect(gfx::Rect(size_to_paint)); } else { gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); didInvalidateRect(repaint_rect); diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index 47c8ca4..f3b0f03 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -308,7 +308,7 @@ class CONTENT_EXPORT RenderWidget int tag, const gfx::Size& page_size, const gfx::Size& desired_size); - void OnRepaint(const gfx::Size& size_to_paint); + void OnRepaint(gfx::Size size_to_paint); void OnSmoothScrollCompleted(int gesture_id); void OnSetTextDirection(WebKit::WebTextDirection direction); void OnGetFPS(); |