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

Side by Side Diff: base/feature_list.cc

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 | « base/feature_list.h ('k') | content/browser/browser_main_loop.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 #include "base/feature_list.h" 5 #include "base/feature_list.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return GetInstance()->IsFeatureEnabled(feature); 88 return GetInstance()->IsFeatureEnabled(feature);
89 } 89 }
90 90
91 // static 91 // static
92 std::vector<std::string> FeatureList::SplitFeatureListString( 92 std::vector<std::string> FeatureList::SplitFeatureListString(
93 const std::string& input) { 93 const std::string& input) {
94 return SplitString(input, ",", TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY); 94 return SplitString(input, ",", TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY);
95 } 95 }
96 96
97 // static 97 // static
98 void FeatureList::InitializeInstance() {
99 if (g_instance)
100 return;
101 SetInstance(make_scoped_ptr(new FeatureList));
102 }
103
104 // static
98 FeatureList* FeatureList::GetInstance() { 105 FeatureList* FeatureList::GetInstance() {
99 return g_instance; 106 return g_instance;
100 } 107 }
101 108
102 // static 109 // static
103 void FeatureList::SetInstance(scoped_ptr<FeatureList> instance) { 110 void FeatureList::SetInstance(scoped_ptr<FeatureList> instance) {
104 DCHECK(!g_instance); 111 DCHECK(!g_instance);
105 instance->FinalizeInitialization(); 112 instance->FinalizeInitialization();
106 113
107 // Note: Intentional leak of global singleton. 114 // Note: Intentional leak of global singleton.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return it->second == &feature; 169 return it->second == &feature;
163 } 170 }
164 171
165 FeatureList::OverrideEntry::OverrideEntry(OverrideState overridden_state, 172 FeatureList::OverrideEntry::OverrideEntry(OverrideState overridden_state,
166 FieldTrial* field_trial) 173 FieldTrial* field_trial)
167 : overridden_state(overridden_state), 174 : overridden_state(overridden_state),
168 field_trial(field_trial), 175 field_trial(field_trial),
169 overridden_by_field_trial(field_trial != nullptr) {} 176 overridden_by_field_trial(field_trial != nullptr) {}
170 177
171 } // namespace base 178 } // namespace base
OLDNEW
« no previous file with comments | « base/feature_list.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698