| 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> | |
| 8 #include <vector> | 7 #include <vector> |
| 9 | 8 |
| 10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 11 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" |
| 13 #include "base/threading/thread_local.h" | 13 #include "base/threading/thread_local.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "ui/gfx/swap_result.h" | 15 #include "ui/gfx/swap_result.h" |
| 16 #include "ui/gl/gl_context.h" | 16 #include "ui/gl/gl_context.h" |
| 17 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/gl/gl_switches.h" | 18 #include "ui/gl/gl_switches.h" |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 43 impl = kGLImplementationOSMesaGL; | 43 impl = kGLImplementationOSMesaGL; |
| 44 } else if (cmd->HasSwitch(switches::kUseGL)) { | 44 } else if (cmd->HasSwitch(switches::kUseGL)) { |
| 45 std::string requested_implementation_name = | 45 std::string requested_implementation_name = |
| 46 cmd->GetSwitchValueASCII(switches::kUseGL); | 46 cmd->GetSwitchValueASCII(switches::kUseGL); |
| 47 if (requested_implementation_name == "any") { | 47 if (requested_implementation_name == "any") { |
| 48 fallback_to_osmesa = true; | 48 fallback_to_osmesa = true; |
| 49 } else if (requested_implementation_name == "swiftshader") { | 49 } else if (requested_implementation_name == "swiftshader") { |
| 50 impl = kGLImplementationEGLGLES2; | 50 impl = kGLImplementationEGLGLES2; |
| 51 } else { | 51 } else { |
| 52 impl = GetNamedGLImplementation(requested_implementation_name); | 52 impl = GetNamedGLImplementation(requested_implementation_name); |
| 53 if (std::find(allowed_impls.begin(), | 53 if (!ContainsValue(allowed_impls, impl)) { |
| 54 allowed_impls.end(), | |
| 55 impl) == allowed_impls.end()) { | |
| 56 LOG(ERROR) << "Requested GL implementation is not available."; | 54 LOG(ERROR) << "Requested GL implementation is not available."; |
| 57 return false; | 55 return false; |
| 58 } | 56 } |
| 59 } | 57 } |
| 60 } | 58 } |
| 61 | 59 |
| 62 bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging); | 60 bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging); |
| 63 bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests); | 61 bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests); |
| 64 | 62 |
| 65 return InitializeOneOffImplementation( | 63 return InitializeOneOffImplementation( |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 z_order, transform, image, bounds_rect, crop_rect); | 368 z_order, transform, image, bounds_rect, crop_rect); |
| 371 } | 369 } |
| 372 | 370 |
| 373 bool GLSurfaceAdapter::IsSurfaceless() const { | 371 bool GLSurfaceAdapter::IsSurfaceless() const { |
| 374 return surface_->IsSurfaceless(); | 372 return surface_->IsSurfaceless(); |
| 375 } | 373 } |
| 376 | 374 |
| 377 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 375 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
| 378 | 376 |
| 379 } // namespace gfx | 377 } // namespace gfx |
| OLD | NEW |