| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 std::vector<GLImplementation> allowed_impls; | 36 std::vector<GLImplementation> allowed_impls; |
| 37 GetAllowedGLImplementations(&allowed_impls); | 37 GetAllowedGLImplementations(&allowed_impls); |
| 38 DCHECK(!allowed_impls.empty()); | 38 DCHECK(!allowed_impls.empty()); |
| 39 | 39 |
| 40 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 40 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 41 | 41 |
| 42 // The default implementation is always the first one in list. | 42 // The default implementation is always the first one in list. |
| 43 GLImplementation impl = allowed_impls[0]; | 43 GLImplementation impl = allowed_impls[0]; |
| 44 bool fallback_to_osmesa = false; | 44 bool fallback_to_osmesa = false; |
| 45 if (cmd->HasSwitch(switches::kUseGL)) { | 45 if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) { |
| 46 impl = kGLImplementationOSMesaGL; |
| 47 } else if (cmd->HasSwitch(switches::kUseGL)) { |
| 46 std::string requested_implementation_name = | 48 std::string requested_implementation_name = |
| 47 cmd->GetSwitchValueASCII(switches::kUseGL); | 49 cmd->GetSwitchValueASCII(switches::kUseGL); |
| 48 if (requested_implementation_name == "any") { | 50 if (requested_implementation_name == "any") { |
| 49 fallback_to_osmesa = true; | 51 fallback_to_osmesa = true; |
| 50 } else if (requested_implementation_name == "swiftshader") { | 52 } else if (requested_implementation_name == "swiftshader") { |
| 51 impl = kGLImplementationEGLGLES2; | 53 impl = kGLImplementationEGLGLES2; |
| 52 } else { | 54 } else { |
| 53 impl = GetNamedGLImplementation(requested_implementation_name); | 55 impl = GetNamedGLImplementation(requested_implementation_name); |
| 54 if (std::find(allowed_impls.begin(), | 56 if (std::find(allowed_impls.begin(), |
| 55 allowed_impls.end(), | 57 allowed_impls.end(), |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 return surface_->GetFormat(); | 330 return surface_->GetFormat(); |
| 329 } | 331 } |
| 330 | 332 |
| 331 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { | 333 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { |
| 332 return surface_->GetVSyncProvider(); | 334 return surface_->GetVSyncProvider(); |
| 333 } | 335 } |
| 334 | 336 |
| 335 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 337 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
| 336 | 338 |
| 337 } // namespace gfx | 339 } // namespace gfx |
| OLD | NEW |