OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BASE_FEATURE_LIST_H_ | 5 #ifndef BASE_FEATURE_LIST_H_ |
6 #define BASE_FEATURE_LIST_H_ | 6 #define BASE_FEATURE_LIST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // a feature with a given name must only have a single corresponding Feature | 140 // a feature with a given name must only have a single corresponding Feature |
141 // struct, which is checked in builds with DCHECKs enabled. | 141 // struct, which is checked in builds with DCHECKs enabled. |
142 static bool IsEnabled(const Feature& feature); | 142 static bool IsEnabled(const Feature& feature); |
143 | 143 |
144 // Splits a comma-separated string containing feature names into a vector. | 144 // Splits a comma-separated string containing feature names into a vector. |
145 static std::vector<std::string> SplitFeatureListString( | 145 static std::vector<std::string> SplitFeatureListString( |
146 const std::string& input); | 146 const std::string& input); |
147 | 147 |
148 // Initializes and sets an instance of FeatureList with feature overrides via | 148 // Initializes and sets an instance of FeatureList with feature overrides via |
149 // command-line flags |enable_features| and |disable_features| if one has not | 149 // command-line flags |enable_features| and |disable_features| if one has not |
150 // already been set from command-line flags. No-op otherwise. See | 150 // already been set from command-line flags. Returns true if an instance did |
151 // InitializeFromCommandLine for more details about |enable_features| and | 151 // not previously exist. See InitializeFromCommandLine() for more details |
152 // |disable_features| parameters. | 152 // about |enable_features| and |disable_features| parameters. |
153 static void InitializeInstance(const std::string& enable_features, | 153 static bool InitializeInstance(const std::string& enable_features, |
154 const std::string& disable_features); | 154 const std::string& disable_features); |
155 | 155 |
156 // Returns the singleton instance of FeatureList. Will return null until an | 156 // Returns the singleton instance of FeatureList. Will return null until an |
157 // instance is registered via SetInstance(). | 157 // instance is registered via SetInstance(). |
158 static FeatureList* GetInstance(); | 158 static FeatureList* GetInstance(); |
159 | 159 |
160 // Registers the given |instance| to be the singleton feature list for this | 160 // Registers the given |instance| to be the singleton feature list for this |
161 // process. This should only be called once and |instance| must not be null. | 161 // process. This should only be called once and |instance| must not be null. |
162 static void SetInstance(std::unique_ptr<FeatureList> instance); | 162 static void SetInstance(std::unique_ptr<FeatureList> instance); |
163 | 163 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 // Whether this object has been initialized from command line. | 242 // Whether this object has been initialized from command line. |
243 bool initialized_from_command_line_; | 243 bool initialized_from_command_line_; |
244 | 244 |
245 DISALLOW_COPY_AND_ASSIGN(FeatureList); | 245 DISALLOW_COPY_AND_ASSIGN(FeatureList); |
246 }; | 246 }; |
247 | 247 |
248 } // namespace base | 248 } // namespace base |
249 | 249 |
250 #endif // BASE_FEATURE_LIST_H_ | 250 #endif // BASE_FEATURE_LIST_H_ |
OLD | NEW |