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

Side by Side Diff: base/feature_list.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 months 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') | base/feature_list_unittest.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // chrome_browser_main.cc and do not override it in content/browser/ 154 // chrome_browser_main.cc and do not override it in content/browser/
155 // browser_main_loop.cc. 155 // browser_main_loop.cc.
156 if (g_instance) { 156 if (g_instance) {
157 if (g_instance->initialized_from_command_line_) 157 if (g_instance->initialized_from_command_line_)
158 return; 158 return;
159 159
160 delete g_instance; 160 delete g_instance;
161 g_instance = nullptr; 161 g_instance = nullptr;
162 } 162 }
163 163
164 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); 164 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
165 feature_list->InitializeFromCommandLine(enable_features, disable_features); 165 feature_list->InitializeFromCommandLine(enable_features, disable_features);
166 base::FeatureList::SetInstance(std::move(feature_list)); 166 base::FeatureList::SetInstance(std::move(feature_list));
167 } 167 }
168 168
169 // static 169 // static
170 FeatureList* FeatureList::GetInstance() { 170 FeatureList* FeatureList::GetInstance() {
171 return g_instance; 171 return g_instance;
172 } 172 }
173 173
174 // static 174 // static
175 void FeatureList::SetInstance(scoped_ptr<FeatureList> instance) { 175 void FeatureList::SetInstance(std::unique_ptr<FeatureList> instance) {
176 DCHECK(!g_instance); 176 DCHECK(!g_instance);
177 instance->FinalizeInitialization(); 177 instance->FinalizeInitialization();
178 178
179 // Note: Intentional leak of global singleton. 179 // Note: Intentional leak of global singleton.
180 g_instance = instance.release(); 180 g_instance = instance.release();
181 } 181 }
182 182
183 // static 183 // static
184 void FeatureList::ClearInstanceForTesting() { 184 void FeatureList::ClearInstanceForTesting() {
185 delete g_instance; 185 delete g_instance;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return it->second == &feature; 266 return it->second == &feature;
267 } 267 }
268 268
269 FeatureList::OverrideEntry::OverrideEntry(OverrideState overridden_state, 269 FeatureList::OverrideEntry::OverrideEntry(OverrideState overridden_state,
270 FieldTrial* field_trial) 270 FieldTrial* field_trial)
271 : overridden_state(overridden_state), 271 : overridden_state(overridden_state),
272 field_trial(field_trial), 272 field_trial(field_trial),
273 overridden_by_field_trial(field_trial != nullptr) {} 273 overridden_by_field_trial(field_trial != nullptr) {}
274 274
275 } // namespace base 275 } // namespace base
OLDNEW
« no previous file with comments | « base/feature_list.h ('k') | base/feature_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698