Index: ui/gl/gl_surface.cc |
diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc |
index 4716e58b48ff54ad8138c3d79b92e7b93a784a79..53befbc0741f04087b1b98c583370420045bffa9 100644 |
--- a/ui/gl/gl_surface.cc |
+++ b/ui/gl/gl_surface.cc |
@@ -30,35 +30,14 @@ bool GLSurface::InitializeOneOff() { |
TRACE_EVENT0("gpu,startup", "GLSurface::InitializeOneOff"); |
- std::vector<GLImplementation> allowed_impls; |
- GetAllowedGLImplementations(&allowed_impls); |
- DCHECK(!allowed_impls.empty()); |
+ GLImplementation impl = kGLImplementationNone; |
+ bool fallback_to_osmesa = false; |
+ bool result = SelectGLImplementation(&impl, &fallback_to_osmesa); |
+ if (!result) |
+ return false; |
base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
- // The default implementation is always the first one in list. |
- GLImplementation impl = allowed_impls[0]; |
- bool fallback_to_osmesa = false; |
- if (cmd->HasSwitch(switches::kOverrideUseGLWithOSMesaForTests)) { |
- impl = kGLImplementationOSMesaGL; |
- } else if (cmd->HasSwitch(switches::kUseGL)) { |
- std::string requested_implementation_name = |
- cmd->GetSwitchValueASCII(switches::kUseGL); |
- if (requested_implementation_name == "any") { |
- fallback_to_osmesa = true; |
- } else if (requested_implementation_name == |
- kGLImplementationSwiftShaderName || |
- requested_implementation_name == kGLImplementationANGLEName) { |
- impl = kGLImplementationEGLGLES2; |
- } else { |
- impl = GetNamedGLImplementation(requested_implementation_name); |
- if (!ContainsValue(allowed_impls, impl)) { |
- LOG(ERROR) << "Requested GL implementation is not available."; |
- return false; |
- } |
- } |
- } |
- |
bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging); |
bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests); |