| Index: base/feature_list.cc
|
| diff --git a/base/feature_list.cc b/base/feature_list.cc
|
| index 435165e10caa004c6485f569610427cdc1938be3..89b105defc6df0119688cb3b0e708f1b905f36df 100644
|
| --- a/base/feature_list.cc
|
| +++ b/base/feature_list.cc
|
| @@ -10,6 +10,7 @@
|
| #include <vector>
|
|
|
| #include "base/logging.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/metrics/field_trial.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| @@ -197,10 +198,19 @@ void FeatureList::SetInstance(std::unique_ptr<FeatureList> instance) {
|
| }
|
|
|
| // static
|
| -void FeatureList::ClearInstanceForTesting() {
|
| - delete g_instance;
|
| +std::unique_ptr<FeatureList> FeatureList::ClearInstanceForTesting() {
|
| + FeatureList* old_instance = g_instance;
|
| g_instance = nullptr;
|
| g_initialized_from_accessor = false;
|
| + return base::WrapUnique(old_instance);
|
| +}
|
| +
|
| +// static
|
| +void FeatureList::RestoreInstanceForTesting(
|
| + std::unique_ptr<FeatureList> instance) {
|
| + DCHECK(!g_instance);
|
| + // Note: Intentional leak of global singleton.
|
| + g_instance = instance.release();
|
| }
|
|
|
| void FeatureList::FinalizeInitialization() {
|
|
|