| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // about |enable_features| and |disable_features| parameters. | 156 // about |enable_features| and |disable_features| parameters. |
| 157 static bool InitializeInstance(const std::string& enable_features, | 157 static bool InitializeInstance(const std::string& enable_features, |
| 158 const std::string& disable_features); | 158 const std::string& disable_features); |
| 159 | 159 |
| 160 // Returns the singleton instance of FeatureList. Will return null until an | 160 // Returns the singleton instance of FeatureList. Will return null until an |
| 161 // instance is registered via SetInstance(). | 161 // instance is registered via SetInstance(). |
| 162 static FeatureList* GetInstance(); | 162 static FeatureList* GetInstance(); |
| 163 | 163 |
| 164 // Registers the given |instance| to be the singleton feature list for this | 164 // Registers the given |instance| to be the singleton feature list for this |
| 165 // process. This should only be called once and |instance| must not be null. | 165 // process. This should only be called once and |instance| must not be null. |
| 166 // Note: If you are considering using this for the purposes of testing, take |
| 167 // a look at using base/test/scoped_feature_list.h instead. |
| 166 static void SetInstance(std::unique_ptr<FeatureList> instance); | 168 static void SetInstance(std::unique_ptr<FeatureList> instance); |
| 167 | 169 |
| 168 // Clears the previously-registered singleton instance for tests and returns | 170 // Clears the previously-registered singleton instance for tests and returns |
| 169 // the old instance. | 171 // the old instance. |
| 170 // Note: Most tests should never call this directly. Instead consider using | 172 // Note: Most tests should never call this directly. Instead consider using |
| 171 // base::test::ScopedFeatureList. | 173 // base::test::ScopedFeatureList. |
| 172 static std::unique_ptr<FeatureList> ClearInstanceForTesting(); | 174 static std::unique_ptr<FeatureList> ClearInstanceForTesting(); |
| 173 | 175 |
| 174 // Sets a given (initialized) |instance| to be the singleton feature list, | 176 // Sets a given (initialized) |instance| to be the singleton feature list, |
| 175 // for testing. Existing instance must be null. This is primarily intended | 177 // for testing. Existing instance must be null. This is primarily intended |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 261 |
| 260 // Whether this object has been initialized from command line. | 262 // Whether this object has been initialized from command line. |
| 261 bool initialized_from_command_line_ = false; | 263 bool initialized_from_command_line_ = false; |
| 262 | 264 |
| 263 DISALLOW_COPY_AND_ASSIGN(FeatureList); | 265 DISALLOW_COPY_AND_ASSIGN(FeatureList); |
| 264 }; | 266 }; |
| 265 | 267 |
| 266 } // namespace base | 268 } // namespace base |
| 267 | 269 |
| 268 #endif // BASE_FEATURE_LIST_H_ | 270 #endif // BASE_FEATURE_LIST_H_ |
| OLD | NEW |