diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-17 00:09:43 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-17 00:09:43 +0000 |
commit | d5c44c89a2c43cb96c98b90d419c08157895f0b1 (patch) | |
tree | e5381df1e503b2c43ab118399e4372aadda4302d /content/browser/renderer_host | |
parent | 9ee7616fb50b78bdbfb9f95f02903e2435ff5bee (diff) | |
download | chromium_src-d5c44c89a2c43cb96c98b90d419c08157895f0b1.zip chromium_src-d5c44c89a2c43cb96c98b90d419c08157895f0b1.tar.gz chromium_src-d5c44c89a2c43cb96c98b90d419c08157895f0b1.tar.bz2 |
Revert 110355 - Use shared D3D9 texture to transport the compositor's backing buffer to the browser process for presentation.
Implemented ImageTransportSurface for Linux (without texture sharing), XP, Vista and 7. XP. The non-texture sharing Linux and XP paths just present directly to the compositing child window owned by the browser process as before.
PassThroughImageTransportSurface still needs a proper name. I will move it into its own file once that is decided.
I moved AcceleratedSurfaceBuffersSwapped outside of the platform specific ifdefs and made the signature the same on all platforms for greater consistency.
I removed the code related to sharing surfaces between processes and synchronizing resize and swapping out of GpuCommandBufferStub. It is all now in ImageTransportSurface implementations.
Review URL: http://codereview.chromium.org/8060045
TBR=apatrick@chromium.org
Review URL: http://codereview.chromium.org/8587012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host')
13 files changed, 76 insertions, 135 deletions
diff --git a/content/browser/renderer_host/render_widget_host_mac.cc b/content/browser/renderer_host/render_widget_host_mac.cc index 014caec..e264b93 100644 --- a/content/browser/renderer_host/render_widget_host_mac.cc +++ b/content/browser/renderer_host/render_widget_host_mac.cc @@ -4,7 +4,6 @@ #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/common/gpu/gpu_messages.h" void RenderWidgetHost::OnMsgPluginFocusChanged(bool focused, int plugin_id) { if (view_) @@ -65,9 +64,7 @@ void RenderWidgetHost::OnAcceleratedSurfaceBuffersSwapped( // This code path could be updated to implement flow control for // updating of accelerated plugins as well. However, if we add support // for composited plugins then this is not necessary. - GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; - params.window = window; - params.surface_id = surface_id; - view_->AcceleratedSurfaceBuffersSwapped(params, 0); + view_->AcceleratedSurfaceBuffersSwapped(window, surface_id, + 0, 0, 0); } } diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h index b8fd0d6..ac2cac7 100644 --- a/content/browser/renderer_host/render_widget_host_view.h +++ b/content/browser/renderer_host/render_widget_host_view.h @@ -26,8 +26,6 @@ #include "ui/gfx/rect.h" #include "ui/gfx/surface/transport_dib.h" -struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; - class BackingStore; class RenderProcessHost; class RenderWidgetHost; @@ -186,14 +184,6 @@ class RenderWidgetHostView { // Called when accelerated compositing state changes. virtual void OnAcceleratedCompositingStateChange() = 0; - // |params.window| and |params.surface_id| indicate which accelerated - // surface's buffers swapped. |params.renderer_id| and |params.route_id| - // are used to formulate a reply to the GPU process to prevent it from getting - // too far ahead. They may all be zero, in which case no flow control is - // enforced; this case is currently used for accelerated plugins. - virtual void AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) = 0; #if defined(OS_MACOSX) // Tells the view whether or not to accept first responder status. If |flag| @@ -250,6 +240,17 @@ class RenderWidgetHostView { int32 width, int32 height, TransportDIB::Handle transport_dib) = 0; + // |window| and |surface_id| indicate which accelerated surface's + // buffers swapped. |renderer_id| and |route_id| are used to formulate + // a reply to the GPU process to prevent it from getting too far ahead. + // They may all be zero, in which case no flow control is enforced; + // this case is currently used for accelerated plugins. + virtual void AcceleratedSurfaceBuffersSwapped( + gfx::PluginWindowHandle window, + uint64 surface_id, + int renderer_id, + int32 route_id, + int gpu_host_id) = 0; #endif #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) @@ -258,6 +259,10 @@ class RenderWidgetHostView { int32 height, uint64* surface_id, TransportDIB::Handle* surface_handle) = 0; + virtual void AcceleratedSurfaceBuffersSwapped( + uint64 surface_id, + int32 route_id, + int gpu_host_id) = 0; virtual void AcceleratedSurfaceRelease(uint64 surface_id) = 0; #endif diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index c680595..fe07237 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -285,32 +285,6 @@ BackingStore* RenderWidgetHostViewAura::AllocBackingStore( void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { } -void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) { -#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) - window_->layer()->SetExternalTexture( - accelerated_surface_containers_[params.surface_id]->GetTexture()); - glFlush(); - - if (!window_->layer()->GetCompositor()) { - // We have no compositor, so we have no way to display the surface - // Must still send the ACK. - AcknowledgeSwapBuffers(params.route_id, gpu_host_id); - } else { - window_->layer()->ScheduleDraw(); - - // Add sending an ACK to the list of things to do OnCompositingEnded - on_compositing_ended_callbacks_.push_back( - base::Bind(AcknowledgeSwapBuffers, params.route_id, gpu_host_id)); - ui::Compositor* compositor = window_->layer()->GetCompositor(); - if (!compositor->HasObserver(this)) - compositor->AddObserver(this); - } -#else - NOTREACHED(); -#endif -} #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) void RenderWidgetHostViewAura::AcceleratedSurfaceNew( @@ -329,6 +303,29 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceNew( accelerated_surface_containers_[*surface_id] = surface; } +void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( + uint64 surface_id, + int32 route_id, + int gpu_host_id) { + window_->layer()->SetExternalTexture( + accelerated_surface_containers_[surface_id]->GetTexture()); + glFlush(); + + if (!window_->layer()->GetCompositor()) { + // We have no compositor, so we have no way to display the surface + AcknowledgeSwapBuffers(route_id, gpu_host_id); // Must still send the ACK + } else { + window_->layer()->ScheduleDraw(); + + // Add sending an ACK to the list of things to do OnCompositingEnded + on_compositing_ended_callbacks_.push_back( + base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id)); + ui::Compositor* compositor = window_->layer()->GetCompositor(); + if (!compositor->HasObserver(this)) + compositor->AddObserver(this); + } +} + void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(uint64 surface_id) { accelerated_surface_containers_.erase(surface_id); } diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index e654164..495b69b 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -70,15 +70,16 @@ class CONTENT_EXPORT RenderWidgetHostViewAura : public RenderWidgetHostView, virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; - virtual void AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) OVERRIDE; #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) virtual void AcceleratedSurfaceNew( int32 width, int32 height, uint64* surface_id, TransportDIB::Handle* surface_handle) OVERRIDE; + virtual void AcceleratedSurfaceBuffersSwapped( + uint64 surface_id, + int32 route_id, + int gpu_host_id) OVERRIDE; virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; #endif virtual void SetBackground(const SkBitmap& background) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc index 8385b7e1..7fa23c7 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc @@ -1005,12 +1005,6 @@ BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( gtk_widget_get_visual(view_.get())->depth); } -void RenderWidgetHostViewGtk::AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) { - NOTREACHED(); -} - void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) { RenderWidgetHostView::SetBackground(background); host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background)); diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h index 39837e5..7de7cbcd 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.h +++ b/content/browser/renderer_host/render_widget_host_view_gtk.h @@ -95,9 +95,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView, virtual void ShowingContextMenu(bool showing) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; - virtual void AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) OVERRIDE; virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE; virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index d5fcfe1..e2e5963 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -265,7 +265,10 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { int32 height, TransportDIB::Handle transport_dib) OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, + gfx::PluginWindowHandle window, + uint64 surface_id, + int renderer_id, + int32 route_id, int gpu_host_id) OVERRIDE; virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; virtual gfx::Rect GetRootWindowBounds() OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index c5797ee..6cf2cf6 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -865,26 +865,28 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceSetTransportDIB( } void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, + gfx::PluginWindowHandle window, + uint64 surface_id, + int renderer_id, + int32 route_id, int gpu_host_id) { TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped"); CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AcceleratedPluginView* view = ViewForPluginWindowHandle(params.window); + AcceleratedPluginView* view = ViewForPluginWindowHandle(window); DCHECK(view); if (view) { - plugin_container_manager_.SetSurfaceWasPaintedTo(params.window, - params.surface_id); + plugin_container_manager_.SetSurfaceWasPaintedTo(window, surface_id); // The surface is hidden until its first paint, to not show gargabe. - if (plugin_container_manager_.SurfaceShouldBeVisible(params.window)) + if (plugin_container_manager_.SurfaceShouldBeVisible(window)) [view setHidden:NO]; [view drawView]; } - if (params.renderer_id != 0 || params.route_id != 0) { - AcknowledgeSwapBuffers(params.renderer_id, - params.route_id, + if (renderer_id != 0 || route_id != 0) { + AcknowledgeSwapBuffers(renderer_id, + route_id, gpu_host_id); } } diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index 6cb2d77..bca8d95 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm @@ -7,7 +7,6 @@ #include "base/mac/scoped_nsautorelease_pool.h" #include "content/browser/browser_thread_impl.h" #include "content/browser/renderer_host/test_render_view_host.h" -#include "content/common/gpu/gpu_messages.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/test/cocoa_test_event_utils.h" #import "ui/base/test/ui_cocoa_test_helper.h" @@ -58,9 +57,8 @@ class RenderWidgetHostViewMacTest : public RenderViewHostTestHarness { // The accelerated view isn't shown until it has a valid rect and has been // painted to. - GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; - params.window = accelerated_handle; - rwhv_mac_->AcceleratedSurfaceBuffersSwapped(params, 0); + rwhv_mac_->AcceleratedSurfaceBuffersSwapped(accelerated_handle, + 0, 0, 0, 0); webkit::npapi::WebPluginGeometry geom; gfx::Rect rect(0, 0, w, h); geom.window = accelerated_handle; diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 3c87933..59257b0 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "base/bind.h" #include "base/command_line.h" #include "base/i18n/rtl.h" #include "base/metrics/histogram.h" @@ -20,14 +19,11 @@ #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/browser_accessibility_state.h" #include "content/browser/accessibility/browser_accessibility_win.h" -#include "content/browser/gpu/gpu_process_host.h" -#include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/plugin_process_host.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/backing_store_win.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_widget_host.h" -#include "content/common/gpu/gpu_messages.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_thread.h" @@ -58,8 +54,6 @@ #include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/npapi/webplugin_delegate_impl.h" -#pragma comment(lib, "d3d9.lib") - using base::TimeDelta; using base::TimeTicks; using content::BrowserThread; @@ -209,21 +203,6 @@ LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message, return ::DefWindowProc(window, message, wparam, lparam); } -void SendToGpuProcessHost(int gpu_host_id, IPC::Message* message) { - GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); - if (!gpu_process_host) { - delete message; - return; - } - - gpu_process_host->Send(message); -} - -void PostTaskOnIOThread(const tracked_objects::Location& from_here, - base::Closure task) { - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task); -} - bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi, content::PageZoom* zoom, POINT* zoom_center) { @@ -359,9 +338,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { UnlockMouse(); ResetTooltip(); - - if (accelerated_surface_) - accelerated_surface_->Destroy(); } void RenderWidgetHostViewWin::CreateWnd(HWND parent) { @@ -1980,14 +1956,8 @@ static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message, } void RenderWidgetHostViewWin::ScheduleComposite() { - // If we have a previous frame then present it immediately. Otherwise request - // a new frame be composited. - if (accelerated_surface_.get()) { - accelerated_surface_->Present(); - } else { - if (render_widget_host_) - render_widget_host_->ScheduleComposite(); - } + if (render_widget_host_) + render_widget_host_->ScheduleComposite(); } // Creates a HWND within the RenderWidgetHostView that will serve as a host @@ -2083,27 +2053,6 @@ void RenderWidgetHostViewWin::OnAcceleratedCompositingStateChange() { } } -void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) { - if (!accelerated_surface_.get() && compositor_host_window_) { - accelerated_surface_ = new AcceleratedSurface(compositor_host_window_); - accelerated_surface_->Initialize(); - } - - base::Closure acknowledge_task = - base::Bind(SendToGpuProcessHost, - gpu_host_id, - new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); - - accelerated_surface_->AsyncPresentAndAcknowledge( - params.size, - params.surface_id, - base::Bind(PostTaskOnIOThread, - FROM_HERE, - acknowledge_task)); -} - void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) { if (!render_widget_host_) return; diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h index b55e7cc..061eba9 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.h +++ b/content/browser/renderer_host/render_widget_host_view_win.h @@ -27,7 +27,6 @@ #include "ui/base/win/ime_input.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/point.h" -#include "ui/gfx/surface/accelerated_surface_win.h" #include "webkit/glue/webcursor.h" class BackingStore; @@ -202,9 +201,6 @@ class RenderWidgetHostViewWin virtual void SetScrollOffsetPinning( bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; - virtual void AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) OVERRIDE; virtual void OnAccessibilityNotifications( const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params ) OVERRIDE; @@ -347,10 +343,6 @@ class RenderWidgetHostViewWin // When we are doing accelerated compositing HWND compositor_host_window_; - // Presents a texture received from another process to the compositing - // window. - scoped_refptr<AcceleratedSurface> accelerated_surface_; - // true if the compositor host window must be hidden after the // software renderered view is updated. bool hide_compositor_window_at_next_paint_; diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 045f5b1..5bbe3170 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -179,11 +179,6 @@ BackingStore* TestRenderWidgetHostView::AllocBackingStore( void TestRenderWidgetHostView::OnAcceleratedCompositingStateChange() { } -void TestRenderWidgetHostView::AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) { -} - #if defined(OS_MACOSX) gfx::Rect TestRenderWidgetHostView::GetViewCocoaBounds() const { @@ -231,6 +226,14 @@ void TestRenderWidgetHostView::AcceleratedSurfaceSetTransportDIB( TransportDIB::Handle transport_dib) { } +void TestRenderWidgetHostView::AcceleratedSurfaceBuffersSwapped( + gfx::PluginWindowHandle window, + uint64 surface_id, + int renderer_id, + int32 route_id, + int gpu_host_id) { +} + #elif defined(OS_WIN) void TestRenderWidgetHostView::WillWmDestroy() { } diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h index bab3718..0894288 100644 --- a/content/browser/renderer_host/test_render_view_host.h +++ b/content/browser/renderer_host/test_render_view_host.h @@ -88,9 +88,6 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE {} virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; - virtual void AcceleratedSurfaceBuffersSwapped( - const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, - int gpu_host_id) OVERRIDE; #if defined(OS_MACOSX) virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE {} virtual gfx::Rect GetViewCocoaBounds() const OVERRIDE; @@ -115,6 +112,12 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { int32 width, int32 height, TransportDIB::Handle transport_dib) OVERRIDE; + virtual void AcceleratedSurfaceBuffersSwapped( + gfx::PluginWindowHandle window, + uint64 surface_id, + int renderer_id, + int32 route_id, + int gpu_host_id) OVERRIDE; #elif defined(OS_WIN) virtual void WillWmDestroy() OVERRIDE; #endif |