summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-11 21:53:22 +0000
committertapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-11 21:53:22 +0000
commitdf0e2bc71ee5ea8a92ed2bdb3aa49ce323f91062 (patch)
tree4c1435686fd2a8fb50ed38f7207774a78c90e00d
parent49c9c62900ae936d911d55c4f74458644de6abdc (diff)
downloadchromium_src-df0e2bc71ee5ea8a92ed2bdb3aa49ce323f91062.zip
chromium_src-df0e2bc71ee5ea8a92ed2bdb3aa49ce323f91062.tar.gz
chromium_src-df0e2bc71ee5ea8a92ed2bdb3aa49ce323f91062.tar.bz2
Merge 186990
> Delay loading the SigninManagerFactory until the first-run Import process has completed. > > SigninManagerFactory depends on services that initialize databases > accessed by the import process. This change ignores profile added > notifications that occur while the import process is still running, > instead waiting for the import finished notification to complete signin > initialization. > > BUG=180459 > > Review URL: https://chromiumcodereview.appspot.com/12461010 TBR=tapted@chromium.org Review URL: https://codereview.chromium.org/12692006 git-svn-id: svn://svn.chromium.org/chrome/branches/1410/src@187381 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/policy/user_policy_signin_service.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/policy/user_policy_signin_service.cc b/chrome/browser/policy/user_policy_signin_service.cc
index 37fd193..a6b028d 100644
--- a/chrome/browser/policy/user_policy_signin_service.cc
+++ b/chrome/browser/policy/user_policy_signin_service.cc
@@ -248,6 +248,12 @@ UserPolicySigninService::UserPolicySigninService(
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_ADDED,
content::Source<Profile>(profile));
+
+ // Register a listener for the import finished notification in a first run
+ // scenario, which indicates the profile is ready to be further initialized.
+ registrar_.Add(this,
+ chrome::NOTIFICATION_IMPORT_FINISHED,
+ content::Source<Profile>(profile));
}
UserPolicySigninService::~UserPolicySigninService() {}
@@ -342,6 +348,16 @@ void UserPolicySigninService::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ // If an import process is running, wait for NOTIFICATION_IMPORT_FINISHED
+ // before potentially creating the SigninManager. Its dependencies can access
+ // databases that the import process is also accessing, causing conflicts.
+ // Note that the profile manager is NULL in unit tests.
+ if (g_browser_process->profile_manager() &&
+ g_browser_process->profile_manager()->will_import()) {
+ DCHECK_EQ(chrome::NOTIFICATION_PROFILE_ADDED, type);
+ return;
+ }
+
// If using a TestingProfile with no SigninManager or UserCloudPolicyManager,
// skip initialization.
if (!GetManager() || !SigninManagerFactory::GetForProfile(profile_)) {
@@ -353,6 +369,7 @@ void UserPolicySigninService::Observe(
case chrome::NOTIFICATION_GOOGLE_SIGNED_OUT:
ShutdownUserCloudPolicyManager();
break;
+ case chrome::NOTIFICATION_IMPORT_FINISHED:
case chrome::NOTIFICATION_PROFILE_ADDED: {
// A new profile has been loaded - if it's signed in, then initialize the
// UCPM, otherwise shut down the UCPM (which deletes any cached policy