summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 21:42:06 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 21:42:06 +0000
commitc03a6e7395d13e54365635c6396362a546b796e1 (patch)
treea3321f370dec32331553509591b4174660dec9e9 /ui
parenta7b85b1c6333f420a5eb43d2899ae56ac487df60 (diff)
downloadchromium_src-c03a6e7395d13e54365635c6396362a546b796e1.zip
chromium_src-c03a6e7395d13e54365635c6396362a546b796e1.tar.gz
chromium_src-c03a6e7395d13e54365635c6396362a546b796e1.tar.bz2
Progress towards fixing 77536
This first thing this CL does is plumbs through the surface that the GPU will eventually render to very early on (with the ViewMsg_New and ViewMsg_CreateNew IPCs). Previously, these surfaces were acquired at the time that GPU got a request for a command buffer. This required mediation by the browser UI thread. With this CL, we pre-acquire the surfaces so that they can be passed with the request for the command buffer. This will allow us to handle the request on the browser IO thread. The second thing this CL does is change the surface management a bit. When surfaces were acquired and released when command buffers were created and destroyed, the GPU process host was natural manager of surfaces. This pushes the management further down into the RWHV level and GtkNativeViewManager (on Linux). It fixes a minor resource leak. BUG=first stage of 77536 TEST=By hand WebGL, 3D CSS, Pepper 3D on Linux, Windows, and Mac. Review URL: http://codereview.chromium.org/6840060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/gtk_native_view_id_manager.cc16
-rw-r--r--ui/gfx/gtk_native_view_id_manager.h5
-rw-r--r--ui/gfx/gtk_preserve_window.cc8
3 files changed, 27 insertions, 2 deletions
diff --git a/ui/gfx/gtk_native_view_id_manager.cc b/ui/gfx/gtk_native_view_id_manager.cc
index 3efc3c7..d2a3699 100644
--- a/ui/gfx/gtk_native_view_id_manager.cc
+++ b/ui/gfx/gtk_native_view_id_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -129,6 +129,20 @@ bool GtkNativeViewManager::GetPermanentXIDForId(XID* output,
return true;
}
+bool GtkNativeViewManager::AddRefPermanentXID(XID xid) {
+ base::AutoLock locked(lock_);
+
+ std::map<XID, PermanentXIDInfo>::iterator i =
+ perm_xid_to_info_.find(xid);
+
+ if (i == perm_xid_to_info_.end())
+ return false;
+
+ i->second.ref_count++;
+
+ return true;
+}
+
void GtkNativeViewManager::ReleasePermanentXID(XID xid) {
base::AutoLock locked(lock_);
diff --git a/ui/gfx/gtk_native_view_id_manager.h b/ui/gfx/gtk_native_view_id_manager.h
index 462a51d..6ea16a2 100644
--- a/ui/gfx/gtk_native_view_id_manager.h
+++ b/ui/gfx/gtk_native_view_id_manager.h
@@ -72,6 +72,11 @@ class GtkNativeViewManager {
// returns: true if |id| is a valid id, false otherwise.
bool GetPermanentXIDForId(XID* xid, gfx::NativeViewId id);
+ // Can be called from any thread.
+ // Will return false if the given XID isn't permanent or has already been
+ // released.
+ bool AddRefPermanentXID(XID xid);
+
// Must be called from the UI thread because we may need to access a
// GtkWidget or destroy a GdkWindow.
//
diff --git a/ui/gfx/gtk_preserve_window.cc b/ui/gfx/gtk_preserve_window.cc
index 174e23d..12585f3 100644
--- a/ui/gfx/gtk_preserve_window.cc
+++ b/ui/gfx/gtk_preserve_window.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -82,6 +82,12 @@ static void gtk_preserve_window_realize(GtkWidget* widget) {
gtk_widget_get_parent_window(widget),
widget->allocation.x,
widget->allocation.y);
+ GtkPreserveWindowPrivate* priv = GTK_PRESERVE_WINDOW_GET_PRIVATE(widget);
+ if (!priv->delegate_resize) {
+ gdk_window_resize(widget->window,
+ widget->allocation.width,
+ widget->allocation.height);
+ }
widget->style = gtk_style_attach(widget->style, widget->window);
gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);