| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Returns whether the given |feature| is enabled. Must only be called after | 149 // Returns whether the given |feature| is enabled. Must only be called after |
| 150 // the singleton instance has been registered via SetInstance(). Additionally, | 150 // the singleton instance has been registered via SetInstance(). Additionally, |
| 151 // a feature with a given name must only have a single corresponding Feature | 151 // a feature with a given name must only have a single corresponding Feature |
| 152 // struct, which is checked in builds with DCHECKs enabled. | 152 // struct, which is checked in builds with DCHECKs enabled. |
| 153 static bool IsEnabled(const Feature& feature); | 153 static bool IsEnabled(const Feature& feature); |
| 154 | 154 |
| 155 // Returns the field trial associated with the given |feature|. Must only be | 155 // Returns the field trial associated with the given |feature|. Must only be |
| 156 // called after the singleton instance has been registered via SetInstance(). | 156 // called after the singleton instance has been registered via SetInstance(). |
| 157 static FieldTrial* GetFieldTrial(const Feature& feature); | 157 static FieldTrial* GetFieldTrial(const Feature& feature); |
| 158 | 158 |
| 159 // Splits a comma-separated string containing feature names into a vector. | 159 // Splits a comma-separated string containing feature names into a vector. The |
| 160 static std::vector<std::string> SplitFeatureListString( | 160 // resulting pieces point to parts of |input|. |
| 161 const std::string& input); | 161 static std::vector<base::StringPiece> SplitFeatureListString( |
| 162 base::StringPiece input); |
| 162 | 163 |
| 163 // Initializes and sets an instance of FeatureList with feature overrides via | 164 // Initializes and sets an instance of FeatureList with feature overrides via |
| 164 // command-line flags |enable_features| and |disable_features| if one has not | 165 // command-line flags |enable_features| and |disable_features| if one has not |
| 165 // already been set from command-line flags. Returns true if an instance did | 166 // already been set from command-line flags. Returns true if an instance did |
| 166 // not previously exist. See InitializeFromCommandLine() for more details | 167 // not previously exist. See InitializeFromCommandLine() for more details |
| 167 // about |enable_features| and |disable_features| parameters. | 168 // about |enable_features| and |disable_features| parameters. |
| 168 static bool InitializeInstance(const std::string& enable_features, | 169 static bool InitializeInstance(const std::string& enable_features, |
| 169 const std::string& disable_features); | 170 const std::string& disable_features); |
| 170 | 171 |
| 171 // Returns the singleton instance of FeatureList. Will return null until an | 172 // Returns the singleton instance of FeatureList. Will return null until an |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 277 |
| 277 // Whether this object has been initialized from command line. | 278 // Whether this object has been initialized from command line. |
| 278 bool initialized_from_command_line_ = false; | 279 bool initialized_from_command_line_ = false; |
| 279 | 280 |
| 280 DISALLOW_COPY_AND_ASSIGN(FeatureList); | 281 DISALLOW_COPY_AND_ASSIGN(FeatureList); |
| 281 }; | 282 }; |
| 282 | 283 |
| 283 } // namespace base | 284 } // namespace base |
| 284 | 285 |
| 285 #endif // BASE_FEATURE_LIST_H_ | 286 #endif // BASE_FEATURE_LIST_H_ |
| OLD | NEW |