diff options
Diffstat (limited to 'content')
22 files changed, 81 insertions, 23 deletions
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc index 9902a96..5fa10ad 100644 --- a/content/browser/renderer_host/gpu_message_filter.cc +++ b/content/browser/renderer_host/gpu_message_filter.cc @@ -205,6 +205,7 @@ void GpuMessageFilter::OnSynchronizeGpu(IPC::Message* reply) { } void GpuMessageFilter::OnCreateViewCommandBuffer( + gfx::PluginWindowHandle compositing_surface, int32 render_view_id, const GPUCreateCommandBufferConfig& init_params, IPC::Message* reply) { @@ -219,6 +220,7 @@ void GpuMessageFilter::OnCreateViewCommandBuffer( } ui_shim->CreateViewCommandBuffer( + compositing_surface, render_view_id, render_process_id_, init_params, diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h index 34e75f1..c8e8ada 100644 --- a/content/browser/renderer_host/gpu_message_filter.h +++ b/content/browser/renderer_host/gpu_message_filter.h @@ -8,6 +8,7 @@ #include "content/browser/browser_message_filter.h" #include "content/common/gpu_process_launch_causes.h" +#include "ui/gfx/native_widget_types.h" class GpuProcessHost; class GpuProcessHostUIShim; @@ -42,6 +43,7 @@ class GpuMessageFilter : public BrowserMessageFilter, void OnEstablishGpuChannel(content::CauseForGpuLaunch); void OnSynchronizeGpu(IPC::Message* reply); void OnCreateViewCommandBuffer( + gfx::PluginWindowHandle compositing_surface, int32 render_view_id, const GPUCreateCommandBufferConfig& init_params, IPC::Message* reply); diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index d5eb8c9..5f11584 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -168,6 +168,7 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) { ViewMsg_New_Params params; params.parent_window = GetNativeViewId(); + params.compositing_surface = GetCompositingSurface(); params.renderer_preferences = delegate_->GetRendererPrefs(process()->profile()); params.web_preferences = delegate_->GetWebkitPrefs(); diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 57004c9..d7ad0b5 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -122,6 +122,12 @@ gfx::NativeViewId RenderWidgetHost::GetNativeViewId() { return 0; } +gfx::PluginWindowHandle RenderWidgetHost::GetCompositingSurface() { + if (view_) + return view_->GetCompositingSurface(); + return gfx::kNullPluginWindow; +} + bool RenderWidgetHost::PreHandleKeyboardEvent( const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { @@ -134,7 +140,8 @@ void RenderWidgetHost::Init() { renderer_initialized_ = true; // Send the ack along with the information on placement. - Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); + Send(new ViewMsg_CreatingNew_ACK( + routing_id_, GetNativeViewId(), GetCompositingSurface())); WasResized(); } diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h index 9ed7ccd..ab5aa91 100644 --- a/content/browser/renderer_host/render_widget_host.h +++ b/content/browser/renderer_host/render_widget_host.h @@ -413,6 +413,10 @@ class RenderWidgetHost : public IPC::Channel::Listener, // This is used for various IPC messages, including plugins. gfx::NativeViewId GetNativeViewId(); + // Retrieves an id for the surface that the renderer can draw to + // when accelerated compositing is enabled. + gfx::PluginWindowHandle GetCompositingSurface(); + // Called to handled a keyboard event before sending it to the renderer. // This is overridden by RenderView to send upwards to its delegate. // Returns true if the event was handled, and then the keyboard event will diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h index 5d4cf69..76c1db4 100644 --- a/content/browser/renderer_host/render_widget_host_view.h +++ b/content/browser/renderer_host/render_widget_host_view.h @@ -270,8 +270,7 @@ class RenderWidgetHostView { virtual void ShowCompositorHostWindow(bool show) = 0; #endif - virtual gfx::PluginWindowHandle AcquireCompositingSurface() = 0; - virtual void ReleaseCompositingSurface(gfx::PluginWindowHandle surface) = 0; + virtual gfx::PluginWindowHandle GetCompositingSurface() = 0; // Toggles visual muting of the render view area. This is on when a // constrained window is showing, for example. |color| is the shade of diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 6eba441..394d447 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -242,7 +242,7 @@ void TestRenderWidgetHostView::ShowCompositorHostWindow(bool show) { } #endif -gfx::PluginWindowHandle TestRenderWidgetHostView::AcquireCompositingSurface() { +gfx::PluginWindowHandle TestRenderWidgetHostView::GetCompositingSurface() { return gfx::kNullPluginWindow; } diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h index 4326529..a860806 100644 --- a/content/browser/renderer_host/test_render_view_host.h +++ b/content/browser/renderer_host/test_render_view_host.h @@ -141,8 +141,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { virtual void AcceleratedCompositingActivated(bool activated) { } #endif - virtual gfx::PluginWindowHandle AcquireCompositingSurface(); - virtual void ReleaseCompositingSurface(gfx::PluginWindowHandle surface) { } + virtual gfx::PluginWindowHandle GetCompositingSurface(); virtual bool ContainsNativeView(gfx::NativeView native_view) const; diff --git a/content/common/gpu_messages.h b/content/common/gpu_messages.h index 88fab8a..73fad10 100644 --- a/content/common/gpu_messages.h +++ b/content/common/gpu_messages.h @@ -152,7 +152,7 @@ IPC_MESSAGE_CONTROL3(GpuMsg_VisibilityChanged, // Tells the GPU process to create a new command buffer that renders directly // to a native view. A corresponding GpuCommandBufferStub is created. IPC_MESSAGE_CONTROL4(GpuMsg_CreateViewCommandBuffer, - gfx::PluginWindowHandle, /* view */ + gfx::PluginWindowHandle, /* compositing_surface */ int32, /* render_view_id */ int32, /* renderer_id */ GPUCreateCommandBufferConfig /* init_params */) @@ -210,7 +210,8 @@ IPC_SYNC_MESSAGE_CONTROL0_0(GpuHostMsg_SynchronizeGpu) // A renderer sends this to the browser process when it wants to // create a GL context associated with the given view_id. -IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateViewCommandBuffer, +IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer, + gfx::PluginWindowHandle, /* view */ int32, /* render_view_id */ GPUCreateCommandBufferConfig, /* init_params */ int32 /* route_id */) diff --git a/content/common/gpu_process_launch_causes.h b/content/common/gpu_process_launch_causes.h index db4f62a..3d5128f 100644 --- a/content/common/gpu_process_launch_causes.h +++ b/content/common/gpu_process_launch_causes.h @@ -13,7 +13,6 @@ enum CauseForGpuLaunch { CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETFULLSCREENPEPPER_CREATECONTEXT, - CAUSE_FOR_GPU_LAUNCH_RENDERWIDGETHOSTVIEWMAC_DEALLOCFAKEPLUGINWINDOWHANDLE, CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, CAUSE_FOR_GPU_LAUNCH_MAX_ENUM diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 86e2328..140267e 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -710,6 +710,9 @@ IPC_STRUCT_BEGIN(ViewMsg_New_Params) // The parent window's id. IPC_STRUCT_MEMBER(gfx::NativeViewId, parent_window) + // Surface for accelerated rendering. + IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, compositing_surface) + // Renderer-wide preferences. IPC_STRUCT_MEMBER(RendererPreferences, renderer_preferences) @@ -757,8 +760,9 @@ IPC_MESSAGE_CONTROL1(ViewMsg_New, // Reply in response to ViewHostMsg_ShowView or ViewHostMsg_ShowWidget. // similar to the new command, but used when the renderer created a view // first, and we need to update it. -IPC_MESSAGE_ROUTED1(ViewMsg_CreatingNew_ACK, - gfx::NativeViewId /* parent_hwnd */) +IPC_MESSAGE_ROUTED2(ViewMsg_CreatingNew_ACK, + gfx::NativeViewId /* parent_hwnd */, + gfx::PluginWindowHandle /* compositing_surface */) // Sends updated preferences to the renderer. IPC_MESSAGE_ROUTED1(ViewMsg_SetRendererPrefs, diff --git a/content/renderer/gpu_channel_host.cc b/content/renderer/gpu_channel_host.cc index 7630462..97fd549 100644 --- a/content/renderer/gpu_channel_host.cc +++ b/content/renderer/gpu_channel_host.cc @@ -101,6 +101,7 @@ bool GpuChannelHost::Send(IPC::Message* message) { } CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( + gfx::PluginWindowHandle compositing_surface, int render_view_id, const std::string& allowed_extensions, const std::vector<int32>& attribs, @@ -117,7 +118,7 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( int32 route_id; if (!RenderThread::current()->Send( new GpuHostMsg_CreateViewCommandBuffer( - render_view_id, init_params, &route_id))) { + compositing_surface, render_view_id, init_params, &route_id))) { return NULL; } diff --git a/content/renderer/gpu_channel_host.h b/content/renderer/gpu_channel_host.h index fa1d60d..4e50881 100644 --- a/content/renderer/gpu_channel_host.h +++ b/content/renderer/gpu_channel_host.h @@ -67,6 +67,7 @@ class GpuChannelHost : public IPC::Channel::Listener, // Create and connect to a command buffer in the GPU process. CommandBufferProxy* CreateViewCommandBuffer( + gfx::PluginWindowHandle compositing_surface, int render_view_id, const std::string& allowed_extensions, const std::vector<int32>& attribs, diff --git a/content/renderer/render_thread.cc b/content/renderer/render_thread.cc index 625ebbc..1a77c3f 100644 --- a/content/renderer/render_thread.cc +++ b/content/renderer/render_thread.cc @@ -428,6 +428,7 @@ void RenderThread::OnCreateNewView(const ViewMsg_New_Params& params) { RenderView::Create( this, params.parent_window, + params.compositing_surface, MSG_ROUTING_NONE, params.renderer_preferences, params.web_preferences, diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 05896d0..e1967c8 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -344,6 +344,7 @@ struct RenderView::PendingFileChooser { RenderView::RenderView(RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, + gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, @@ -413,7 +414,7 @@ RenderView::RenderView(RenderThreadBase* render_thread, // completing initialization. Otherwise, we can finish it now. if (opener_id == MSG_ROUTING_NONE) { did_show_ = true; - CompleteInit(parent_hwnd); + CompleteInit(parent_hwnd, compositing_surface); } host_window_ = parent_hwnd; @@ -487,6 +488,7 @@ RenderView* RenderView::FromWebView(WebView* webview) { RenderView* RenderView::Create( RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, + gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, @@ -498,6 +500,7 @@ RenderView* RenderView::Create( return new RenderView( render_thread, parent_hwnd, + compositing_surface, opener_id, renderer_prefs, webkit_prefs, @@ -1274,6 +1277,7 @@ WebView* RenderView::createView( RenderView* view = RenderView::Create(render_thread_, 0, + gfx::kNullPluginWindow, routing_id_, renderer_preferences_, webkit_preferences_, diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index 8f2afe4..1db83ee 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -176,6 +176,7 @@ class RenderView : public RenderWidget, static RenderView* Create( RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, + gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, @@ -658,6 +659,7 @@ class RenderView : public RenderWidget, RenderView(RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, + gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 8cd6f35..26f3f99 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -148,10 +148,12 @@ void RenderWidget::DoInit(int32 opener_id, // This is used to complete pending inits and non-pending inits. For non- // pending cases, the parent will be the same as the current parent. This // indicates we do not need to reparent or anything. -void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { +void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd, + gfx::PluginWindowHandle compositing_surface) { DCHECK(routing_id_ != MSG_ROUTING_NONE); host_window_ = parent_hwnd; + compositing_surface_ = compositing_surface; Send(new ViewHostMsg_RenderViewReady(routing_id_)); } @@ -196,10 +198,12 @@ bool RenderWidget::Send(IPC::Message* message) { // Got a response from the browser after the renderer decided to create a new // view. -void RenderWidget::OnCreatingNewAck(gfx::NativeViewId parent) { +void RenderWidget::OnCreatingNewAck( + gfx::NativeViewId parent, + gfx::PluginWindowHandle compositing_surface) { DCHECK(routing_id_ != MSG_ROUTING_NONE); - CompleteInit(parent); + CompleteInit(parent, compositing_surface); } void RenderWidget::OnClose() { diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index b6cf16e..63580c7 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -74,6 +74,13 @@ class RenderWidget : public IPC::Channel::Listener, // Creates a WebWidget based on the popup type. static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); + // The compositing surface assigned by the RenderWidgetHost + // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet, + // in which case we should not create any GPU command buffers with it. + gfx::PluginWindowHandle compositing_surface() const { + return compositing_surface_; + } + // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if // not yet assigned a view ID, in which case, the process MUST NOT send // messages with this ID to the parent. @@ -144,7 +151,8 @@ class RenderWidget : public IPC::Channel::Listener, IPC::SyncMessage* create_widget_message); // Finishes creation of a pending view started with Init. - void CompleteInit(gfx::NativeViewId parent); + void CompleteInit(gfx::NativeViewId parent, + gfx::PluginWindowHandle compositing_surface); // Paints the given rectangular region of the WebWidget into canvas (a // shared memory segment returned by AllocPaintBuf on Windows). The caller @@ -169,7 +177,8 @@ class RenderWidget : public IPC::Channel::Listener, // RenderWidget IPC message handlers void OnClose(); - void OnCreatingNewAck(gfx::NativeViewId parent); + void OnCreatingNewAck(gfx::NativeViewId parent, + gfx::PluginWindowHandle compositing_surface); virtual void OnResize(const gfx::Size& new_size, const gfx::Rect& resizer_rect); virtual void OnWasHidden(); @@ -367,6 +376,10 @@ class RenderWidget : public IPC::Channel::Listener, // compositor. bool is_accelerated_compositing_active_; + // Handle to a surface that is drawn to when accelerated compositing is + // active. + gfx::PluginWindowHandle compositing_surface_; + base::Time animation_floor_time_; bool animation_update_pending_; bool animation_task_posted_; diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index d3e2e20..bbe80bc 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc @@ -318,6 +318,7 @@ void RenderWidgetFullscreenPepper::CreateContext() { }; context_ = RendererGLContext::CreateViewContext( host, + compositing_surface(), routing_id(), "GL_OES_packed_depth_stencil GL_OES_depth24", attribs, diff --git a/content/renderer/renderer_gl_context.cc b/content/renderer/renderer_gl_context.cc index 0fea88ce..18e0c1d 100644 --- a/content/renderer/renderer_gl_context.cc +++ b/content/renderer/renderer_gl_context.cc @@ -156,6 +156,7 @@ RendererGLContext::~RendererGLContext() { RendererGLContext* RendererGLContext::CreateViewContext( GpuChannelHost* channel, + gfx::PluginWindowHandle render_surface, int render_view_id, const char* allowed_extensions, const int32* attrib_list, @@ -164,6 +165,7 @@ RendererGLContext* RendererGLContext::CreateViewContext( scoped_ptr<RendererGLContext> context(new RendererGLContext(channel, NULL)); if (!context->Initialize( true, + render_surface, render_view_id, gfx::Size(), allowed_extensions, @@ -196,6 +198,7 @@ RendererGLContext* RendererGLContext::CreateOffscreenContext( scoped_ptr<RendererGLContext> context(new RendererGLContext(channel, parent)); if (!context->Initialize( false, + gfx::kNullPluginWindow, 0, size, allowed_extensions, @@ -366,6 +369,7 @@ RendererGLContext::RendererGLContext(GpuChannelHost* channel, } bool RendererGLContext::Initialize(bool onscreen, + gfx::PluginWindowHandle render_surface, int render_view_id, const gfx::Size& size, const char* allowed_extensions, @@ -419,11 +423,17 @@ bool RendererGLContext::Initialize(bool onscreen, // Create a proxy to a command buffer in the GPU process. if (onscreen) { - command_buffer_ = channel_->CreateViewCommandBuffer( - render_view_id, - allowed_extensions, - attribs, - active_url); + if (render_surface == gfx::kNullPluginWindow) { + LOG(ERROR) << "Invalid surface handle for onscreen context."; + command_buffer_ = NULL; + } else { + command_buffer_ = channel_->CreateViewCommandBuffer( + render_surface, + render_view_id, + allowed_extensions, + attribs, + active_url); + } } else { CommandBufferProxy* parent_command_buffer = parent_.get() ? parent_->command_buffer_ : NULL; diff --git a/content/renderer/renderer_gl_context.h b/content/renderer/renderer_gl_context.h index a40f5e1..26a6d00 100644 --- a/content/renderer/renderer_gl_context.h +++ b/content/renderer/renderer_gl_context.h @@ -91,6 +91,7 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> { // more cross-platform. static RendererGLContext* CreateViewContext( GpuChannelHost* channel, + gfx::PluginWindowHandle render_surface, int render_view_id, const char* allowed_extensions, const int32* attrib_list, @@ -205,6 +206,7 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> { RendererGLContext* parent); bool Initialize(bool onscreen, + gfx::PluginWindowHandle render_surface, int render_view_id, const gfx::Size& size, const char* allowed_extensions, diff --git a/content/renderer/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/webgraphicscontext3d_command_buffer_impl.cc index 57a66fa..2ff2b98 100644 --- a/content/renderer/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/renderer/webgraphicscontext3d_command_buffer_impl.cc @@ -100,6 +100,7 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( web_view_ = web_view; context_ = RendererGLContext::CreateViewContext( host, + renderview->compositing_surface(), renderview->routing_id(), kWebGraphicsContext3DPerferredGLExtensions, attribs, |