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

Side by Side Diff: trunk/src/ui/gl/gl_surface_x11.cc

Issue 238093002: Revert 263726 "x11: Remove X11 message-pump." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/ui/gl/gl_surface_glx.cc ('k') | trunk/src/ui/views/examples/examples_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "third_party/mesa/src/include/GL/osmesa.h" 11 #include "third_party/mesa/src/include/GL/osmesa.h"
12 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gfx/x/x11_types.h"
14 #include "ui/gl/gl_bindings.h" 13 #include "ui/gl/gl_bindings.h"
15 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
16 #include "ui/gl/gl_surface_egl.h" 15 #include "ui/gl/gl_surface_egl.h"
17 #include "ui/gl/gl_surface_glx.h" 16 #include "ui/gl/gl_surface_glx.h"
18 #include "ui/gl/gl_surface_osmesa.h" 17 #include "ui/gl/gl_surface_osmesa.h"
19 #include "ui/gl/gl_surface_stub.h" 18 #include "ui/gl/gl_surface_stub.h"
20 19
21 namespace gfx { 20 namespace gfx {
22 21
23 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a 22 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 default: 72 default:
74 break; 73 break;
75 } 74 }
76 75
77 return true; 76 return true;
78 } 77 }
79 78
80 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( 79 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa(
81 gfx::AcceleratedWidget window) 80 gfx::AcceleratedWidget window)
82 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)), 81 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)),
83 xdisplay_(gfx::GetXDisplay()), 82 xdisplay_(base::MessagePumpForUI::GetDefaultXDisplay()),
84 window_graphics_context_(0), 83 window_graphics_context_(0),
85 window_(window), 84 window_(window),
86 pixmap_graphics_context_(0), 85 pixmap_graphics_context_(0),
87 pixmap_(0) { 86 pixmap_(0) {
88 DCHECK(xdisplay_); 87 DCHECK(xdisplay_);
89 DCHECK(window_); 88 DCHECK(window_);
90 } 89 }
91 90
92 // static 91 // static
93 bool NativeViewGLSurfaceOSMesa::InitializeOneOff() { 92 bool NativeViewGLSurfaceOSMesa::InitializeOneOff() {
94 static bool initialized = false; 93 static bool initialized = false;
95 if (initialized) 94 if (initialized)
96 return true; 95 return true;
97 96
98 if (!gfx::GetXDisplay()) { 97 if (!base::MessagePumpForUI::GetDefaultXDisplay()) {
99 LOG(ERROR) << "XOpenDisplay failed."; 98 LOG(ERROR) << "XOpenDisplay failed.";
100 return false; 99 return false;
101 } 100 }
102 101
103 initialized = true; 102 initialized = true;
104 return true; 103 return true;
105 } 104 }
106 105
107 bool NativeViewGLSurfaceOSMesa::Initialize() { 106 bool NativeViewGLSurfaceOSMesa::Initialize() {
108 if (!GLSurfaceOSMesa::Initialize()) 107 if (!GLSurfaceOSMesa::Initialize())
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 334 }
336 case kGLImplementationMockGL: 335 case kGLImplementationMockGL:
337 return new GLSurfaceStub; 336 return new GLSurfaceStub;
338 default: 337 default:
339 NOTREACHED(); 338 NOTREACHED();
340 return NULL; 339 return NULL;
341 } 340 }
342 } 341 }
343 342
344 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 343 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
345 return gfx::GetXDisplay(); 344 return base::MessagePumpForUI::GetDefaultXDisplay();
346 } 345 }
347 346
348 } // namespace gfx 347 } // namespace gfx
OLDNEW
« no previous file with comments | « trunk/src/ui/gl/gl_surface_glx.cc ('k') | trunk/src/ui/views/examples/examples_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698