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

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

Issue 2022983003: Roll base to 5e00da80f6adb7082d1c0e88d3274cf87cc43bc5 and tonic to f7acabb8fa6c91124486a41194eac3cd… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 months 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/android/java/src/org/chromium/ui/gl/VSyncProvider.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_version_info.h" 5 #include "ui/gl/gl_version_info.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str) 13 GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str)
14 : is_es(false), 14 : is_es(false),
15 is_angle(false), 15 is_angle(false),
16 major_version(0), 16 major_version(0),
17 minor_version(0), 17 minor_version(0),
18 is_es3(false) { 18 is_es3(false) {
19 if (version_str) { 19 if (version_str) {
20 std::string lstr(base::StringToLowerASCII(std::string(version_str))); 20 std::string lstr(base::ToLowerASCII(std::string(version_str)));
21 is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); 21 is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es");
22 if (is_es) 22 if (is_es)
23 lstr = lstr.substr(10, 3); 23 lstr = lstr.substr(10, 3);
24 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), "."); 24 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), ".");
25 unsigned major, minor; 25 unsigned major, minor;
26 if (tokenizer.GetNext() && 26 if (tokenizer.GetNext() &&
27 base::StringToUint(tokenizer.token_piece(), &major)) { 27 base::StringToUint(tokenizer.token_piece(), &major)) {
28 major_version = major; 28 major_version = major;
29 if (tokenizer.GetNext() && 29 if (tokenizer.GetNext() &&
30 base::StringToUint(tokenizer.token_piece(), &minor)) { 30 base::StringToUint(tokenizer.token_piece(), &minor)) {
31 minor_version = minor; 31 minor_version = minor;
32 } 32 }
33 } 33 }
34 if (is_es && major_version == 3) 34 if (is_es && major_version == 3)
35 is_es3 = true; 35 is_es3 = true;
36 } 36 }
37 if (renderer_str) { 37 if (renderer_str) {
38 is_angle = 38 is_angle =
39 base::StartsWith(renderer_str, "ANGLE", base::CompareCase::SENSITIVE); 39 base::StartsWith(renderer_str, "ANGLE", base::CompareCase::SENSITIVE);
40 } 40 }
41 } 41 }
42 42
43 } // namespace gfx 43 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/android/java/src/org/chromium/ui/gl/VSyncProvider.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698