Index: chrome/browser/chromeos/arc/arc_auth_context.cc |
diff --git a/chrome/browser/chromeos/arc/arc_auth_context.cc b/chrome/browser/chromeos/arc/arc_auth_context.cc |
index dc0e829e1a4b82b2e991210c4d8abf63a6292819..f390168d206ef58b82bbd58f27031402f8d6bed9 100644 |
--- a/chrome/browser/chromeos/arc/arc_auth_context.cc |
+++ b/chrome/browser/chromeos/arc/arc_auth_context.cc |
@@ -27,21 +27,18 @@ constexpr base::TimeDelta kRefreshTokenTimeout = |
} // namespace |
-ArcAuthContext::ArcAuthContext(Profile* profile) { |
+ArcAuthContext::ArcAuthContext(Profile* profile) : profile_(profile) { |
// Reuse storage used in ARC OptIn platform app. |
const std::string site_url = base::StringPrintf( |
"%s://%s/persist?%s", content::kGuestScheme, ArcSupportHost::kHostAppId, |
ArcSupportHost::kStorageId); |
storage_partition_ = content::BrowserContext::GetStoragePartitionForSite( |
- profile, GURL(site_url)); |
+ profile_, GURL(site_url)); |
CHECK(storage_partition_); |
// Get token service and account ID to fetch auth tokens. |
- token_service_ = ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
- const SigninManagerBase* const signin_manager = |
- SigninManagerFactory::GetForProfile(profile); |
- CHECK(token_service_ && signin_manager); |
- account_id_ = signin_manager->GetAuthenticatedAccountId(); |
khmel
2017/03/15 18:12:22
This is race condition on Chrome restart on crash.
xiyuan
2017/03/15 19:34:30
Not sure I understand why there is a race. SigninM
khmel
2017/03/15 19:39:05
InitProfilePreferences is not called in case of cr
xiyuan
2017/03/15 19:53:16
InitProfilePreferences stores the info in SigninMa
khmel
2017/03/16 02:07:24
So, I investigated this case and can confirm my su
xiyuan
2017/03/16 04:37:42
Thanks for looking into this.
I would prefer to a
khmel
2017/03/16 15:41:42
Yes, this works.
|
+ token_service_ = ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
+ CHECK(token_service_); |
} |
ArcAuthContext::~ArcAuthContext() { |
@@ -54,6 +51,12 @@ void ArcAuthContext::Prepare(const PrepareCallback& callback) { |
return; |
} |
+ const SigninManagerBase* const signin_manager = |
+ SigninManagerFactory::GetForProfile(profile_); |
+ CHECK(signin_manager); |
+ account_id_ = signin_manager->GetAuthenticatedAccountId(); |
+ DCHECK(!account_id_.empty()); |
+ |
callback_ = callback; |
token_service_->RemoveObserver(this); |
refresh_token_timeout_.Stop(); |