| 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 <string> | 9 #include <string> | 
| 10 #include <vector> | 10 #include <vector> | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 138   // Returns whether the given |feature| is enabled. Must only be called after | 138   // Returns whether the given |feature| is enabled. Must only be called after | 
| 139   // the singleton instance has been registered via SetInstance(). Additionally, | 139   // the singleton instance has been registered via SetInstance(). Additionally, | 
| 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 a default instance of FeatureList if one has not yet | 148   // Initializes and sets an instance of FeatureList with feature overrides via | 
| 149   // already been set. No-op otherwise. | 149   // command-line flags |enable_features| and |disable_features| if one has not | 
| 150   static void InitializeInstance(); | 150   // already been set from command-line flags. No-op otherwise. See | 
|  | 151   // InitializeFromCommandLine for more details about |enable_features| and | 
|  | 152   // |disable_features| parameters. | 
|  | 153   static void InitializeInstance(const std::string& enable_features, | 
|  | 154                                  const std::string& disable_features); | 
| 151 | 155 | 
| 152   // Returns the singleton instance of FeatureList. Will return null until an | 156   // Returns the singleton instance of FeatureList. Will return null until an | 
| 153   // instance is registered via SetInstance(). | 157   // instance is registered via SetInstance(). | 
| 154   static FeatureList* GetInstance(); | 158   static FeatureList* GetInstance(); | 
| 155 | 159 | 
| 156   // 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 | 
| 157   // 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. | 
| 158   static void SetInstance(scoped_ptr<FeatureList> instance); | 162   static void SetInstance(scoped_ptr<FeatureList> instance); | 
| 159 | 163 | 
| 160   // Clears the previously-registered singleton instance for tests. | 164   // Clears the previously-registered singleton instance for tests. | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 228   // Locked map that keeps track of seen features, to ensure a single feature is | 232   // Locked map that keeps track of seen features, to ensure a single feature is | 
| 229   // only defined once. This verification is only done in builds with DCHECKs | 233   // only defined once. This verification is only done in builds with DCHECKs | 
| 230   // enabled. | 234   // enabled. | 
| 231   Lock feature_identity_tracker_lock_; | 235   Lock feature_identity_tracker_lock_; | 
| 232   std::map<std::string, const Feature*> feature_identity_tracker_; | 236   std::map<std::string, const Feature*> feature_identity_tracker_; | 
| 233 | 237 | 
| 234   // Whether this object has been fully initialized. This gets set to true as a | 238   // Whether this object has been fully initialized. This gets set to true as a | 
| 235   // result of FinalizeInitialization(). | 239   // result of FinalizeInitialization(). | 
| 236   bool initialized_; | 240   bool initialized_; | 
| 237 | 241 | 
|  | 242   // Whether this object has been initialized from command line. | 
|  | 243   bool initialized_from_command_line_; | 
|  | 244 | 
| 238   DISALLOW_COPY_AND_ASSIGN(FeatureList); | 245   DISALLOW_COPY_AND_ASSIGN(FeatureList); | 
| 239 }; | 246 }; | 
| 240 | 247 | 
| 241 }  // namespace base | 248 }  // namespace base | 
| 242 | 249 | 
| 243 #endif  // BASE_FEATURE_LIST_H_ | 250 #endif  // BASE_FEATURE_LIST_H_ | 
| OLD | NEW | 
|---|