| 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_factory.h" | 5 #include "ui/gl/init/gl_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing); | 57 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing); |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool InitializeGLOneOffImplementation(GLImplementation impl, | 60 bool InitializeGLOneOffImplementation(GLImplementation impl, |
| 61 bool fallback_to_osmesa, | 61 bool fallback_to_osmesa, |
| 62 bool gpu_service_logging, | 62 bool gpu_service_logging, |
| 63 bool disable_gl_drawing) { | 63 bool disable_gl_drawing) { |
| 64 bool initialized = | 64 bool initialized = |
| 65 InitializeStaticGLBindings(impl) && InitializeGLOneOffPlatform(); | 65 InitializeStaticGLBindings(impl) && InitializeGLOneOffPlatform(); |
| 66 if (!initialized && fallback_to_osmesa) { | 66 if (!initialized && fallback_to_osmesa) { |
| 67 ClearGLBindings(); | 67 ShutdownGL(); |
| 68 initialized = InitializeStaticGLBindings(kGLImplementationOSMesaGL) && | 68 initialized = InitializeStaticGLBindings(kGLImplementationOSMesaGL) && |
| 69 InitializeGLOneOffPlatform(); | 69 InitializeGLOneOffPlatform(); |
| 70 } | 70 } |
| 71 if (!initialized) | 71 if (!initialized) |
| 72 ClearGLBindings(); | 72 ShutdownGL(); |
| 73 | 73 |
| 74 if (initialized) { | 74 if (initialized) { |
| 75 DVLOG(1) << "Using " << GetGLImplementationName(GetGLImplementation()) | 75 DVLOG(1) << "Using " << GetGLImplementationName(GetGLImplementation()) |
| 76 << " GL implementation."; | 76 << " GL implementation."; |
| 77 if (gpu_service_logging) | 77 if (gpu_service_logging) |
| 78 InitializeDebugGLBindings(); | 78 InitializeDebugGLBindings(); |
| 79 if (disable_gl_drawing) | 79 if (disable_gl_drawing) |
| 80 InitializeNullDrawGLBindings(); | 80 InitializeNullDrawGLBindings(); |
| 81 } | 81 } |
| 82 return initialized; | 82 return initialized; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ClearGLBindings() { | 85 void ShutdownGL() { |
| 86 ClearGLBindingsPlatform(); | 86 ShutdownGLPlatform(); |
| 87 | 87 |
| 88 SetGLImplementation(kGLImplementationNone); | 88 SetGLImplementation(kGLImplementationNone); |
| 89 UnloadGLNativeLibraries(); | 89 UnloadGLNativeLibraries(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace init | 92 } // namespace init |
| 93 } // namespace gl | 93 } // namespace gl |
| OLD | NEW |