OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "gpu/config/gpu_control_list.h" | 5 #include "gpu/config/gpu_control_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 20 matching lines...) Expand all Loading... |
31 std::vector<std::string>* version) { | 31 std::vector<std::string>* version) { |
32 DCHECK(version); | 32 DCHECK(version); |
33 *version = base::SplitString( | 33 *version = base::SplitString( |
34 version_string, std::string(1, splitter), | 34 version_string, std::string(1, splitter), |
35 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 35 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
36 if (version->size() == 0) | 36 if (version->size() == 0) |
37 return false; | 37 return false; |
38 // If the splitter is '-', we assume it's a date with format "mm-dd-yyyy"; | 38 // If the splitter is '-', we assume it's a date with format "mm-dd-yyyy"; |
39 // we split it into the order of "yyyy", "mm", "dd". | 39 // we split it into the order of "yyyy", "mm", "dd". |
40 if (splitter == '-') { | 40 if (splitter == '-') { |
41 std::string year = (*version)[version->size() - 1]; | 41 std::string year = version->back(); |
42 for (int i = version->size() - 1; i > 0; --i) { | 42 for (int i = version->size() - 1; i > 0; --i) { |
43 (*version)[i] = (*version)[i - 1]; | 43 (*version)[i] = (*version)[i - 1]; |
44 } | 44 } |
45 (*version)[0] = year; | 45 (*version)[0] = year; |
46 } | 46 } |
47 bool all_zero = true; | 47 bool all_zero = true; |
48 for (size_t i = 0; i < version->size(); ++i) { | 48 for (size_t i = 0; i < version->size(); ++i) { |
49 unsigned num = 0; | 49 unsigned num = 0; |
50 if (!base::StringToUint((*version)[i], &num)) | 50 if (!base::StringToUint((*version)[i], &num)) |
51 return false; | 51 return false; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 const char kGLTypeStringGL[] = "gl"; | 119 const char kGLTypeStringGL[] = "gl"; |
120 const char kGLTypeStringGLES[] = "gles"; | 120 const char kGLTypeStringGLES[] = "gles"; |
121 const char kGLTypeStringANGLE[] = "angle"; | 121 const char kGLTypeStringANGLE[] = "angle"; |
122 | 122 |
123 const char kVersionStyleStringNumerical[] = "numerical"; | 123 const char kVersionStyleStringNumerical[] = "numerical"; |
124 const char kVersionStyleStringLexical[] = "lexical"; | 124 const char kVersionStyleStringLexical[] = "lexical"; |
125 | 125 |
126 const char kOp[] = "op"; | 126 const char kOp[] = "op"; |
127 | 127 |
128 } // namespace anonymous | 128 } // namespace |
129 | 129 |
130 GpuControlList::VersionInfo::VersionInfo( | 130 GpuControlList::VersionInfo::VersionInfo( |
131 const std::string& version_op, | 131 const std::string& version_op, |
132 const std::string& version_style, | 132 const std::string& version_style, |
133 const std::string& version_string, | 133 const std::string& version_string, |
134 const std::string& version_string2) | 134 const std::string& version_string2) |
135 : version_style_(kVersionStyleNumerical) { | 135 : version_style_(kVersionStyleNumerical) { |
136 op_ = StringToNumericOp(version_op); | 136 op_ = StringToNumericOp(version_op); |
137 if (op_ == kUnknown || op_ == kAny) | 137 if (op_ == kUnknown || op_ == kAny) |
138 return; | 138 return; |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 const std::string& feature_name, int feature_id) { | 1616 const std::string& feature_name, int feature_id) { |
1617 feature_map_[feature_name] = feature_id; | 1617 feature_map_[feature_name] = feature_id; |
1618 } | 1618 } |
1619 | 1619 |
1620 void GpuControlList::set_supports_feature_type_all(bool supported) { | 1620 void GpuControlList::set_supports_feature_type_all(bool supported) { |
1621 supports_feature_type_all_ = supported; | 1621 supports_feature_type_all_ = supported; |
1622 } | 1622 } |
1623 | 1623 |
1624 } // namespace gpu | 1624 } // namespace gpu |
1625 | 1625 |
OLD | NEW |