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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |