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

Unified Diff: chrome/browser/gpu_process_host.cc

Issue 5105006: Resize synchronization for Linux. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: make -j17 all is my friend (fix the test build). Created 10 years, 1 month 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.h ('k') | chrome/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gpu_process_host.cc
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index 639d1006dfe3969952e4cc2ae51c7f7ca1e40365..63f9432a960bda423203710997e820ae6e43e656 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -22,8 +22,11 @@
#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"
+#include "gfx/size.h"
#endif
namespace {
@@ -161,6 +164,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)
@@ -214,7 +218,24 @@ void GetViewXIDDispatcher(gfx::NativeViewId id, IPC::Message* reply_msg) {
NewRunnableFunction(&SendDelayedReply, reply_msg));
}
-} // namespace
+void ResizeXIDDispatcher(unsigned long xid, gfx::Size size,
+ 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, size.width(), size.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,
IPC::Message *reply_msg) {
@@ -224,6 +245,14 @@ void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id,
NewRunnableFunction(&GetViewXIDDispatcher, id, reply_msg));
}
+void GpuProcessHost::OnResizeXID(unsigned long xid, gfx::Size size,
+ IPC::Message *reply_msg) {
+ // Have to resize the window from UI thread.
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&ResizeXIDDispatcher, xid, size, reply_msg));
+}
+
#elif defined(OS_MACOSX)
namespace {
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698