Index: chrome/browser/gpu_process_host.cc |
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc |
index 0e4166a293183ec230f6c31af8afdc7da6dba063..6c3f89612b199fbebf1f9b910332227654b848de 100644 |
--- a/chrome/browser/gpu_process_host.cc |
+++ b/chrome/browser/gpu_process_host.cc |
@@ -22,6 +22,8 @@ |
#include "media/base/media_switches.h" |
#if defined(OS_LINUX) |
+#include <gdk/gdkwindow.h> |
+#include <gdk/gdkx.h> |
#include "app/x11_util.h" |
#include "gfx/gtk_native_view_id_manager.h" |
#endif |
@@ -197,6 +199,7 @@ void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) { |
IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply) |
#if defined(OS_LINUX) |
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID) |
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID) |
#elif defined(OS_MACOSX) |
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface, |
OnAcceleratedSurfaceSetIOSurface) |
@@ -250,6 +253,23 @@ void GetViewXIDDispatcher(gfx::NativeViewId id, IPC::Message* reply_msg) { |
NewRunnableFunction(&SendDelayedReply, reply_msg)); |
} |
+void ResizeXIDDispatcher(unsigned long xid, int32 width, int32 height, |
+ IPC::Message *reply_msg) { |
+ GdkWindow* window = reinterpret_cast<GdkWindow*>(gdk_xid_table_lookup(xid)); |
+ if (window) { |
+ Display* display = GDK_WINDOW_XDISPLAY(window); |
+ gdk_window_resize(window, width, height); |
+ XSync(display, False); |
+ } |
+ |
+ GpuHostMsg_ResizeXID::WriteReplyParams(reply_msg, (window != NULL)); |
+ |
+ // Have to reply from IO thread. |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, FROM_HERE, |
+ NewRunnableFunction(&SendDelayedReply, reply_msg)); |
+} |
+ |
} // namespace |
void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id, |
@@ -260,6 +280,14 @@ void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id, |
NewRunnableFunction(&GetViewXIDDispatcher, id, reply_msg)); |
} |
+void GpuProcessHost::OnResizeXID(unsigned long xid, int32 width, int32 height, |
+ IPC::Message *reply_msg) { |
+ // Have to resize the window from UI thread. |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ NewRunnableFunction(&ResizeXIDDispatcher, xid, width, height, reply_msg)); |
+} |
+ |
#elif defined(OS_MACOSX) |
namespace { |