Chromium Code Reviews| Index: components/feature_engagement_tracker/internal/feature_engagement_tracker_impl.cc |
| diff --git a/components/feature_engagement_tracker/internal/feature_engagement_tracker_impl.cc b/components/feature_engagement_tracker/internal/feature_engagement_tracker_impl.cc |
| index a29976cd40ed070095a9b2fc85711dd0e3510513..9042780c6d18b32d19eced6ea59a8cef8ab7974a 100644 |
| --- a/components/feature_engagement_tracker/internal/feature_engagement_tracker_impl.cc |
| +++ b/components/feature_engagement_tracker/internal/feature_engagement_tracker_impl.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "components/feature_engagement_tracker/internal/editable_configuration.h" |
| #include "components/feature_engagement_tracker/internal/in_memory_store.h" |
| +#include "components/feature_engagement_tracker/internal/init_aware_model.h" |
| #include "components/feature_engagement_tracker/internal/model_impl.h" |
| #include "components/feature_engagement_tracker/internal/never_condition_validator.h" |
| #include "components/feature_engagement_tracker/internal/never_storage_validator.h" |
| @@ -40,10 +41,13 @@ CreateDemoModeFeatureEngagementTracker() { |
| configuration->SetConfiguration(feature, feature_config); |
| } |
| + auto raw_model = |
| + base::MakeUnique<ModelImpl>(base::MakeUnique<InMemoryStore>(), |
|
nyquist
2017/05/12 23:12:24
It looks like the InMemoryStore posts the result o
David Trainor- moved to gerrit
2017/05/13 00:03:52
Line 49 has you covered don't worry.
|
| + base::MakeUnique<NeverStorageValidator>()); |
| + |
| return base::MakeUnique<FeatureEngagementTrackerImpl>( |
| - base::MakeUnique<InMemoryStore>(), std::move(configuration), |
| - base::MakeUnique<OnceConditionValidator>(), |
| - base::MakeUnique<NeverStorageValidator>(), |
| + base::MakeUnique<InitAwareModel>(std::move(raw_model)), |
| + std::move(configuration), base::MakeUnique<OnceConditionValidator>(), |
| base::MakeUnique<SystemTimeProvider>()); |
| } |
| @@ -63,36 +67,32 @@ FeatureEngagementTracker* FeatureEngagementTracker::Create( |
| base::MakeUnique<leveldb_proto::ProtoDatabaseImpl<Event>>( |
| background_task_runner); |
| - std::unique_ptr<Store> store = |
| - base::MakeUnique<PersistentStore>(storage_dir, std::move(db)); |
| - std::unique_ptr<Configuration> configuration = |
| - base::MakeUnique<SingleInvalidConfiguration>(); |
| - std::unique_ptr<ConditionValidator> condition_validator = |
| - base::MakeUnique<NeverConditionValidator>(); |
| - std::unique_ptr<StorageValidator> storage_validator = |
| - base::MakeUnique<NeverStorageValidator>(); |
| - std::unique_ptr<TimeProvider> time_provider = |
| - base::MakeUnique<SystemTimeProvider>(); |
| + auto store = base::MakeUnique<PersistentStore>(storage_dir, std::move(db)); |
| + auto storage_validator = base::MakeUnique<NeverStorageValidator>(); |
| + auto raw_model = base::MakeUnique<ModelImpl>(std::move(store), |
| + std::move(storage_validator)); |
| + |
| + auto model = base::MakeUnique<InitAwareModel>(std::move(raw_model)); |
| + auto configuration = base::MakeUnique<SingleInvalidConfiguration>(); |
| + auto condition_validator = base::MakeUnique<NeverConditionValidator>(); |
| + auto time_provider = base::MakeUnique<SystemTimeProvider>(); |
| return new FeatureEngagementTrackerImpl( |
| - std::move(store), std::move(configuration), |
| - std::move(condition_validator), std::move(storage_validator), |
| - std::move(time_provider)); |
| + std::move(model), std::move(configuration), |
| + std::move(condition_validator), std::move(time_provider)); |
| } |
| FeatureEngagementTrackerImpl::FeatureEngagementTrackerImpl( |
| - std::unique_ptr<Store> store, |
| + std::unique_ptr<Model> model, |
| std::unique_ptr<Configuration> configuration, |
| std::unique_ptr<ConditionValidator> condition_validator, |
| - std::unique_ptr<StorageValidator> storage_validator, |
| std::unique_ptr<TimeProvider> time_provider) |
| - : configuration_(std::move(configuration)), |
| + : model_(std::move(model)), |
| + configuration_(std::move(configuration)), |
| condition_validator_(std::move(condition_validator)), |
| time_provider_(std::move(time_provider)), |
| initialization_finished_(false), |
| weak_ptr_factory_(this) { |
| - model_ = base::MakeUnique<ModelImpl>(std::move(store), |
| - std::move(storage_validator)); |
| model_->Initialize( |
| base::Bind(&FeatureEngagementTrackerImpl::OnModelInitializationFinished, |
| weak_ptr_factory_.GetWeakPtr()), |