Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: base/feature_list.h

Issue 1409933007: Register a default instance of FeatureList for content browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move logic to FeatureList. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/feature_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Returns whether the given |feature| is enabled. Must only be called after 120 // Returns whether the given |feature| is enabled. Must only be called after
121 // the singleton instance has been registered via SetInstance(). Additionally, 121 // the singleton instance has been registered via SetInstance(). Additionally,
122 // a feature with a given name must only have a single corresponding Feature 122 // a feature with a given name must only have a single corresponding Feature
123 // struct, which is checked in builds with DCHECKs enabled. 123 // struct, which is checked in builds with DCHECKs enabled.
124 static bool IsEnabled(const Feature& feature); 124 static bool IsEnabled(const Feature& feature);
125 125
126 // Splits a comma-separated string containing feature names into a vector. 126 // Splits a comma-separated string containing feature names into a vector.
127 static std::vector<std::string> SplitFeatureListString( 127 static std::vector<std::string> SplitFeatureListString(
128 const std::string& input); 128 const std::string& input);
129 129
130 // Initializes and sets a default instance of FeatureList if one has not yet
131 // already been set. No-op otherwise.
132 static void InitializeInstance();
133
130 // Returns the singleton instance of FeatureList. Will return null until an 134 // Returns the singleton instance of FeatureList. Will return null until an
131 // instance is registered via SetInstance(). 135 // instance is registered via SetInstance().
132 static FeatureList* GetInstance(); 136 static FeatureList* GetInstance();
133 137
134 // Registers the given |instance| to be the singleton feature list for this 138 // Registers the given |instance| to be the singleton feature list for this
135 // process. This should only be called once and |instance| must not be null. 139 // process. This should only be called once and |instance| must not be null.
136 static void SetInstance(scoped_ptr<FeatureList> instance); 140 static void SetInstance(scoped_ptr<FeatureList> instance);
137 141
138 // Clears the previously-registered singleton instance for tests. 142 // Clears the previously-registered singleton instance for tests.
139 static void ClearInstanceForTesting(); 143 static void ClearInstanceForTesting();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Whether this object has been fully initialized. This gets set to true as a 209 // Whether this object has been fully initialized. This gets set to true as a
206 // result of FinalizeInitialization(). 210 // result of FinalizeInitialization().
207 bool initialized_; 211 bool initialized_;
208 212
209 DISALLOW_COPY_AND_ASSIGN(FeatureList); 213 DISALLOW_COPY_AND_ASSIGN(FeatureList);
210 }; 214 };
211 215
212 } // namespace base 216 } // namespace base
213 217
214 #endif // BASE_FEATURE_LIST_H_ 218 #endif // BASE_FEATURE_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | base/feature_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698