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

Unified Diff: ui/gl/gl_surface_glx.cc

Issue 24127004: Disable child X window workaround when running in test harnesses that do (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_glx.cc
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 04e1589e079406eabdf004a1f6a893c488dd285a..10020d30d9d1fff7cc3e781c20ab9fdb648057ed 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -361,6 +361,10 @@ class XExposeEventForwarder : public base::MessagePumpObserver {
static base::LazyInstance<XExposeEventForwarder> g_xexpose_event_forwarder =
LAZY_INSTANCE_INITIALIZER;
+
+// Do not use this workaround when running in test harnesses that do not have
+// a message loop or do not have a TYPE_GPU message loop.
+bool g_create_child_windows = false;
#endif
} // namespace
@@ -382,7 +386,11 @@ bool GLSurfaceGLX::InitializeOneOff() {
#if defined(TOOLKIT_GTK)
// Be sure to use the X display handle and not the GTK display handle if this
// is the GPU process.
- if (base::MessageLoop::current()->type() == base::MessageLoop::TYPE_GPU)
+ g_create_child_windows =
+ base::MessageLoop::current() &&
+ base::MessageLoop::current()->type() == base::MessageLoop::TYPE_GPU;
+
+ if (g_create_child_windows)
g_display = base::MessagePumpX11::GetDefaultXDisplay();
else
g_display = base::MessagePumpForUI::GetDefaultXDisplay();
@@ -475,6 +483,9 @@ void NativeViewGLSurfaceGLX::SetFrontbufferAllocation(bool allocated) {
}
void NativeViewGLSurfaceGLX::AdjustBufferAllocation() {
+ if (!g_create_child_windows)
+ return;
+
if (frontbuffer_allocated_ || backbuffer_allocated_)
CreateChildWindow();
else
@@ -482,6 +493,8 @@ void NativeViewGLSurfaceGLX::AdjustBufferAllocation() {
}
void NativeViewGLSurfaceGLX::CreateChildWindow() {
+ DCHECK(g_create_child_windows);
+
if (child_window_)
return;
@@ -523,12 +536,13 @@ NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window)
gfx::AcceleratedWidget NativeViewGLSurfaceGLX::GetDrawableHandle() const {
#if defined(TOOLKIT_GTK)
- if (child_window_)
- return child_window_;
- return dummy_window_;
-#else
- return parent_window_;
+ if (g_create_child_windows) {
+ if (child_window_)
+ return child_window_;
+ return dummy_window_;
+ }
#endif
+ return parent_window_;
}
bool NativeViewGLSurfaceGLX::Initialize() {
@@ -543,12 +557,14 @@ bool NativeViewGLSurfaceGLX::Initialize() {
gfx::AcceleratedWidget window_for_vsync = parent_window_;
#if defined(TOOLKIT_GTK)
- dummy_window_ = XCreateWindow(
- g_display,
- RootWindow(g_display, XScreenNumberOfScreen(attributes.screen)),
- 0, 0, 1, 1, 0, CopyFromParent, InputOutput, attributes.visual, 0, NULL);
- window_for_vsync = dummy_window_;
- CreateChildWindow();
+ if (g_create_child_windows) {
+ dummy_window_ = XCreateWindow(
+ g_display,
+ RootWindow(g_display, XScreenNumberOfScreen(attributes.screen)),
+ 0, 0, 1, 1, 0, CopyFromParent, InputOutput, attributes.visual, 0, NULL);
+ window_for_vsync = dummy_window_;
+ CreateChildWindow();
+ }
#endif
if (g_glx_oml_sync_control_supported)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698