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 "gpu/config/gpu_util.h" | 5 #include "gpu/config/gpu_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 it != list.end(); ++it) { | 27 it != list.end(); ++it) { |
28 if (!rt.empty()) | 28 if (!rt.empty()) |
29 rt += ","; | 29 rt += ","; |
30 rt += base::IntToString(*it); | 30 rt += base::IntToString(*it); |
31 } | 31 } |
32 return rt; | 32 return rt; |
33 } | 33 } |
34 | 34 |
35 void StringToIntSet(const std::string& str, std::set<int>* list) { | 35 void StringToIntSet(const std::string& str, std::set<int>* list) { |
36 DCHECK(list); | 36 DCHECK(list); |
37 for (const base::StringPiece& piece : | 37 std::vector<std::string> pieces; |
38 base::SplitStringPiece(str, ",", base::TRIM_WHITESPACE, | 38 base::SplitString(str, ',', &pieces); |
39 base::SPLIT_WANT_ALL)) { | 39 for (size_t i = 0; i < pieces.size(); ++i) { |
40 int number = 0; | 40 int number = 0; |
41 bool succeed = base::StringToInt(piece, &number); | 41 bool succeed = base::StringToInt(pieces[i], &number); |
42 DCHECK(succeed); | 42 DCHECK(succeed); |
43 list->insert(number); | 43 list->insert(number); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 } // namespace anonymous | 47 } // namespace anonymous |
48 | 48 |
49 void MergeFeatureSets(std::set<int>* dst, const std::set<int>& src) { | 49 void MergeFeatureSets(std::set<int>* dst, const std::set<int>& src) { |
50 DCHECK(dst); | 50 DCHECK(dst); |
51 if (src.empty()) | 51 if (src.empty()) |
(...skipping 22 matching lines...) Expand all Loading... |
74 IntSetToString(workarounds)); | 74 IntSetToString(workarounds)); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 void StringToFeatureSet( | 78 void StringToFeatureSet( |
79 const std::string& str, std::set<int>* feature_set) { | 79 const std::string& str, std::set<int>* feature_set) { |
80 StringToIntSet(str, feature_set); | 80 StringToIntSet(str, feature_set); |
81 } | 81 } |
82 | 82 |
83 } // namespace gpu | 83 } // namespace gpu |
OLD | NEW |