| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "ui/gl/gl_share_group.h" | 13 #include "ui/gl/gl_share_group.h" |
| 14 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
| 15 #include "ui/gl/init/gl_initializer.h" | 15 #include "ui/gl/init/gl_initializer.h" |
| 16 | 16 |
| 17 namespace gl { | 17 namespace gl { |
| 18 namespace init { | 18 namespace init { |
| 19 | 19 |
| 20 bool InitializeGLOneOff() { | 20 bool InitializeGLOneOff() { |
| 21 TRACE_EVENT0("gpu,startup", "gl::init::InitializeOneOff"); | 21 TRACE_EVENT0("gpu,startup", "gl::init::InitializeOneOff"); |
| 22 | 22 |
| 23 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 23 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |
| 24 | 24 |
| 25 std::vector<GLImplementation> allowed_impls; | 25 std::vector<GLImplementation> allowed_impls = GetAllowedGLImplementations(); |
| 26 GetAllowedGLImplementations(&allowed_impls); | |
| 27 DCHECK(!allowed_impls.empty()); | 26 DCHECK(!allowed_impls.empty()); |
| 28 | 27 |
| 29 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 28 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 30 | 29 |
| 31 // The default implementation is always the first one in list. | 30 // The default implementation is always the first one in list. |
| 32 GLImplementation impl = allowed_impls[0]; | 31 GLImplementation impl = allowed_impls[0]; |
| 33 bool fallback_to_osmesa = false; | 32 bool fallback_to_osmesa = false; |
| 34 if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) { | 33 if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) { |
| 35 impl = kGLImplementationOSMesaGL; | 34 impl = kGLImplementationOSMesaGL; |
| 36 } else if (cmd->HasSwitch(switches::kUseGL)) { | 35 } else if (cmd->HasSwitch(switches::kUseGL)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 84 |
| 86 void ClearGLBindings() { | 85 void ClearGLBindings() { |
| 87 ClearGLBindingsPlatform(); | 86 ClearGLBindingsPlatform(); |
| 88 | 87 |
| 89 SetGLImplementation(kGLImplementationNone); | 88 SetGLImplementation(kGLImplementationNone); |
| 90 UnloadGLNativeLibraries(); | 89 UnloadGLNativeLibraries(); |
| 91 } | 90 } |
| 92 | 91 |
| 93 } // namespace init | 92 } // namespace init |
| 94 } // namespace gl | 93 } // namespace gl |
| OLD | NEW |