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

Unified Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 2799043003: Revert of Pref service: add support for tracked prefs. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/chrome_pref_service_factory.cc
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index b0ae23899ae9a26f4efd2f8467445180fd9f57f6..1e9b90229df9be9a8344347c2ff891c09d1c037e 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -58,7 +58,6 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/features/features.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
#include "rlz/features/features.h"
#include "services/preferences/public/cpp/tracked/configuration.h"
#include "services/preferences/public/cpp/tracked/pref_names.h"
@@ -357,8 +356,9 @@
seed = ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PREF_HASH_SEED_BIN).as_string();
#endif
- return base::MakeUnique<ProfilePrefStoreManager>(profile_path, seed,
- legacy_device_id);
+ return base::MakeUnique<ProfilePrefStoreManager>(
+ profile_path, GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount,
+ seed, legacy_device_id, g_browser_process->local_state());
}
void PrepareFactory(sync_preferences::PrefServiceSyncableFactory* factory,
@@ -391,28 +391,6 @@
factory->SetPrefModelAssociatorClient(
ChromePrefModelAssociatorClient::GetInstance());
}
-
-class ResetOnLoadObserverImpl : public prefs::mojom::ResetOnLoadObserver {
- public:
- explicit ResetOnLoadObserverImpl(const base::FilePath& profile_path)
- : profile_path_(profile_path) {}
-
- void OnResetOnLoad() override {
- // A StartSyncFlare used to kick sync early in case of a reset event. This
- // is done since sync may bring back the user's server value post-reset
- // which could potentially cause a "settings flash" between the factory
- // default and the re-instantiated server value. Starting sync ASAP
- // minimizes the window before the server value is re-instantiated (this
- // window can otherwise be as long as 10 seconds by default).
- sync_start_util::GetFlareForSyncableService(profile_path_)
- .Run(syncer::PREFERENCES);
- }
-
- private:
- const base::FilePath profile_path_;
-
- DISALLOW_COPY_AND_ASSIGN(ResetOnLoadObserverImpl);
-};
} // namespace
@@ -450,7 +428,8 @@
std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs(
const base::FilePath& profile_path,
- prefs::mojom::TrackedPreferenceValidationDelegatePtr validation_delegate,
+ base::SequencedTaskRunner* pref_io_task_runner,
+ prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate,
policy::PolicyService* policy_service,
SupervisedUserSettingsService* supervised_user_settings,
const scoped_refptr<PrefStore>& extension_prefs,
@@ -460,18 +439,22 @@
TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime");
- prefs::mojom::ResetOnLoadObserverPtr reset_on_load_observer;
- mojo::MakeStrongBinding(
- base::MakeUnique<ResetOnLoadObserverImpl>(profile_path),
- mojo::MakeRequest(&reset_on_load_observer));
+ // A StartSyncFlare used to kick sync early in case of a reset event. This is
+ // done since sync may bring back the user's server value post-reset which
+ // could potentially cause a "settings flash" between the factory default and
+ // the re-instantiated server value. Starting sync ASAP minimizes the window
+ // before the server value is re-instantiated (this window can otherwise be
+ // as long as 10 seconds by default).
+ const base::Closure start_sync_flare_for_prefs =
+ base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
+ syncer::PREFERENCES);
+
sync_preferences::PrefServiceSyncableFactory factory;
scoped_refptr<PersistentPrefStore> user_pref_store(
CreateProfilePrefStoreManager(profile_path)
->CreateProfilePrefStore(
- GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount,
- content::BrowserThread::GetBlockingPool(),
- std::move(reset_on_load_observer), std::move(validation_delegate),
- connector, pref_registry));
+ pref_io_task_runner, start_sync_flare_for_prefs,
+ validation_delegate, connector, pref_registry));
PrepareFactory(&factory, profile_path, policy_service,
supervised_user_settings, user_pref_store, extension_prefs,
async);
@@ -491,9 +474,7 @@
const base::FilePath& profile_path,
std::unique_ptr<base::DictionaryValue> master_prefs) {
return CreateProfilePrefStoreManager(profile_path)
- ->InitializePrefsFromMasterPrefs(GetTrackingConfiguration(),
- kTrackedPrefsReportingIDsCount,
- std::move(master_prefs));
+ ->InitializePrefsFromMasterPrefs(std::move(master_prefs));
}
base::Time GetResetTime(Profile* profile) {
« no previous file with comments | « chrome/browser/prefs/chrome_pref_service_factory.h ('k') | chrome/browser/prefs/profile_pref_store_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698