diff options
5 files changed, 40 insertions, 10 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 68ab496..0ad619d 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -495,6 +495,11 @@ void BrowserPluginGuest::OnResizeGuest( } SetDamageBuffer(params); web_contents()->GetView()->SizeContents(params.view_size); + if (params.repaint) { + web_contents()->GetRenderViewHost()->Send(new ViewMsg_Repaint( + web_contents()->GetRenderViewHost()->GetRoutingID(), + params.view_size)); + } } void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) { @@ -678,7 +683,7 @@ void BrowserPluginGuest::OnUpdateRect( relay_params.needs_ack = params.needs_ack; // HW accelerated case, acknowledge resize only - if (!params.needs_ack) { + if (!params.needs_ack || !damage_buffer_) { relay_params.damage_buffer_sequence_id = 0; SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect( embedder_routing_id(), diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 5ab1457..f0b3039 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -99,6 +99,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, bool focused() const { return focused_; } bool visible() const { return visible_; } + void clear_damage_buffer() { damage_buffer_.reset(); } void UpdateVisibility(); diff --git a/content/browser/renderer_host/render_widget_host_view_guest.cc b/content/browser/renderer_host/render_widget_host_view_guest.cc index cbe3afd..8f0cd12 100644 --- a/content/browser/renderer_host/render_widget_host_view_guest.cc +++ b/content/browser/renderer_host/render_widget_host_view_guest.cc @@ -95,6 +95,9 @@ void RenderWidgetHostViewGuest::SetTooltipText(const string16& tooltip_text) { void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped( const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) { + // If accelerated surface buffers are getting swapped then we're not using + // the software path. + guest_->clear_damage_buffer(); guest_->SendMessageToEmbedder( new BrowserPluginMsg_BuffersSwapped( guest_->embedder_routing_id(), diff --git a/content/common/browser_plugin_messages.h b/content/common/browser_plugin_messages.h index 5d33460..9b9352e 100644 --- a/content/common/browser_plugin_messages.h +++ b/content/common/browser_plugin_messages.h @@ -48,6 +48,8 @@ IPC_STRUCT_BEGIN(BrowserPluginHostMsg_ResizeGuest_Params) IPC_STRUCT_MEMBER(gfx::Size, view_size) // Indicates the scale factor of the embedder WebView. IPC_STRUCT_MEMBER(float, scale_factor) + // Indicates a request for a full repaint of the page. + IPC_STRUCT_MEMBER(bool, repaint) IPC_STRUCT_END() IPC_STRUCT_BEGIN(BrowserPluginHostMsg_CreateGuest_Params) diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index 9c8e9ec..6798d96 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc @@ -334,7 +334,7 @@ void BrowserPlugin::SizeChangedDueToAutoSize(const gfx::Size& old_view_size) { // static bool BrowserPlugin::UsesDamageBuffer( const BrowserPluginMsg_UpdateRect_Params& params) { - return params.damage_buffer_sequence_id != 0; + return params.damage_buffer_sequence_id != 0 || params.needs_ack; } bool BrowserPlugin::UsesPendingDamageBuffer( @@ -535,7 +535,7 @@ void BrowserPlugin::OnUpdateRect( bool auto_size = GetAutoSizeAttribute(); // We receive a resize ACK in regular mode, but not in autosize. // In SW, |resize_ack_received_| is reset in SwapDamageBuffers(). - // in HW mode, we need to do it here so we can continue sending + // In HW mode, we need to do it here so we can continue sending // resize messages when needed. if (params.is_resize_ack || (!params.needs_ack && (auto_size || auto_size_ack_pending_))) @@ -630,6 +630,7 @@ void BrowserPlugin::OnUpdateRect( params.copy_rects, current_damage_buffer_->memory()); } + // Invalidate the container. // If the BrowserPlugin is scheduled to be deleted, then container_ will be // NULL so we shouldn't attempt to access it. @@ -838,15 +839,33 @@ void BrowserPlugin::EnableCompositing(bool enable) { if (compositing_enabled_ == enable) return; - if (enable && !compositing_helper_) { - compositing_helper_ = new BrowserPluginCompositingHelper( - container_, - browser_plugin_manager(), - render_view_routing_id_); + compositing_enabled_ = enable; + if (enable) { + // No need to keep the backing store and damage buffer around if we're now + // compositing. + backing_store_.reset(); + current_damage_buffer_.reset(); + if (!compositing_helper_) { + compositing_helper_ = new BrowserPluginCompositingHelper( + container_, + browser_plugin_manager(), + render_view_routing_id_); + } + } else { + // We're switching back to the software path. We create a new damage + // buffer that can accommodate the current size of the container. + BrowserPluginHostMsg_ResizeGuest_Params params; + PopulateResizeGuestParameters(¶ms, gfx::Size(width(), height())); + // Request a full repaint from the guest even if its size is not actually + // changing. + params.repaint = true; + resize_ack_received_ = false; + browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( + render_view_routing_id_, + instance_id_, + params)); } - compositing_helper_->EnableCompositing(enable); - compositing_enabled_ = enable; } void BrowserPlugin::destroy() { |