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

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: review + view.cc fix 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
« no previous file with comments | « ui/gl/gl_gl_api_implementation.cc ('k') | ui/message_center/message_center_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
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
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
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
OLDNEW
« no previous file with comments | « ui/gl/gl_gl_api_implementation.cc ('k') | ui/message_center/message_center_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698