summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/gpu/gpu_process_host_ui_shim.cc39
-rw-r--r--content/browser/gpu/gpu_process_host_ui_shim.h2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_base.h1
-rw-r--r--content/browser/renderer_host/render_widget_host_view_gtk.cc10
-rw-r--r--content/browser/renderer_host/render_widget_host_view_gtk.h1
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc12
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.h1
-rw-r--r--content/port/browser/render_widget_host_view_port.h3
8 files changed, 29 insertions, 40 deletions
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
index 5081042..d1dfc01 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -22,14 +22,6 @@
#include "content/public/browser/browser_thread.h"
#include "ui/gl/gl_switches.h"
-#if defined(TOOLKIT_GTK)
-// These two #includes need to come after gpu_messages.h.
-#include "ui/base/x/x11_util.h"
-#include "ui/gfx/size.h"
-#include <gdk/gdk.h> // NOLINT
-#include <gdk/gdkx.h> // NOLINT
-#endif
-
// From gl2/gl2ext.h.
#ifndef GL_MAILBOX_SIZE_CHROMIUM
#define GL_MAILBOX_SIZE_CHROMIUM 64
@@ -207,9 +199,7 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
OnUpdateVSyncParameters)
IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn)
-#if defined(TOOLKIT_GTK) || defined(OS_WIN)
IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
-#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -251,8 +241,6 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected(
GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
}
-#if defined(TOOLKIT_GTK) || defined(OS_WIN)
-
void GpuProcessHostUIShim::OnResizeView(int32 surface_id,
int32 route_id,
gfx::Size size) {
@@ -268,34 +256,9 @@ void GpuProcessHostUIShim::OnResizeView(int32 surface_id,
if (!view)
return;
- gfx::GLSurfaceHandle surface = view->GetCompositingSurface();
-
- // Resize the window synchronously. The GPU process must not issue GL
- // calls on the command buffer until the window is the size it expects it
- // to be.
-#if defined(TOOLKIT_GTK)
- GdkWindow* window = reinterpret_cast<GdkWindow*>(
- gdk_xid_table_lookup(surface.handle));
- if (window) {
- Display* display = GDK_WINDOW_XDISPLAY(window);
- gdk_window_resize(window, size.width(), size.height());
- XSync(display, False);
- }
-#elif defined(OS_WIN)
- // Ensure window does not have zero area because D3D cannot create a zero
- // area swap chain.
- SetWindowPos(surface.handle,
- NULL,
- 0, 0,
- std::max(1, size.width()),
- std::max(1, size.height()),
- SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
- SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOMOVE);
-#endif
+ view->ResizeCompositingSurface(size);
}
-#endif
-
static base::TimeDelta GetSwapDelay() {
CommandLine* cmd_line = CommandLine::ForCurrentProcess();
int delay = 0;
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h
index 9f4329a..2534100 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.h
+++ b/content/browser/gpu/gpu_process_host_ui_shim.h
@@ -87,11 +87,9 @@ class GpuProcessHostUIShim : public IPC::Listener,
void OnLogMessage(int level, const std::string& header,
const std::string& message);
-#if defined(TOOLKIT_GTK) || defined(OS_WIN)
void OnResizeView(int32 surface_id,
int32 route_id,
gfx::Size size);
-#endif
void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info);
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
index 2f0b3d7..459afee 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.h
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -84,6 +84,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
virtual void OnSwapCompositorFrame(
uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) OVERRIDE {}
+ virtual void ResizeCompositingSurface(const gfx::Size&) OVERRIDE {}
virtual void OnOverscrolled(gfx::Vector2dF accumulated_overscroll,
gfx::Vector2dF current_fling_velocity) OVERRIDE;
virtual uint32 RendererFrameNumber() OVERRIDE;
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc
index 9c05bca..001fac8 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -1294,6 +1294,16 @@ gfx::GLSurfaceHandle RenderWidgetHostViewGtk::GetCompositingSurface() {
return gfx::GLSurfaceHandle(compositing_surface_, gfx::NATIVE_TRANSPORT);
}
+void RenderWidgetHostViewGtk::ResizeCompositingSurface(const gfx::Size& size) {
+ GtkWidget* widget = view_.get();
+ GdkWindow* window = gtk_widget_get_window(widget);
+ if (window) {
+ Display* display = GDK_WINDOW_XDISPLAY(window);
+ gdk_window_resize(window, size.width(), size.height());
+ XSync(display, False);
+ }
+}
+
bool RenderWidgetHostViewGtk::LockMouse() {
if (mouse_locked_)
return true;
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h
index fc57a1a..5e27ac1 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.h
@@ -127,6 +127,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk
virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
+ virtual void ResizeCompositingSurface(const gfx::Size&) OVERRIDE;
virtual bool LockMouse() OVERRIDE;
virtual void UnlockMouse() OVERRIDE;
virtual void OnAccessibilityEvents(
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index 92abb4b..5f458c4 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -2554,6 +2554,18 @@ gfx::GLSurfaceHandle RenderWidgetHostViewWin::GetCompositingSurface() {
return surface_handle;
}
+void RenderWidgetHostViewWin::ResizeCompositingSurface(const gfx::Size& size) {
+ // Ensure window does not have zero area because D3D cannot create a zero
+ // area swap chain.
+ SetWindowPos(compositor_host_window_,
+ NULL,
+ 0, 0,
+ std::max(1, size.width()),
+ std::max(1, size.height()),
+ SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
+ SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOMOVE);
+}
+
void RenderWidgetHostViewWin::OnAcceleratedCompositingStateChange() {
bool show = render_widget_host_->is_accelerated_compositing_active();
// When we first create the compositor, we will get a show request from
diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h
index 70f5df9..84705bb 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -224,6 +224,7 @@ class RenderWidgetHostViewWin
virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
+ virtual void ResizeCompositingSurface(const gfx::Size&) OVERRIDE;
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) OVERRIDE;
diff --git a/content/port/browser/render_widget_host_view_port.h b/content/port/browser/render_widget_host_view_port.h
index 1e0ba5b..f9444b3 100644
--- a/content/port/browser/render_widget_host_view_port.h
+++ b/content/port/browser/render_widget_host_view_port.h
@@ -255,6 +255,9 @@ class CONTENT_EXPORT RenderWidgetHostViewPort : public RenderWidgetHostView,
virtual gfx::GLSurfaceHandle GetCompositingSurface() = 0;
+ // Resize compositing surface.
+ virtual void ResizeCompositingSurface(const gfx::Size&) = 0;
+
// Because the associated remote WebKit instance can asynchronously
// prevent-default on a dispatched touch event, the touch events are queued in
// the GestureRecognizer until invocation of ProcessAckedTouchEvent releases