Index: content/renderer/render_widget.cc |
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
index ca73dfea0d4df883853532ce28e4b69d691cc631..8d0f2c15b68b0220f57e2d1c74fced3d7e5d98c8 100644 |
--- a/content/renderer/render_widget.cc |
+++ b/content/renderer/render_widget.cc |
@@ -247,40 +247,15 @@ bool RenderWidget::Send(IPC::Message* message) { |
return RenderThread::Get()->Send(message); |
} |
-// Got a response from the browser after the renderer decided to create a new |
-// view. |
-void RenderWidget::OnCreatingNewAck( |
- gfx::NativeViewId parent) { |
- DCHECK(routing_id_ != MSG_ROUTING_NONE); |
- |
- CompleteInit(parent); |
-} |
- |
-void RenderWidget::OnClose() { |
- if (closing_) |
- return; |
- closing_ = true; |
- |
- // Browser correspondence is no longer needed at this point. |
- if (routing_id_ != MSG_ROUTING_NONE) { |
- RenderThread::Get()->RemoveRoute(routing_id_); |
- SetHidden(false); |
- } |
- |
- // If there is a Send call on the stack, then it could be dangerous to close |
- // now. Post a task that only gets invoked when there are no nested message |
- // loops. |
- MessageLoop::current()->PostNonNestableTask( |
- FROM_HERE, base::Bind(&RenderWidget::Close, this)); |
- |
- // Balances the AddRef taken when we called AddRoute. |
- Release(); |
-} |
- |
-void RenderWidget::OnResize(const gfx::Size& new_size, |
- const gfx::Rect& resizer_rect, |
- bool is_fullscreen) { |
- // During shutdown we can just ignore this message. |
+void RenderWidget::Resize(const gfx::Size& new_size, |
+ const gfx::Rect& resizer_rect, |
+ bool is_fullscreen, |
+ ResizeAck resize_ack) { |
+ // A resize ack shouldn't be requested if we have not ACK'd the previous one. |
+ DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); |
+ DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); |
+ |
+ // Ignore this during shutdown. |
if (!webwidget_) |
return; |
@@ -300,9 +275,6 @@ void RenderWidget::OnResize(const gfx::Size& new_size, |
size_ = new_size; |
- // We should not be sent a Resize message if we have not ACK'd the previous |
- DCHECK(!next_paint_is_resize_ack()); |
- |
paint_aggregator_.ClearPendingUpdate(); |
// When resizing, we want to wait to paint before ACK'ing the resize. This |
@@ -315,13 +287,55 @@ void RenderWidget::OnResize(const gfx::Size& new_size, |
DCHECK(paint_aggregator_.HasPendingUpdate()); |
} |
- // We will send the Resize_ACK flag once we paint again. |
- set_next_paint_is_resize_ack(); |
+ // Send the Resize_ACK flag once we paint again if requested. |
+ if (resize_ack == SEND_RESIZE_ACK) |
+ set_next_paint_is_resize_ack(); |
} |
} |
if (fullscreen_change) |
DidToggleFullscreen(); |
+ |
+ // If a resize ack is requested and it isn't set-up, then no more resizes will |
+ // come in and in general things will go wrong. |
+ DCHECK(resize_ack != SEND_RESIZE_ACK || new_size.IsEmpty() || |
+ next_paint_is_resize_ack()); |
+} |
+ |
+void RenderWidget::OnClose() { |
+ if (closing_) |
+ return; |
+ closing_ = true; |
+ |
+ // Browser correspondence is no longer needed at this point. |
+ if (routing_id_ != MSG_ROUTING_NONE) { |
+ RenderThread::Get()->RemoveRoute(routing_id_); |
+ SetHidden(false); |
+ } |
+ |
+ // If there is a Send call on the stack, then it could be dangerous to close |
+ // now. Post a task that only gets invoked when there are no nested message |
+ // loops. |
+ MessageLoop::current()->PostNonNestableTask( |
+ FROM_HERE, base::Bind(&RenderWidget::Close, this)); |
+ |
+ // Balances the AddRef taken when we called AddRoute. |
+ Release(); |
+} |
+ |
+// Got a response from the browser after the renderer decided to create a new |
+// view. |
+void RenderWidget::OnCreatingNewAck( |
+ gfx::NativeViewId parent) { |
+ DCHECK(routing_id_ != MSG_ROUTING_NONE); |
+ |
+ CompleteInit(parent); |
+} |
+ |
+void RenderWidget::OnResize(const gfx::Size& new_size, |
+ const gfx::Rect& resizer_rect, |
+ bool is_fullscreen) { |
+ Resize(new_size, resizer_rect, is_fullscreen, SEND_RESIZE_ACK); |
} |
void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { |