Reland "Support late registration of syncable preferences."
Sync integration tests where flaky on some platforms. Fixed
those integration tests by enabling self-notifications and
only modifying one client (and not the verifier as well).
Inspected try-bot runs from two executions verifying no flakes.
Original CL description:
Support late registration of syncable preferences.
Today, there's already a race when registering a preference
through the mojo preference service: the asynchronous
registration call might be slower than starting sync. As
more services are being implemented, those scenarios are
getting more likely -- especially as services could be
started at arbitrary times.
Before this path, the synced preferences implementation did
not support this scenario. This patch changes the synced
preference implementation to receive and persist remote
data for preferences before they get registered. Currently,
this only applies for a whitelisted set of preferences.
More details about the approach can be found in the design
doc linked from the crbug/840332.
Bug: 840332
Change-Id: I5fd2883d403b961a6332d7ee7bcdbad72f5cab8f
Reviewed-on: https://chromium-review.googlesource.com/1074688
Reviewed-by: Ilya Sherman <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Commit-Queue: Tim Schumann <[email protected]>
Cr-Commit-Position: refs/heads/master@{#562689}
diff --git a/components/prefs/pref_service.h b/components/prefs/pref_service.h
index 3952552..1da3854 100644
--- a/components/prefs/pref_service.h
+++ b/components/prefs/pref_service.h
@@ -354,8 +354,6 @@
// this PrefService. Subclasses may access it for unit testing.
const std::unique_ptr<PrefValueStore> pref_value_store_;
- const scoped_refptr<PrefRegistry> pref_registry_;
-
// Pref Stores and profile that we passed to the PrefValueStore.
const scoped_refptr<PersistentPrefStore> user_pref_store_;
@@ -431,6 +429,8 @@
// actually get the value.).
const base::Value* GetPreferenceValue(const std::string& path) const;
+ const scoped_refptr<PrefRegistry> pref_registry_;
+
// Local cache of registered Preference objects. The pref_registry_
// is authoritative with respect to what the types and default values
// of registered preferences are.