New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 714855 link

Starred by 3 users

Issue metadata

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



Sign in to add a comment

Pref service: expose local prefs as a service

Project Member Reported by yzshen@chromium.org, Apr 24 2017

Issue description

The network service needs to access the proxy-related commandline flags which are stored in local prefs. Please see:
https://cs.chromium.org/chromium/src/chrome/browser/prefs/chrome_command_line_pref_store.cc?rcl=7ac2374e5a71a1c49f8cf433726ce6f4afb81c4e&l=104

Currently the pref service only supports per-profile prefs. It would be nice to add support for local prefs.


 

Comment 1 by tibell@chromium.org, Apr 25 2017

Owner: tibell@chromium.org
Just to summarize what yzshen@ and I discussed offline. We plan to support access to local prefs but we've been blocked by these prefs being read and written before Mojo or the service manager has started. I believe rockot@ is working on improving the situation there, after which we should be able to move local prefs into the prefs service.

Comment 2 by tibell@chromium.org, May 16 2017

Components: Internals>Preferences>Service

Comment 3 by yzshen@chromium.org, May 16 2017

FYI, in a network-service-dev discussion, Matt suggested that maybe we should keep the pref access outside of the network service:
"""I've been thinking we may need to have the ProxyConfigService live out of process (On Linux, it depends on GTK, which is also no something I'm sure we want in the network process.  On ChromeOS, it also has bonus logic that I believe depends on other chrome classes)."""

In that case, the network service doesn't need to depend on the pref service directly. But this ProxyConfigService will still need to access the proxy local prefs.
Cc: jamescook@chromium.org
Blockedon: 729596
Upon further investigation I'm not sure initializing SM earlier is really a great option. As long as the Service Manager is embedded in the browser, there needs to be a way for embedded services to be installed at SM initialization time. Their service factories may (and currently do in many cases) want to refer to specific BrowserThread task runners. Here are some ways we might address this:

1. Initialize the embedded Service Manager in two phases, with the first phase being just enough to run essential services like prefs and maybe network - these would in turn be restricted from referencing BrowserThreads.
2. Initialize BrowserThread TaskRunners in a queuing state before the threads are actually created. This would allow for earlier ServiceManagerContext creation.
3. Forbid access to BrowserThread task runners here and give services some other way to specify what thread they want to be run on. Such services won't be reachable until after browser threads are created.

Each of those options adds significant complexity and still requires that we bring up the IO thread earlier.

Is it possible to instead make other things happen later? i.e. why does anything need to access local prefs before threads are started? Can we change it? I notice this bug refers to the network service needing proxy-related command line flags stored by ChromeCommandLinePrefStore. We obviously can't run the network service until we have a service manager anyway, so why would the network service need these flags sooner than that?
Network service probably doesn't need the local prefs that earlier.

My understanding of comment #1 is that there are other cases where people need local prefs at an early stage, without this support we cannot switch all local pref users to use the Mojo service. (I don't know what those cases are.)

Ash (under mustash) can generally access local state prefs fairly late in startup.

Comment 9 by tibell@chromium.org, Jun 21 2017

Owner: ----
Status: Available (was: Untriaged)
Summary: Pref service: implement local prefs using the service (was: Network service needs to access local prefs)
Cc: sky@chromium.org
Components: Internals>MUS
Labels: Proj-Mustash-Mash
Where is this on the services-dev roadmap?

I recently approved a CL that allows code in ash to use Local State preferences. https://chromium-review.googlesource.com/c/566026/

I think this is the right long-term approach, but it means that mustash can't ship until pref service supports local state.

Comment 12 by sa...@chromium.org, Jul 11 2017

Blockedon: -729596
Summary: Pref service: expose local prefs as a service (was: Pref service: implement local prefs using the service)
When prefs decapsulation (https://crrev.com/c/554653/) finishes, this will be almost trivial (https://crrev.com/c/557580/).

Comment 13 by sa...@chromium.org, Jul 14 2017

Cc: -sa...@chromium.org
Owner: sa...@chromium.org
Status: Started (was: Available)
Project Member

Comment 14 by bugdroid1@chromium.org, Jul 20 2017

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

commit e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa
Author: Sam McNally <sammc@chromium.org>
Date: Thu Jul 20 01:04:28 2017

Pref service: Expose local state prefs to mash as a service.

Expose local state prefs from the browser using a
InProcessPrefServiceFactory in BrowserProcessImpl and register it as a
embedded service factory in ChromeContentBrowserClient.

Add plumbing of a PrefValueStore::Delegate to PrefServiceFactory to
match PrefServiceSyncableFactory to capture the PrefStores to be
exposed via the local state pref service.

Duplicate the existing pref service manifest as "local_state" to avoid
colliding with the per-profile pref service; each service may only be
packaged in a single service so a distinct service name is required.

Bug:  714855 
Change-Id: I31131be6b5c720fa28e83a81febeea9c524c3cfe
Reviewed-on: https://chromium-review.googlesource.com/557580
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Noel Gordon <noel@chromium.org>
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488070}
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/ash/mus/manifest.json
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/ash/shell.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/ash/shell.h
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/app/BUILD.gn
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/browser_process.h
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/prefs/chrome_pref_service_factory.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/browser/prefs/chrome_pref_service_factory.h
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/test/base/testing_browser_process.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/chrome/test/base/testing_browser_process.h
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/components/prefs/pref_service_factory.cc
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/components/prefs/pref_service_factory.h
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/services/preferences/BUILD.gn
[add] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/services/preferences/local_state_manifest.json
[modify] https://crrev.com/e36abbc2559c57a41d35da0bc8c4da98bf9dd0fa/services/preferences/public/interfaces/preferences.mojom

Comment 15 by sa...@chromium.org, Jul 31 2017

Status: Fixed (was: Started)
Components: -Internals>MUS Internals>Services>WindowService

Sign in to add a comment