Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3985)

Unified Diff: chrome/browser/gpu_process_host_ui_shim.cc

Issue 6343006: Route IPC through browser when creating a viewable command buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gpu_process_host_ui_shim.h ('k') | chrome/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gpu_process_host_ui_shim.cc
diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc
index 5419a44a1de77def85b579fc7379d4064072e446..b27912798bf520ac6555527704fe635f94613818 100644
--- a/chrome/browser/gpu_process_host_ui_shim.cc
+++ b/chrome/browser/gpu_process_host_ui_shim.cc
@@ -111,6 +111,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);
@@ -120,6 +146,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) {
@@ -133,25 +184,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));
@@ -203,26 +235,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,
@@ -232,31 +244,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;
-}
« no previous file with comments | « chrome/browser/gpu_process_host_ui_shim.h ('k') | chrome/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698