summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 15:24:25 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 15:24:25 +0000
commitd8a58e44578fa646480cec37db3ddb40a5b673b7 (patch)
tree4221925985cab2e659d9b2a22434810361c1958a /chrome
parent5ba9c9ae342ff20bde44be9dfc538727d3696865 (diff)
downloadchromium_src-d8a58e44578fa646480cec37db3ddb40a5b673b7.zip
chromium_src-d8a58e44578fa646480cec37db3ddb40a5b673b7.tar.gz
chromium_src-d8a58e44578fa646480cec37db3ddb40a5b673b7.tar.bz2
Route IPC through browser when creating a viewable command buffer.
The communications path for creating a viewable command buffer used to be directly from the renderer (gpu_channel.cc) to the gpu process (gpu_channel.cc). This patch makes the browser an intermediary: - renderer (gpu_channel.cc) makes a synchronous request to the browser (picked up in renderer_message_filter.cc and forwarded to gpu_process_host.cc) - browser (gpu_process_host.cc) makes an asynchronous request to the gpu process (picked up in gpu_thread.cc and forwarded to gpu_channel.cc) for the command buffer - gpu process (gpu_thread.cc) sends an ACK with the route_id for the command buffer back to the browser (gpu_process_host.cc) - browser (gpu_process_host.cc) sends a delayed reply back to the renderer (gpu_channel_host.cc), which had blocked There are several motivations for this patch: - creating an onscreen command buffer requires a window to draw into (which is acquired/locked in the browser); by routing through the browser, we can acquire the get the window beforehand (thereby preventing a deadlock in some other work that I'm doing) - we can eliminate several separate synchronous IPC messages for obtaining and releasing the window associated with drawing (I've tried to unify the different code paths for Linux, Windows, and Mac) - in the future, we can have the browser allocate SHM for the command buffer and transfer buffers, allowing us to sandbox the gpu process BUG=none TEST=by hand on all 3 platforms, trybots Review URL: http://codereview.chromium.org/6343006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gpu_process_host.cc139
-rw-r--r--chrome/browser/gpu_process_host.h31
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.cc116
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.h7
-rw-r--r--chrome/browser/renderer_host/render_message_filter.cc11
-rw-r--r--chrome/browser/renderer_host/render_message_filter.h6
-rw-r--r--chrome/common/gpu_messages_internal.h51
-rw-r--r--chrome/common/render_messages_internal.h8
-rw-r--r--chrome/gpu/gpu_channel.cc66
-rw-r--r--chrome/gpu/gpu_channel.h11
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.cc20
-rw-r--r--chrome/gpu/gpu_thread.cc19
-rw-r--r--chrome/gpu/gpu_thread.h5
-rw-r--r--chrome/renderer/ggl/ggl.cc12
-rw-r--r--chrome/renderer/ggl/ggl.h1
-rw-r--r--chrome/renderer/gpu_channel_host.cc9
-rw-r--r--chrome/renderer/gpu_channel_host.h1
-rw-r--r--chrome/renderer/render_widget_fullscreen_pepper.cc21
-rw-r--r--chrome/renderer/render_widget_fullscreen_pepper.h3
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc26
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.h4
21 files changed, 310 insertions, 257 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index ef931aa..b41ef44 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -13,6 +13,8 @@
#include "chrome/browser/gpu_blacklist.h"
#include "chrome/browser/gpu_process_host_ui_shim.h"
#include "chrome/browser/renderer_host/render_message_filter.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/gpu_feature_flags.h"
@@ -26,6 +28,10 @@
#include "media/base/media_switches.h"
#include "ui/base/resource/resource_bundle.h"
+#if defined(OS_LINUX)
+#include "gfx/gtk_native_view_id_manager.h"
+#endif // defined(OS_LINUX)
+
namespace {
enum GPUProcessLifetimeEvent {
@@ -65,6 +71,15 @@ void RouteOnUIThread(const IPC::Message& message) {
FROM_HERE,
new RouteOnUIThreadTask(message));
}
+
+bool SendDelayedMsg(IPC::Message* reply_msg) {
+ return GpuProcessHost::Get()->Send(reply_msg);
+}
+
+bool SendDelayedMsg(IPC::Message* reply, RenderMessageFilter* filter) {
+ return filter->Send(reply);
+}
+
} // anonymous namespace
class GpuMainThread : public base::Thread {
@@ -181,26 +196,119 @@ void GpuProcessHost::Synchronize(IPC::Message* reply,
DCHECK(CalledOnValidThread());
if (Send(new GpuMsg_Synchronize())) {
- queued_synchronization_replies_.push(SynchronizationRequest(reply, filter));
+ queued_synchronization_replies_.push(DelayedReply(reply, filter));
} else {
- SendSynchronizationReply(reply, filter);
+ SendDelayedMsg(reply, filter);
+ }
+}
+
+class CVCBThreadHopping {
+ public:
+ // Send the request for a command buffer from the IO thread and
+ // queue that we are expecting a response.
+ static void DispatchIPCAndQueueReply(
+ gfx::PluginWindowHandle view,
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ scoped_refptr<RenderMessageFilter> filter);
+
+ // Get a window for the command buffer that we're creating.
+ static void GetViewWindow(
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ scoped_refptr<RenderMessageFilter> filter);
+};
+
+void CVCBThreadHopping::DispatchIPCAndQueueReply(
+ gfx::PluginWindowHandle view,
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ scoped_refptr<RenderMessageFilter> filter) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ GpuProcessHost* host = GpuProcessHost::Get();
+
+ if (view != gfx::kNullPluginWindow &&
+ SendDelayedMsg(new GpuMsg_CreateViewCommandBuffer(
+ view, render_view_id, renderer_id, init_params))) {
+ host->create_command_buffer_replies_.push(
+ GpuProcessHost::DelayedReply(reply, filter));
+ } else {
+ int32 route_id = MSG_ROUTING_NONE;
+ ViewHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id);
+ SendDelayedMsg(reply, filter);
+ }
+}
+
+void CVCBThreadHopping::GetViewWindow(
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ scoped_refptr<RenderMessageFilter> filter) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ gfx::PluginWindowHandle window = gfx::kNullPluginWindow;
+ RenderViewHost* host = RenderViewHost::FromID(renderer_id,
+ render_view_id);
+#if defined(OS_LINUX)
+ gfx::NativeViewId view = NULL;
+ if (host)
+ view = gfx::IdFromNativeView(host->view()->GetNativeView());
+
+ // Lock the window that we will draw into.
+ GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance();
+ if (!manager->GetPermanentXIDForId(&window, view)) {
+ DLOG(ERROR) << "Can't find XID for view id " << view;
}
+#elif defined(OS_MACOSX)
+ // On Mac OS X we currently pass a (fake) PluginWindowHandle for the
+ // window that we draw to.
+ window = host->view()->AllocateFakePluginWindowHandle(
+ /*opaque=*/true, /*root=*/true);
+#elif defined(OS_WIN)
+ // Create a window that we will overlay.
+ window = host->view()->GetCompositorHostWindow();
+#endif
+
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableFunction(
+ &CVCBThreadHopping::DispatchIPCAndQueueReply,
+ window, render_view_id, renderer_id, init_params, reply, filter));
}
+void GpuProcessHost::CreateViewCommandBuffer(
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ RenderMessageFilter* filter) {
+ DCHECK(CalledOnValidThread());
+
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableFunction(
+ &CVCBThreadHopping::GetViewWindow,
+ render_view_id, renderer_id, init_params, reply,
+ static_cast<scoped_refptr<RenderMessageFilter> > (filter)));
+}
+
+
GpuProcessHost::ChannelRequest::ChannelRequest(RenderMessageFilter* filter)
: filter(filter) {
}
GpuProcessHost::ChannelRequest::~ChannelRequest() {}
-GpuProcessHost::SynchronizationRequest::SynchronizationRequest(
+GpuProcessHost::DelayedReply::DelayedReply(
IPC::Message* reply,
RenderMessageFilter* filter)
: reply(reply),
filter(filter) {
}
-GpuProcessHost::SynchronizationRequest::~SynchronizationRequest() {}
+GpuProcessHost::DelayedReply::~DelayedReply() {}
bool GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
DCHECK(CalledOnValidThread());
@@ -208,6 +316,7 @@ bool GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
// If the IO thread does not handle the message then automatically route it
// to the UI thread. The UI thread will report an error if it does not
// handle it.
@@ -256,13 +365,24 @@ void GpuProcessHost::OnChannelEstablished(
void GpuProcessHost::OnSynchronizeReply() {
// Guard against race conditions in abrupt GPU process termination.
if (queued_synchronization_replies_.size() > 0) {
- const SynchronizationRequest& request =
+ const DelayedReply& request =
queued_synchronization_replies_.front();
- SendSynchronizationReply(request.reply, request.filter);
+ SendDelayedMsg(request.reply, request.filter);
queued_synchronization_replies_.pop();
}
}
+void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) {
+ if (create_command_buffer_replies_.size() > 0) {
+ const DelayedReply& request =
+ create_command_buffer_replies_.front();
+ ViewHostMsg_CreateViewCommandBuffer::WriteReplyParams(
+ request.reply, route_id);
+ SendDelayedMsg(request.reply, request.filter);
+ create_command_buffer_replies_.pop();
+ }
+}
+
void GpuProcessHost::SendEstablishChannelReply(
const IPC::ChannelHandle& channel,
const GPUInfo& gpu_info,
@@ -276,13 +396,6 @@ void GpuProcessHost::SendEstablishChannelReply(
filter->Send(message);
}
-// Sends the response for synchronization request to the renderer.
-void GpuProcessHost::SendSynchronizationReply(
- IPC::Message* reply,
- RenderMessageFilter* filter) {
- filter->Send(reply);
-}
-
void GpuProcessHost::SendOutstandingReplies() {
// First send empty channel handles for all EstablishChannel requests.
while (!sent_requests_.empty()) {
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index a1dfdc4..57b7105 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -16,6 +16,7 @@
#include "gfx/native_widget_types.h"
class GpuBlacklist;
+struct GPUCreateCommandBufferConfig;
class GPUInfo;
class RenderMessageFilter;
@@ -44,6 +45,19 @@ class GpuProcessHost : public BrowserChildProcessHost,
// in.
void Synchronize(IPC::Message* reply, RenderMessageFilter* filter);
+ // Tells the GPU process to create a new command buffer that draws into the
+ // window associated with the given renderer.
+ void CreateViewCommandBuffer(
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply,
+ RenderMessageFilter* filter);
+
+ // We need to hop threads when creating the command buffer.
+ // Let these tasks access our internals.
+ friend class CVCBThreadHopping;
+
private:
// Used to queue pending channel requests.
struct ChannelRequest {
@@ -54,10 +68,9 @@ class GpuProcessHost : public BrowserChildProcessHost,
scoped_refptr<RenderMessageFilter> filter;
};
- // Used to queue pending synchronization requests.
- struct SynchronizationRequest {
- SynchronizationRequest(IPC::Message* reply, RenderMessageFilter* filter);
- ~SynchronizationRequest();
+ struct DelayedReply {
+ DelayedReply(IPC::Message* reply, RenderMessageFilter* filter);
+ ~DelayedReply();
// The delayed reply message which needs to be sent to the
// renderer.
@@ -79,14 +92,12 @@ class GpuProcessHost : public BrowserChildProcessHost,
void OnChannelEstablished(const IPC::ChannelHandle& channel_handle,
const GPUInfo& gpu_info);
void OnSynchronizeReply();
+ void OnCommandBufferCreated(const int32 route_id);
// Sends the response for establish channel request to the renderer.
void SendEstablishChannelReply(const IPC::ChannelHandle& channel,
const GPUInfo& gpu_info,
RenderMessageFilter* filter);
- // Sends the response for synchronization request to the renderer.
- void SendSynchronizationReply(IPC::Message* reply,
- RenderMessageFilter* filter);
// Sends outstanding replies to renderer processes. This is only called
// in error situations like the GPU process crashing -- but is necessary
@@ -114,9 +125,13 @@ class GpuProcessHost : public BrowserChildProcessHost,
std::queue<ChannelRequest> sent_requests_;
// The pending synchronization requests we need to reply to.
- std::queue<SynchronizationRequest> queued_synchronization_replies_;
+ std::queue<DelayedReply> queued_synchronization_replies_;
+
+ // The pending create command buffer requests we need to reply to.
+ std::queue<DelayedReply> create_command_buffer_replies_;
DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
};
+
#endif // CHROME_BROWSER_GPU_PROCESS_HOST_H_
diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc
index 9ae2fcd..f75755c 100644
--- a/chrome/browser/gpu_process_host_ui_shim.cc
+++ b/chrome/browser/gpu_process_host_ui_shim.cc
@@ -112,6 +112,32 @@ const GPUInfo& GpuProcessHostUIShim::gpu_info() const {
return gpu_info_;
}
+void GpuProcessHostUIShim::OnDestroyCommandBuffer(
+ gfx::PluginWindowHandle window, int32 renderer_id,
+ int32 render_view_id) {
+ if (!window)
+ return;
+
+#if defined(OS_LINUX)
+ GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance();
+ manager->ReleasePermanentXID(window);
+#elif defined(OS_MACOSX) || defined(OS_WIN)
+ RenderViewHost* host = RenderViewHost::FromID(renderer_id,
+ render_view_id);
+ if (!host)
+ return;
+ RenderWidgetHostView* view = host->view();
+ if (!view)
+ return;
+#if defined(OS_MACOSX)
+ view->DestroyFakePluginWindowHandle(window);
+#elif defined(OS_WIN)
+ view->ShowCompositorHostWindow(false);
+#endif
+
+#endif // defined(OS_MACOSX) || defined(OS_WIN)
+}
+
void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) {
gpu_info_ = gpu_info;
child_process_logging::SetGpuInfo(gpu_info);
@@ -121,6 +147,31 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) {
gpu_info_collected_callback_->Run();
}
+bool GpuProcessHostUIShim::OnControlMessageReceived(
+ const IPC::Message& message) {
+ DCHECK(CalledOnValidThread());
+
+ IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer,
+ OnDestroyCommandBuffer)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
+ OnGraphicsInfoCollected)
+#if defined(OS_LINUX)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID)
+#elif defined(OS_MACOSX)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
+ OnAcceleratedSurfaceSetIOSurface)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
+ OnAcceleratedSurfaceBuffersSwapped)
+#elif defined(OS_WIN)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, OnScheduleComposite);
+#endif
+ IPC_MESSAGE_UNHANDLED_ERROR()
+ IPC_END_MESSAGE_MAP()
+
+ return true;
+}
+
namespace {
void SendDelayedReply(IPC::Message* reply_msg) {
@@ -134,25 +185,6 @@ void SendDelayedReply(IPC::Message* reply_msg) {
#if defined(OS_LINUX)
-void GpuProcessHostUIShim::OnGetViewXID(gfx::NativeViewId id,
- IPC::Message* reply_msg) {
- XID xid;
-
- GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance();
- if (!manager->GetPermanentXIDForId(&xid, id)) {
- DLOG(ERROR) << "Can't find XID for view id " << id;
- xid = 0;
- }
-
- GpuHostMsg_GetViewXID::WriteReplyParams(reply_msg, xid);
- SendDelayedReply(reply_msg);
-}
-
-void GpuProcessHostUIShim::OnReleaseXID(unsigned long xid) {
- GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance();
- manager->ReleasePermanentXID(xid);
-}
-
void GpuProcessHostUIShim::OnResizeXID(unsigned long xid, gfx::Size size,
IPC::Message *reply_msg) {
GdkWindow* window = reinterpret_cast<GdkWindow*>(gdk_xid_table_lookup(xid));
@@ -204,26 +236,6 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
#elif defined(OS_WIN)
-void GpuProcessHostUIShim::OnGetCompositorHostWindow(
- int renderer_id,
- int render_view_id,
- IPC::Message* reply_msg) {
- RenderViewHost* host = RenderViewHost::FromID(renderer_id,
- render_view_id);
- if (!host) {
- GpuHostMsg_GetCompositorHostWindow::WriteReplyParams(reply_msg,
- gfx::kNullPluginWindow);
- SendDelayedReply(reply_msg);
- return;
- }
-
- RenderWidgetHostView* view = host->view();
- gfx::PluginWindowHandle id = view->GetCompositorHostWindow();
-
- GpuHostMsg_GetCompositorHostWindow::WriteReplyParams(reply_msg, id);
- SendDelayedReply(reply_msg);
-}
-
void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id,
int render_view_id) {
RenderViewHost* host = RenderViewHost::FromID(renderer_id,
@@ -233,31 +245,5 @@ void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id,
}
host->ScheduleComposite();
}
-#endif
-bool GpuProcessHostUIShim::OnControlMessageReceived(
- const IPC::Message& message) {
- DCHECK(CalledOnValidThread());
-
- IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
- IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
- OnGraphicsInfoCollected)
-#if defined(OS_LINUX)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID)
- IPC_MESSAGE_HANDLER(GpuHostMsg_ReleaseXID, OnReleaseXID)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID)
-#elif defined(OS_MACOSX)
- IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
- OnAcceleratedSurfaceSetIOSurface)
- IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
- OnAcceleratedSurfaceBuffersSwapped)
-#elif defined(OS_WIN)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetCompositorHostWindow,
- OnGetCompositorHostWindow)
- IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, OnScheduleComposite);
#endif
- IPC_MESSAGE_UNHANDLED_ERROR()
- IPC_END_MESSAGE_MAP()
-
- return true;
-}
diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h
index 98a813c..dd0ec63 100644
--- a/chrome/browser/gpu_process_host_ui_shim.h
+++ b/chrome/browser/gpu_process_host_ui_shim.h
@@ -77,12 +77,12 @@ class GpuProcessHostUIShim : public IPC::Channel::Sender,
virtual ~GpuProcessHostUIShim();
// Message handlers.
+ void OnDestroyCommandBuffer(gfx::PluginWindowHandle window,
+ int32 renderer_id, int32 render_view_id);
void OnGraphicsInfoCollected(const GPUInfo& gpu_info);
bool OnControlMessageReceived(const IPC::Message& message);
#if defined(OS_LINUX)
- void OnGetViewXID(gfx::NativeViewId id, IPC::Message* reply_msg);
- void OnReleaseXID(unsigned long xid);
void OnResizeXID(unsigned long xid, gfx::Size size, IPC::Message* reply_msg);
#elif defined(OS_MACOSX)
void OnAcceleratedSurfaceSetIOSurface(
@@ -90,9 +90,6 @@ class GpuProcessHostUIShim : public IPC::Channel::Sender,
void OnAcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
#elif defined(OS_WIN)
- void OnGetCompositorHostWindow(int renderer_id,
- int render_view_id,
- IPC::Message* reply_message);
void OnScheduleComposite(int32 renderer_id, int32 render_view_id);
#endif
diff --git a/chrome/browser/renderer_host/render_message_filter.cc b/chrome/browser/renderer_host/render_message_filter.cc
index e00a6b8..338c64f 100644
--- a/chrome/browser/renderer_host/render_message_filter.cc
+++ b/chrome/browser/renderer_host/render_message_filter.cc
@@ -48,6 +48,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_message_bundle.h"
+#include "chrome/common/gpu_create_command_buffer_config.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
@@ -397,6 +398,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel, OnEstablishGpuChannel)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SynchronizeGpu,
OnSynchronizeGpu)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_CreateViewCommandBuffer,
+ OnCreateViewCommandBuffer)
IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenFile, OnAsyncOpenFile)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -1423,6 +1426,14 @@ void RenderMessageFilter::OnSynchronizeGpu(IPC::Message* reply) {
GpuProcessHost::Get()->Synchronize(reply, this);
}
+void RenderMessageFilter::OnCreateViewCommandBuffer(
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply) {
+ GpuProcessHost::Get()->CreateViewCommandBuffer(
+ render_view_id, render_process_id_, init_params, reply, this);
+}
+
void RenderMessageFilter::OnGetExtensionMessageBundle(
const std::string& extension_id, IPC::Message* reply_msg) {
ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>(
diff --git a/chrome/browser/renderer_host/render_message_filter.h b/chrome/browser/renderer_host/render_message_filter.h
index dee75a0..a16c2aa 100644
--- a/chrome/browser/renderer_host/render_message_filter.h
+++ b/chrome/browser/renderer_host/render_message_filter.h
@@ -31,6 +31,7 @@
class ChromeURLRequestContext;
struct FontDescriptor;
+struct GPUCreateCommandBufferConfig;
class HostContentSettingsMap;
class HostZoomMap;
class NotificationsPrefsCache;
@@ -332,7 +333,10 @@ class RenderMessageFilter : public BrowserMessageFilter,
IPC::Message* reply_msg);
void OnEstablishGpuChannel();
void OnSynchronizeGpu(IPC::Message* reply);
-
+ void OnCreateViewCommandBuffer(
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ IPC::Message* reply);
void OnAsyncOpenFile(const IPC::Message& msg,
const FilePath& path,
int flags,
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index 6a488c3..37639af 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -54,6 +54,14 @@ IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
// asynchronously.) Results in a GpuHostMsg_SynchronizeReply.
IPC_MESSAGE_CONTROL0(GpuMsg_Synchronize)
+// 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 */
+ int32, /* render_view_id */
+ int32, /* renderer_id */
+ GPUCreateCommandBufferConfig /* init_params */)
+
// Tells the GPU process to create a context for collecting graphics card
// information.
IPC_MESSAGE_CONTROL1(GpuMsg_CollectGraphicsInfo,
@@ -92,29 +100,31 @@ IPC_MESSAGE_CONTROL2(GpuHostMsg_ChannelEstablished,
IPC::ChannelHandle, /* channel_handle */
GPUInfo /* GPU logging stats */)
-// Response to a GpuMsg_Synchronize message.
-IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply)
+// Respond to a GpuMsg_CreateViewCommandBuffer message.
+IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
+ int32 /* route_id */)
+
+// Free the browser resources associated with the command buffer
+// (typically a window that was drawn into).
+IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer,
+ gfx::PluginWindowHandle, /* view */
+ int32, /* render_view_id */
+ int32 /* renderer_id */)
// Response to a GpuMsg_CollectGraphicsInfo.
IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
GPUInfo /* GPU logging stats */)
-#if defined(OS_LINUX)
-// Get the XID for a view ID.
-IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_GetViewXID,
- gfx::NativeViewId, /* view */
- unsigned long /* xid */)
-
-// Release the lock on the window.
-// If the associated view has been destroyed, destroy the window.
-IPC_MESSAGE_CONTROL1(GpuHostMsg_ReleaseXID,
- unsigned long /* xid */)
+// Response to a GpuMsg_Synchronize message.
+IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply)
+#if defined(OS_LINUX)
+// Resize the window that is being drawn into. It's important that this
+// resize be synchronized with the swapping of the front and back buffers.
IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_ResizeXID,
unsigned long, /* xid */
gfx::Size, /* size */
bool /* success */)
-
#elif defined(OS_MACOSX)
// This message, used on Mac OS X 10.6 and later (where IOSurface is
// supported), is sent from the GPU process to the browser to indicate that a
@@ -130,12 +140,6 @@ IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
#elif defined(OS_WIN)
-// Get the HWND for the compositor window and if necessary, create it
-IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_GetCompositorHostWindow,
- int32, /* renderer_id */
- int32, /* render_view_id */
- gfx::PluginWindowHandle /* compositor_host_id */)
-
IPC_MESSAGE_CONTROL2(GpuHostMsg_ScheduleComposite,
int32, /* renderer_id */
int32 /* render_view_id */)
@@ -144,15 +148,6 @@ IPC_MESSAGE_CONTROL2(GpuHostMsg_ScheduleComposite,
//------------------------------------------------------------------------------
// GPU Channel Messages
// These are messages from a renderer process to the GPU process.
-// Tells the GPU process to create a new command buffer that renders directly
-// to a native view. The |render_view_id| is currently needed only on Mac OS
-// X in order to identify the window on the browser side into which the
-// rendering results go. A corresponding GpuCommandBufferStub is created.
-IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateViewCommandBuffer,
- gfx::NativeViewId, /* view */
- int32, /* render_view_id */
- GPUCreateCommandBufferConfig, /* init_params */
- int32 /* route_id */)
// Tells the GPU process to create a new command buffer that renders to an
// offscreen frame buffer. If parent_route_id is not zero, the texture backing
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index a55290a..55e467a 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -48,6 +48,7 @@
typedef std::map<std::string, std::string> SubstitutionMap;
class Value;
+struct GPUCreateCommandBufferConfig;
class GPUInfo;
class SkBitmap;
struct ThumbnailScore;
@@ -1544,6 +1545,13 @@ IPC_MESSAGE_CONTROL0(ViewHostMsg_EstablishGpuChannel)
// been established.
IPC_SYNC_MESSAGE_CONTROL0_0(ViewHostMsg_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(ViewHostMsg_CreateViewCommandBuffer,
+ int32, /* render_view_id */
+ GPUCreateCommandBufferConfig, /* init_params */
+ int32 /* route_id */)
+
// A renderer sends this to the browser process when it wants to start
// a new instance of the Native Client process. The browser will launch
// the process and return a handle to an IMC channel.
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index 66b928e..5ef74e2 100644
--- a/chrome/gpu/gpu_channel.cc
+++ b/chrome/gpu/gpu_channel.cc
@@ -71,6 +71,23 @@ bool GpuChannel::Send(IPC::Message* message) {
return channel_->Send(message);
}
+void GpuChannel::CreateViewCommandBuffer(
+ gfx::PluginWindowHandle window,
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ int32* route_id) {
+ *route_id = MSG_ROUTING_NONE;
+
+#if defined(ENABLE_GPU)
+ *route_id = GenerateRouteID();
+ scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
+ this, window, NULL, gfx::Size(), init_params.allowed_extensions,
+ init_params.attribs, 0, *route_id, renderer_id_, render_view_id));
+ router_.AddRoute(*route_id, stub.get());
+ stubs_.AddWithID(stub.release(), *route_id);
+#endif // ENABLE_GPU
+}
+
#if defined(OS_MACOSX)
void GpuChannel::AcceleratedSurfaceBuffersSwapped(
int32 route_id, uint64 swap_buffers_count) {
@@ -97,8 +114,6 @@ bool GpuChannel::IsRenderViewGone(int32 renderer_route_id) {
bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
- IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateViewCommandBuffer,
- OnCreateViewCommandBuffer)
IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
OnCreateOffscreenCommandBuffer)
IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
@@ -118,53 +133,6 @@ int GpuChannel::GenerateRouteID() {
return ++last_id;
}
-void GpuChannel::OnCreateViewCommandBuffer(
- gfx::NativeViewId view_id,
- int32 render_view_id,
- const GPUCreateCommandBufferConfig& init_params,
- int32* route_id) {
- *route_id = MSG_ROUTING_NONE;
-
-#if defined(ENABLE_GPU)
-
- gfx::PluginWindowHandle handle = gfx::kNullPluginWindow;
-#if defined(OS_WIN)
- // TODO(apatrick): We don't actually need the window handle on the Windows
- // platform. At this point, it only indicates to the GpuCommandBufferStub
- // whether onscreen or offscreen rendering is requested. The window handle
- // that will be rendered to is the child compositor window and that window
- // handle is provided by the browser process. Looking at what we are doing on
- // this and other platforms, I think a redesign is in order here. Perhaps
- // on all platforms the renderer just indicates whether it wants onscreen or
- // offscreen rendering and the browser provides whichever platform specific
- // "render target" the GpuCommandBufferStub targets.
- handle = gfx::NativeViewFromId(view_id);
-#elif defined(OS_LINUX)
- // Ask the browser for the view's XID.
- gpu_thread_->Send(new GpuHostMsg_GetViewXID(view_id, &handle));
-#elif defined(OS_MACOSX)
- // On Mac OS X we currently pass a (fake) PluginWindowHandle for the
- // NativeViewId. We could allocate fake NativeViewIds on the browser
- // side as well, and map between those and PluginWindowHandles, but
- // this seems excessive.
- handle = static_cast<gfx::PluginWindowHandle>(
- static_cast<intptr_t>(view_id));
-#else
- // TODO(apatrick): This needs to be something valid for mac and linux.
- // Offscreen rendering will work on these platforms but not rendering to the
- // window.
- DCHECK_EQ(view_id, 0);
-#endif
-
- *route_id = GenerateRouteID();
- scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
- this, handle, NULL, gfx::Size(), init_params.allowed_extensions,
- init_params.attribs, 0, *route_id, renderer_id_, render_view_id));
- router_.AddRoute(*route_id, stub.get());
- stubs_.AddWithID(stub.release(), *route_id);
-#endif // ENABLE_GPU
-}
-
void GpuChannel::OnCreateOffscreenCommandBuffer(
int32 parent_route_id,
const gfx::Size& size,
diff --git a/chrome/gpu/gpu_channel.h b/chrome/gpu/gpu_channel.h
index 75d57ca..2ebe6d7 100644
--- a/chrome/gpu/gpu_channel.h
+++ b/chrome/gpu/gpu_channel.h
@@ -59,6 +59,12 @@ class GpuChannel : public IPC::Channel::Listener,
// IPC::Message::Sender implementation:
virtual bool Send(IPC::Message* msg);
+ void CreateViewCommandBuffer(
+ gfx::PluginWindowHandle window,
+ int32 render_view_id,
+ const GPUCreateCommandBufferConfig& init_params,
+ int32* route_id);
+
#if defined(OS_MACOSX)
virtual void AcceleratedSurfaceBuffersSwapped(
int32 route_id, uint64 swap_buffers_count);
@@ -73,11 +79,6 @@ class GpuChannel : public IPC::Channel::Listener,
int GenerateRouteID();
// Message handlers.
- void OnCreateViewCommandBuffer(
- gfx::NativeViewId view,
- int32 render_view_id,
- const GPUCreateCommandBufferConfig& init_params,
- int32* route_id);
void OnCreateOffscreenCommandBuffer(
int32 parent_route_id,
const gfx::Size& size,
diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc
index 43a1be5..3a832441 100644
--- a/chrome/gpu/gpu_command_buffer_stub.cc
+++ b/chrome/gpu/gpu_command_buffer_stub.cc
@@ -80,17 +80,7 @@ static LRESULT CALLBACK CompositorWindowProc(
bool GpuCommandBufferStub::CreateCompositorWindow() {
DCHECK(handle_ != gfx::kNullPluginWindow);
-
- // Ask the browser to create the the host window.
- GpuThread* gpu_thread = channel_->gpu_thread();
- gfx::PluginWindowHandle host_window_id = gfx::kNullPluginWindow;
- gpu_thread->Send(new GpuHostMsg_GetCompositorHostWindow(
- renderer_id_,
- render_view_id_,
- &host_window_id));
- if (host_window_id == gfx::kNullPluginWindow)
- return false;
- HWND host_window = static_cast<HWND>(host_window_id);
+ HWND host_window = static_cast<HWND>(handle_);
// Create the compositor window itself.
DCHECK(host_window);
@@ -163,11 +153,11 @@ GpuCommandBufferStub::~GpuCommandBufferStub() {
DestroyWindow(static_cast<HWND>(compositor_window_));
compositor_window_ = NULL;
}
-#elif defined(OS_LINUX)
- GpuThread* gpu_thread = channel_->gpu_thread();
- gpu_thread->Send(
- new GpuHostMsg_ReleaseXID(handle_));
#endif // defined(OS_WIN)
+
+ GpuThread* gpu_thread = channel_->gpu_thread();
+ gpu_thread->Send(new GpuHostMsg_DestroyCommandBuffer(
+ handle_, renderer_id_, render_view_id_));
}
bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index 752478e..e52b7a6 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -69,6 +69,8 @@ bool GpuThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize)
IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel)
IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
+ IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer,
+ OnCreateViewCommandBuffer);
IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, OnSynchronize)
IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo)
#if defined(OS_MACOSX)
@@ -215,10 +217,25 @@ void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) {
}
}
#endif
-
Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
}
+void GpuThread::OnCreateViewCommandBuffer(
+ gfx::PluginWindowHandle window,
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params) {
+ int32 route_id = MSG_ROUTING_NONE;
+
+ GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
+ if (iter != gpu_channels_.end()) {
+ iter->second->CreateViewCommandBuffer(
+ window, render_view_id, init_params, &route_id);
+ }
+
+ Send(new GpuHostMsg_CommandBufferCreated(route_id));
+}
+
#if defined(OS_MACOSX)
void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK(
int renderer_id, int32 route_id, uint64 swap_buffers_count) {
diff --git a/chrome/gpu/gpu_thread.h b/chrome/gpu/gpu_thread.h
index 1bbb225..7f82ab6 100644
--- a/chrome/gpu/gpu_thread.h
+++ b/chrome/gpu/gpu_thread.h
@@ -51,6 +51,11 @@ class GpuThread : public ChildThread {
void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
void OnSynchronize();
void OnCollectGraphicsInfo(GPUInfo::Level level);
+ void OnCreateViewCommandBuffer(
+ gfx::PluginWindowHandle window,
+ int32 render_view_id,
+ int32 renderer_id,
+ const GPUCreateCommandBufferConfig& init_params);
#if defined(OS_MACOSX)
void OnAcceleratedSurfaceBuffersSwappedACK(
int renderer_id, int32 route_id, uint64 swap_buffers_count);
diff --git a/chrome/renderer/ggl/ggl.cc b/chrome/renderer/ggl/ggl.cc
index 8dea509..43b6f67 100644
--- a/chrome/renderer/ggl/ggl.cc
+++ b/chrome/renderer/ggl/ggl.cc
@@ -62,7 +62,7 @@ class Context : public base::SupportsWeakPtr<Context> {
// Initialize a GGL context that can be used in association with a a GPU
// channel acquired from a RenderWidget or RenderView.
- bool Initialize(gfx::NativeViewId view,
+ bool Initialize(bool onscreen,
int render_view_id,
const gfx::Size& size,
const char* allowed_extensions,
@@ -156,7 +156,7 @@ Context::~Context() {
Destroy();
}
-bool Context::Initialize(gfx::NativeViewId view,
+bool Context::Initialize(bool onscreen,
int render_view_id,
const gfx::Size& size,
const char* allowed_extensions,
@@ -207,9 +207,8 @@ bool Context::Initialize(gfx::NativeViewId view,
}
// Create a proxy to a command buffer in the GPU process.
- if (view) {
+ if (onscreen) {
command_buffer_ = channel_->CreateViewCommandBuffer(
- view,
render_view_id,
allowed_extensions,
attribs);
@@ -434,14 +433,13 @@ void Context::OnSwapBuffers() {
#endif // ENABLE_GPU
Context* CreateViewContext(GpuChannelHost* channel,
- gfx::NativeViewId view,
int render_view_id,
const char* allowed_extensions,
const int32* attrib_list) {
#if defined(ENABLE_GPU)
scoped_ptr<Context> context(new Context(channel, NULL));
if (!context->Initialize(
- view, render_view_id, gfx::Size(), allowed_extensions, attrib_list))
+ true, render_view_id, gfx::Size(), allowed_extensions, attrib_list))
return NULL;
return context.release();
@@ -465,7 +463,7 @@ Context* CreateOffscreenContext(GpuChannelHost* channel,
const int32* attrib_list) {
#if defined(ENABLE_GPU)
scoped_ptr<Context> context(new Context(channel, parent));
- if (!context->Initialize(0, 0, size, allowed_extensions, attrib_list))
+ if (!context->Initialize(false, 0, size, allowed_extensions, attrib_list))
return NULL;
return context.release();
diff --git a/chrome/renderer/ggl/ggl.h b/chrome/renderer/ggl/ggl.h
index dcedcc0..c7402a0 100644
--- a/chrome/renderer/ggl/ggl.h
+++ b/chrome/renderer/ggl/ggl.h
@@ -80,7 +80,6 @@ bool Terminate();
// TODO(kbr): clean up the arguments to this function and make them
// more cross-platform.
Context* CreateViewContext(GpuChannelHost* channel,
- gfx::NativeViewId view,
int render_view_id,
const char* allowed_extensions,
const int32* attrib_list);
diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc
index 719e8bf..10b52ed 100644
--- a/chrome/renderer/gpu_channel_host.cc
+++ b/chrome/renderer/gpu_channel_host.cc
@@ -7,8 +7,10 @@
#include "chrome/common/child_process.h"
#include "chrome/common/gpu_create_command_buffer_config.h"
#include "chrome/common/gpu_messages.h"
+#include "chrome/common/render_messages.h"
#include "chrome/renderer/command_buffer_proxy.h"
#include "chrome/renderer/gpu_video_service_host.h"
+#include "chrome/renderer/render_thread.h"
GpuChannelHost::GpuChannelHost() : state_(kUnconnected) {
}
@@ -90,7 +92,6 @@ bool GpuChannelHost::Send(IPC::Message* message) {
}
CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer(
- gfx::NativeViewId view,
int render_view_id,
const std::string& allowed_extensions,
const std::vector<int32>& attribs) {
@@ -101,10 +102,8 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer(
GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs);
int32 route_id;
- if (!Send(new GpuChannelMsg_CreateViewCommandBuffer(view,
- render_view_id,
- init_params,
- &route_id))) {
+ if (!RenderThread::current()->Send(new ViewHostMsg_CreateViewCommandBuffer(
+ render_view_id, init_params, &route_id))) {
return NULL;
}
diff --git a/chrome/renderer/gpu_channel_host.h b/chrome/renderer/gpu_channel_host.h
index 8f14841..e7763f1 100644
--- a/chrome/renderer/gpu_channel_host.h
+++ b/chrome/renderer/gpu_channel_host.h
@@ -65,7 +65,6 @@ class GpuChannelHost : public IPC::Channel::Listener,
// Create and connect to a command buffer in the GPU process.
CommandBufferProxy* CreateViewCommandBuffer(
- gfx::NativeViewId view,
int render_view_id,
const std::string& allowed_extensions,
const std::vector<int32>& attribs);
diff --git a/chrome/renderer/render_widget_fullscreen_pepper.cc b/chrome/renderer/render_widget_fullscreen_pepper.cc
index c4b2d50..091a190 100644
--- a/chrome/renderer/render_widget_fullscreen_pepper.cc
+++ b/chrome/renderer/render_widget_fullscreen_pepper.cc
@@ -162,9 +162,6 @@ RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper(
webkit::ppapi::PluginInstance* plugin)
: RenderWidgetFullscreen(render_thread, WebKit::WebPopupTypeSelect),
plugin_(plugin),
-#if defined(OS_MACOSX)
- plugin_handle_(NULL),
-#endif
context_(NULL),
buffer_(0),
program_(0) {
@@ -267,16 +264,6 @@ void RenderWidgetFullscreenPepper::CreateContext() {
GpuChannelHost* host = render_thread->EstablishGpuChannelSync();
if (!host)
return;
- gfx::NativeViewId view_id;
-#if !defined(OS_MACOSX)
- view_id = host_window();
-#else
- Send(new ViewHostMsg_AllocateFakePluginWindowHandle(
- routing_id(), true, true, &plugin_handle_));
- if (!plugin_handle_)
- return;
- view_id = static_cast<gfx::NativeViewId>(plugin_handle_);
-#endif
const int32 attribs[] = {
ggl::GGL_ALPHA_SIZE, 8,
ggl::GGL_DEPTH_SIZE, 0,
@@ -287,7 +274,6 @@ void RenderWidgetFullscreenPepper::CreateContext() {
};
context_ = ggl::CreateViewContext(
host,
- view_id,
routing_id(),
"GL_OES_packed_depth_stencil GL_OES_depth24",
attribs);
@@ -314,13 +300,6 @@ void RenderWidgetFullscreenPepper::DestroyContext() {
ggl::DestroyContext(context_);
context_ = NULL;
}
-#if defined(OS_MACOSX)
- if (plugin_handle_) {
- Send(new ViewHostMsg_DestroyFakePluginWindowHandle(routing_id(),
- plugin_handle_));
- plugin_handle_ = NULL;
- }
-#endif
}
namespace {
diff --git a/chrome/renderer/render_widget_fullscreen_pepper.h b/chrome/renderer/render_widget_fullscreen_pepper.h
index af3c506..9e201da 100644
--- a/chrome/renderer/render_widget_fullscreen_pepper.h
+++ b/chrome/renderer/render_widget_fullscreen_pepper.h
@@ -78,9 +78,6 @@ class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen,
// The plugin instance this widget wraps.
webkit::ppapi::PluginInstance* plugin_;
-#if defined(OS_MACOSX)
- gfx::PluginWindowHandle plugin_handle_;
-#endif
// GL context for compositing.
ggl::Context* context_;
unsigned int buffer_;
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
index 1d8e5d6..0e97b94 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
@@ -27,9 +27,6 @@
WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl()
: context_(NULL),
web_view_(NULL),
-#if defined(OS_MACOSX)
- plugin_handle_(NULL),
-#endif // defined(OS_MACOSX)
cached_width_(0),
cached_height_(0),
bound_fbo_(0) {
@@ -37,19 +34,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl()
WebGraphicsContext3DCommandBufferImpl::
~WebGraphicsContext3DCommandBufferImpl() {
-#if defined(OS_MACOSX)
- if (web_view_) {
- DCHECK(plugin_handle_ != gfx::kNullPluginWindow);
- RenderView* renderview = RenderView::FromWebView(web_view_);
- // The RenderView might already have been freed, but in its
- // destructor it destroys all fake plugin window handles it
- // allocated.
- if (renderview) {
- renderview->DestroyFakePluginWindowHandle(plugin_handle_);
- }
- plugin_handle_ = gfx::kNullPluginWindow;
- }
-#endif
if (context_) {
ggl::DestroyContext(context_);
}
@@ -101,18 +85,10 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize(
RenderView* renderview = RenderView::FromWebView(web_view);
if (!renderview)
return false;
- gfx::NativeViewId view_id;
-#if !defined(OS_MACOSX)
- view_id = renderview->host_window();
-#else
- plugin_handle_ = renderview->AllocateFakePluginWindowHandle(
- /*opaque=*/true, /*root=*/true);
- view_id = static_cast<gfx::NativeViewId>(plugin_handle_);
-#endif
+
web_view_ = web_view;
context_ = ggl::CreateViewContext(
host,
- view_id,
renderview->routing_id(),
kWebGraphicsContext3DPerferredGLExtensions,
attribs);
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
index 4d92240..c70c80f 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
@@ -387,10 +387,6 @@ class WebGraphicsContext3DCommandBufferImpl
ggl::Context* context_;
// If rendering directly to WebView, weak pointer to it.
WebKit::WebView* web_view_;
-#if defined(OS_MACOSX)
- // "Fake" plugin window handle in browser process for the compositor's output.
- gfx::PluginWindowHandle plugin_handle_;
-#endif
WebKit::WebGraphicsContext3D::Attributes attributes_;
int cached_width_, cached_height_;