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

Issue 705545 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

Circular dependency between ProfileSyncServiceFactory and SupervisedUserServiceFactory

Project Member Reported by s...@chromium.org, Mar 27 2017

Issue description

Right now ProfileSyncServiceFactory declares dependencies for all of the BrowserContextKeyedServiceFactories that ChromeSyncClient accesses. This seems like it should make sense because ChromeSyncClient is directly owned by the ProfileSyncService, and as long as the ProfileSyncService is alive, then ChromeSyncClient may be accessing these factories to retrieve various SyncableServices/SyncBridges by model type.

However, to access the SyncableService for SUPERVISED_USER_WHITELISTS, we go through the SupervisedUserServiceFactory, which wants to depend on the ProfileSyncServiceFactory. This is because in SupervisedUserService::Init() it seemingly wants to call ProfileSyncService::AddPreferenceProvider() to control forced/preferred types.

It doesn't immediately seem unreasonable to me that a model type's chrome/browser/* logic would want to interact with the PSS. I'm not sure what a good solution here looks like.

Historically we thread jumped with the Profile object and accessed BrowserContextKeyedServiceFactories on the wrong thread, but https://codereview.chromium.org/2769113002/ should remove that quirk, hopefully. It may be possible that we just drop all the deps of the PSS and just null check everything before we use it?
 

Comment 1 by s...@chromium.org, Mar 28 2017

Cc: -s...@chromium.org
Labels: -Type-Bug Type-Task
Owner: s...@chromium.org
Status: Assigned (was: Untriaged)
Assigning to myself, SupervisedUserService::Init is called at https://cs.chromium.org/chromium/src/chrome/browser/profiles/profile_manager.cc?rcl=745ab003bddd9043058e1f19db831a9b4f0f6dbf&l=1249 which already needs a ProfileSyncService for other things. Should be straight forward to abstract away the dependency.

Comment 2 by s...@chromium.org, Apr 26 2017

Some context about a potential solution https://codereview.chromium.org/2768923005/
Project Member

Comment 3 by bugdroid1@chromium.org, May 9 2017

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

commit 1c532233baf652b7af9189fb2bce159ae172e739
Author: rishiag <rishiag@chromium.org>
Date: Tue May 09 16:58:35 2017

ProfileSyncService: Handle null SupervisedUserService

SupervisedUserService might be null as profilesyncservice does not depend on it.
So handle null service gracefully instead of npe. Since services are created one per profile, this can happen only when browser is exiting.

BUG= 705545 

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

[modify] https://crrev.com/1c532233baf652b7af9189fb2bce159ae172e739/chrome/browser/supervised_user/supervised_user_service_factory.cc
[modify] https://crrev.com/1c532233baf652b7af9189fb2bce159ae172e739/chrome/browser/supervised_user/supervised_user_service_factory.h
[modify] https://crrev.com/1c532233baf652b7af9189fb2bce159ae172e739/chrome/browser/sync/chrome_sync_client.cc
[modify] https://crrev.com/1c532233baf652b7af9189fb2bce159ae172e739/chrome/browser/sync/profile_sync_service_factory.cc

Status: Fixed (was: Assigned)

Sign in to add a comment