New issue
Advanced search Search tips

Issue 622347 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 665569



Sign in to add a comment

Need Mojo API for Preferences

Project Member Reported by jonr...@chromium.org, Jun 22 2016

Issue description

Chrome manages various user preferences.

With MUS Chrome will live in a separate process than components which may require preferences. Such as the ash shelf.

We need to build a mojom interface to allow Chrome to continue to manage preferences, but for clients in separate processes to access them.

 
Components: Internals>MUS
Labels: Proj-Mustash
Are there details on the design for the PreferencesManager interface? Is the goal a separate process handling all prefs access?

Will chrome still be responsible for creating the pref stores? (I'm asking from the perspective of app_shell, which creates and manages its own preferences similar to how chrome works today.)
I have the initial design in a doc.

The long-term goal is for the PreferencesManager to exist in a separate process, with chrome as a client.

The initial implementation will have chrome instantiating the manager and clients connecting to it. At least until we have the chance to refactor out the prefs from chrome. During this stage ash, and other services will connect to chrome.

The mojom for this is currently up for review: https://codereview.chromium.org/2092453002/
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 2 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/63b021f2555ac1094961fc6f82de77b7ac31b312

commit 63b021f2555ac1094961fc6f82de77b7ac31b312
Author: jonross <jonross@chromium.org>
Date: Wed Nov 02 00:56:21 2016

Mojom interface for Preferences

This change creates a mojom interface for Preferences. This will allow chrome/browser to continue to manager preferences. While allowing clients in other processes to access them.

PrefObserverStore has been created to abstract away the interface from clients. Instead this can be used by clients as a normal PrefStore, with synchronous access to preferences.

TEST=PrefObserverStoreTest, also manual testing with shelf preferences (not in this review)
BUG= 622347 

Review-Url: https://codereview.chromium.org/2092453002
Cr-Commit-Position: refs/heads/master@{#429166}

[modify] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/BUILD.gn
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/BUILD.gn
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/cpp/BUILD.gn
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/cpp/DEPS
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/cpp/pref_observer_store.cc
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/cpp/pref_observer_store.h
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/cpp/tests/BUILD.gn
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/cpp/tests/pref_observer_store_unittest.cc
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/interfaces/BUILD.gn
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/interfaces/OWNERS
[add] https://crrev.com/63b021f2555ac1094961fc6f82de77b7ac31b312/services/preferences/public/interfaces/preferences.mojom

Jon, could you share the design doc?

I'm curious where PrefObserverStore will fit in. My understanding of today's world:

* PrefStores are created by the embedder (chrome) and are owned by the PrefValueStore
* PrefValueStore handles most of the read/write functions exposed by prefs
* PrefService owns the PrefValueStore and generally orchestrates the pref system
* The embedder creates the PrefStores and creates a PrefService instance

So, most pref access is done synchronously via the PrefService instance. Chrome creates this service via Profile (other embedders would do something similar).

Could you help me understand what problem the mojo API solves? I.e., why can't clients in other processes use the same PrefService? Is it a concurrency safety issue (and how does mojo solve that)?
I've sent you the link to the design doc.

You are correct in your understanding of today's world of prefs. Where most pref access is done synchronously.

The problem is that when we are running in mash the Chrome process creates the Profile, and sets up the entire PrefService. Other processes, like Ash, want to know/modify the values of preferences controlled within the Chrome process.

This mojo API will allow other processes to subscribe to the subset of preferences which they are interested in. PrefObserverStore will handle the caching within their processes, and will notify Chrome of requested changes.
Blocking: 665569
Project Member

Comment 8 by bugdroid1@chromium.org, Dec 21 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3b1b258d4e59022e8a931f965e800427618894c4

commit 3b1b258d4e59022e8a931f965e800427618894c4
Author: jonross <jonross@chromium.org>
Date: Wed Dec 21 16:21:21 2016

Chrome implementation of prefs::mojom::PreferencesManager, which connects to the current Profile and subscribes to preference changes when requested to by a prefs::mojom::PreferencesObserver.

Also includes a connection manager to handle mapping incoming requests to their own preferences manager.

TEST=manual testing with example code, PreferencesManagerTest
BUG= 622347 

Review-Url: https://codereview.chromium.org/2474653003
Cr-Commit-Position: refs/heads/master@{#440118}

[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/ash/BUILD.gn
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/ash/common/DEPS
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/ash/common/wm_shell.cc
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/ash/common/wm_shell.h
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/ash/mus/manifest.json
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/app/BUILD.gn
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/BUILD.gn
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/DEPS
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/chrome_content_browser_manifest_overlay.json
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/DEPS
[add] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/preferences_connection_manager.cc
[add] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/preferences_connection_manager.h
[add] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/preferences_manager.cc
[add] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/preferences_manager.h
[add] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/preferences_manager_unittest.cc
[add] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/browser/prefs/preferences_manifest.json
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/chrome/test/BUILD.gn
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/services/preferences/public/cpp/pref_observer_store.cc
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/services/preferences/public/cpp/pref_observer_store.h
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/services/preferences/public/cpp/tests/pref_observer_store_unittest.cc
[modify] https://crrev.com/3b1b258d4e59022e8a931f965e800427618894c4/services/preferences/public/interfaces/preferences.mojom

Status: Fixed (was: Started)
This has landed.

 Issue 674140  &  issue 674138  track planned improvements that I will land
Components: -Internals>MUS Internals>Services>WindowService
Components: -MUS

Sign in to add a comment