| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/gl/gl_surface.h" | 5 #include "ui/gfx/gl/gl_surface.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" |
| 9 #if !defined(USE_WAYLAND) | 10 #if !defined(USE_WAYLAND) |
| 10 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" | 11 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" |
| 11 #endif | 12 #endif |
| 12 #include "ui/gfx/gl/gl_bindings.h" | 13 #include "ui/gfx/gl/gl_bindings.h" |
| 13 #include "ui/gfx/gl/gl_implementation.h" | 14 #include "ui/gfx/gl/gl_implementation.h" |
| 14 #include "ui/gfx/gl/gl_surface_egl.h" | 15 #include "ui/gfx/gl/gl_surface_egl.h" |
| 15 #if !defined(USE_WAYLAND) | 16 #if !defined(USE_WAYLAND) |
| 16 #include "ui/gfx/gl/gl_surface_glx.h" | 17 #include "ui/gfx/gl/gl_surface_glx.h" |
| 17 #include "ui/gfx/gl/gl_surface_osmesa.h" | 18 #include "ui/gfx/gl/gl_surface_osmesa.h" |
| 18 #endif | 19 #endif |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 102 |
| 102 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { | 103 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { |
| 103 Destroy(); | 104 Destroy(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 bool NativeViewGLSurfaceOSMesa::InitializeOneOff() { | 107 bool NativeViewGLSurfaceOSMesa::InitializeOneOff() { |
| 107 static bool initialized = false; | 108 static bool initialized = false; |
| 108 if (initialized) | 109 if (initialized) |
| 109 return true; | 110 return true; |
| 110 | 111 |
| 111 g_osmesa_display = XOpenDisplay(NULL); | 112 g_osmesa_display = base::MessagePumpForUI::GetDefaultXDisplay(); |
| 112 if (!g_osmesa_display) { | 113 if (!g_osmesa_display) { |
| 113 LOG(ERROR) << "XOpenDisplay failed."; | 114 LOG(ERROR) << "XOpenDisplay failed."; |
| 114 return false; | 115 return false; |
| 115 } | 116 } |
| 116 | 117 |
| 117 initialized = true; | 118 initialized = true; |
| 118 return true; | 119 return true; |
| 119 } | 120 } |
| 120 | 121 |
| 121 bool NativeViewGLSurfaceOSMesa::Initialize() { | 122 bool NativeViewGLSurfaceOSMesa::Initialize() { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 375 } |
| 375 case kGLImplementationMockGL: | 376 case kGLImplementationMockGL: |
| 376 return new GLSurfaceStub; | 377 return new GLSurfaceStub; |
| 377 default: | 378 default: |
| 378 NOTREACHED(); | 379 NOTREACHED(); |
| 379 return NULL; | 380 return NULL; |
| 380 } | 381 } |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // namespace gfx | 384 } // namespace gfx |
| OLD | NEW |