Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: ui/gl/gl_surface.cc

Issue 1485093003: ui: use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/stl_util.h"
13 #include "base/threading/thread_local.h" 14 #include "base/threading/thread_local.h"
14 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
15 #include "ui/gfx/swap_result.h" 16 #include "ui/gfx/swap_result.h"
16 #include "ui/gl/gl_context.h" 17 #include "ui/gl/gl_context.h"
17 #include "ui/gl/gl_implementation.h" 18 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_switches.h" 19 #include "ui/gl/gl_switches.h"
19 20
20 namespace gfx { 21 namespace gfx {
21 22
22 namespace { 23 namespace {
(...skipping 20 matching lines...) Expand all
43 impl = kGLImplementationOSMesaGL; 44 impl = kGLImplementationOSMesaGL;
44 } else if (cmd->HasSwitch(switches::kUseGL)) { 45 } else if (cmd->HasSwitch(switches::kUseGL)) {
45 std::string requested_implementation_name = 46 std::string requested_implementation_name =
46 cmd->GetSwitchValueASCII(switches::kUseGL); 47 cmd->GetSwitchValueASCII(switches::kUseGL);
47 if (requested_implementation_name == "any") { 48 if (requested_implementation_name == "any") {
48 fallback_to_osmesa = true; 49 fallback_to_osmesa = true;
49 } else if (requested_implementation_name == "swiftshader") { 50 } else if (requested_implementation_name == "swiftshader") {
50 impl = kGLImplementationEGLGLES2; 51 impl = kGLImplementationEGLGLES2;
51 } else { 52 } else {
52 impl = GetNamedGLImplementation(requested_implementation_name); 53 impl = GetNamedGLImplementation(requested_implementation_name);
53 if (std::find(allowed_impls.begin(), 54 if (!ContainsValue(allowed_impls, impl)) {
sky 2015/12/01 22:08:31 nit: nuke {}
tfarina 2015/12/02 20:31:41 Done.
54 allowed_impls.end(),
55 impl) == allowed_impls.end()) {
56 LOG(ERROR) << "Requested GL implementation is not available."; 55 LOG(ERROR) << "Requested GL implementation is not available.";
57 return false; 56 return false;
58 } 57 }
59 } 58 }
60 } 59 }
61 60
62 bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging); 61 bool gpu_service_logging = cmd->HasSwitch(switches::kEnableGPUServiceLogging);
63 bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests); 62 bool disable_gl_drawing = cmd->HasSwitch(switches::kDisableGLDrawingForTests);
64 63
65 return InitializeOneOffImplementation( 64 return InitializeOneOffImplementation(
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 z_order, transform, image, bounds_rect, crop_rect); 369 z_order, transform, image, bounds_rect, crop_rect);
371 } 370 }
372 371
373 bool GLSurfaceAdapter::IsSurfaceless() const { 372 bool GLSurfaceAdapter::IsSurfaceless() const {
374 return surface_->IsSurfaceless(); 373 return surface_->IsSurfaceless();
375 } 374 }
376 375
377 GLSurfaceAdapter::~GLSurfaceAdapter() {} 376 GLSurfaceAdapter::~GLSurfaceAdapter() {}
378 377
379 } // namespace gfx 378 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698