| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/init/gl_initializer.h" | 5 #include "ui/gl/init/gl_initializer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "ui/gfx/switches.h" | |
| 13 #include "ui/gfx/x/x11_types.h" | 12 #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_egl_api_implementation.h" | 14 #include "ui/gl/gl_egl_api_implementation.h" |
| 16 #include "ui/gl/gl_gl_api_implementation.h" | 15 #include "ui/gl/gl_gl_api_implementation.h" |
| 17 #include "ui/gl/gl_glx_api_implementation.h" | 16 #include "ui/gl/gl_glx_api_implementation.h" |
| 18 #include "ui/gl/gl_implementation_osmesa.h" | 17 #include "ui/gl/gl_implementation_osmesa.h" |
| 19 #include "ui/gl/gl_osmesa_api_implementation.h" | 18 #include "ui/gl/gl_osmesa_api_implementation.h" |
| 20 #include "ui/gl/gl_surface_egl.h" | 19 #include "ui/gl/gl_surface_egl.h" |
| 21 #include "ui/gl/gl_surface_glx.h" | 20 #include "ui/gl/gl_surface_glx.h" |
| 22 #include "ui/gl/gl_surface_osmesa_x11.h" | 21 #include "ui/gl/gl_surface_osmesa_x11.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 117 |
| 119 InitializeStaticGLBindingsGL(); | 118 InitializeStaticGLBindingsGL(); |
| 120 InitializeStaticGLBindingsEGL(); | 119 InitializeStaticGLBindingsEGL(); |
| 121 | 120 |
| 122 return true; | 121 return true; |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace | 124 } // namespace |
| 126 | 125 |
| 127 bool InitializeGLOneOffPlatform() { | 126 bool InitializeGLOneOffPlatform() { |
| 128 const base::CommandLine* command_line = | |
| 129 base::CommandLine::ForCurrentProcess(); | |
| 130 if (command_line->HasSwitch(switches::kHeadless)) | |
| 131 return true; | |
| 132 | |
| 133 switch (GetGLImplementation()) { | 127 switch (GetGLImplementation()) { |
| 134 case kGLImplementationDesktopGL: | 128 case kGLImplementationDesktopGL: |
| 135 if (!GLSurfaceGLX::InitializeOneOff()) { | 129 if (!GLSurfaceGLX::InitializeOneOff()) { |
| 136 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; | 130 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; |
| 137 return false; | 131 return false; |
| 138 } | 132 } |
| 139 return true; | 133 return true; |
| 140 case kGLImplementationOSMesaGL: | 134 case kGLImplementationOSMesaGL: |
| 141 if (!GLSurfaceOSMesaX11::InitializeOneOff()) { | 135 if (!GLSurfaceOSMesaX11::InitializeOneOff()) { |
| 142 LOG(ERROR) << "GLSurfaceOSMesaX11::InitializeOneOff failed."; | 136 LOG(ERROR) << "GLSurfaceOSMesaX11::InitializeOneOff failed."; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 void ShutdownGLPlatform() { | 188 void ShutdownGLPlatform() { |
| 195 GLSurfaceEGL::ShutdownOneOff(); | 189 GLSurfaceEGL::ShutdownOneOff(); |
| 196 ClearBindingsEGL(); | 190 ClearBindingsEGL(); |
| 197 ClearBindingsGL(); | 191 ClearBindingsGL(); |
| 198 ClearBindingsGLX(); | 192 ClearBindingsGLX(); |
| 199 ClearBindingsOSMESA(); | 193 ClearBindingsOSMESA(); |
| 200 } | 194 } |
| 201 | 195 |
| 202 } // namespace init | 196 } // namespace init |
| 203 } // namespace gl | 197 } // namespace gl |
| OLD | NEW |