summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/gpu_channel_host.cc3
-rw-r--r--content/renderer/gpu_channel_host.h1
-rw-r--r--content/renderer/render_thread.cc1
-rw-r--r--content/renderer/render_view.cc6
-rw-r--r--content/renderer/render_view.h2
-rw-r--r--content/renderer/render_widget.cc10
-rw-r--r--content/renderer/render_widget.h17
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.cc1
-rw-r--r--content/renderer/renderer_gl_context.cc20
-rw-r--r--content/renderer/renderer_gl_context.h2
-rw-r--r--content/renderer/webgraphicscontext3d_command_buffer_impl.cc1
11 files changed, 52 insertions, 12 deletions
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,