Commit 13c9a810 authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

OOBE: Make UserSessionManager more robust to shutdown during the login

* Use AsWeakPtr instead of base::Unretained in the WizardController
* Check chrome::IsAttemptingShutdown together with
browser_shutdown::IsTryingToQuit. IsAttemptingShutdown covers call to
chrome::AttemptUserExit() which is common in the Chrome OS login/policy
code.

Bug: 1132397
Change-Id: I6c0e28138918a998c94f82f5c9e7736df92e5ced
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450051Reviewed-by: default avatarThomas Tellier <tellier@google.com>
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813764}
parent ebce367e
...@@ -2136,7 +2136,7 @@ EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { ...@@ -2136,7 +2136,7 @@ EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() {
void UserSessionManager::DoBrowserLaunchInternal(Profile* profile, void UserSessionManager::DoBrowserLaunchInternal(Profile* profile,
LoginDisplayHost* login_host, LoginDisplayHost* login_host,
bool locale_pref_checked) { bool locale_pref_checked) {
if (browser_shutdown::IsTryingToQuit()) if (browser_shutdown::IsTryingToQuit() || chrome::IsAttemptingShutdown())
return; return;
if (!locale_pref_checked) { if (!locale_pref_checked) {
...@@ -2210,7 +2210,7 @@ void UserSessionManager::DoBrowserLaunchInternal(Profile* profile, ...@@ -2210,7 +2210,7 @@ void UserSessionManager::DoBrowserLaunchInternal(Profile* profile,
void UserSessionManager::RespectLocalePreferenceWrapper( void UserSessionManager::RespectLocalePreferenceWrapper(
Profile* profile, Profile* profile,
const base::Closure& callback) { const base::Closure& callback) {
if (browser_shutdown::IsTryingToQuit()) if (browser_shutdown::IsTryingToQuit() || chrome::IsAttemptingShutdown())
return; return;
const user_manager::User* const user = const user_manager::User* const user =
......
...@@ -1445,11 +1445,10 @@ void WizardController::OnOobeFlowFinished() { ...@@ -1445,11 +1445,10 @@ void WizardController::OnOobeFlowFinished() {
// Launch browser and delete login host controller. // Launch browser and delete login host controller.
content::GetUIThreadTaskRunner({})->PostTask( content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, FROM_HERE, base::BindOnce(&UserSessionManager::DoBrowserLaunch,
base::BindOnce(&UserSessionManager::DoBrowserLaunch, UserSessionManager::GetInstance()->AsWeakPtr(),
base::Unretained(UserSessionManager::GetInstance()), ProfileManager::GetActiveUserProfile(),
ProfileManager::GetActiveUserProfile(), GetLoginDisplayHost()));
GetLoginDisplayHost()));
} }
void WizardController::OnDeviceDisabledChecked(bool device_disabled) { void WizardController::OnDeviceDisabledChecked(bool device_disabled) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment