Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: components/signin/core/browser/account_fetcher_service.cc

Issue 1380103004: Delay fetching account info until OnRefreshTokensLoaded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delay AFS fetch properly Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/signin/core/browser/account_fetcher_service.cc
diff --git a/components/signin/core/browser/account_fetcher_service.cc b/components/signin/core/browser/account_fetcher_service.cc
index 22c804f6b496723a0a935e75abe82b37765e7d51..a8c4370ed8daa28c7d0a951fd0b067d8fec6ff8d 100644
--- a/components/signin/core/browser/account_fetcher_service.cc
+++ b/components/signin/core/browser/account_fetcher_service.cc
@@ -98,21 +98,6 @@ void AccountFetcherService::Shutdown() {
shutdown_called_ = true;
}
-void AccountFetcherService::EnableNetworkFetches() {
- DCHECK(CalledOnValidThread());
- DCHECK(!network_fetches_enabled_);
- network_fetches_enabled_ = true;
- // If there are accounts in |pending_user_info_fetches_|, they were deemed
- // invalid after being loaded from prefs and need to be fetched now instead of
- // waiting after the timer.
- for (const std::string& account_id : pending_user_info_fetches_)
- StartFetchingUserInfo(account_id);
- pending_user_info_fetches_.clear();
-
- // Now that network fetches are enabled, schedule the next refresh.
- ScheduleNextRefresh();
-}
-
bool AccountFetcherService::IsAllUserInfoFetched() const {
return user_info_requests_.empty();
}
@@ -180,10 +165,8 @@ void AccountFetcherService::ScheduleNextRefresh() {
void AccountFetcherService::StartFetchingUserInfo(
const std::string& account_id) {
DCHECK(CalledOnValidThread());
- if (!network_fetches_enabled_) {
- pending_user_info_fetches_.push_back(account_id);
+ if (!network_fetches_enabled_)
return;
- }
if (!ContainsKey(user_info_requests_, account_id)) {
DVLOG(1) << "StartFetching " << account_id;
@@ -315,8 +298,11 @@ void AccountFetcherService::OnRefreshTokenRevoked(
}
void AccountFetcherService::OnRefreshTokensLoaded() {
- // OnRefreshTokenAvailable has been called for all accounts by this point.
- // Maybe remove this after further investigation.
+ DCHECK(CalledOnValidThread());
+ if (!network_fetches_enabled_) {
+ network_fetches_enabled_ = true;
+ ScheduleNextRefresh();
+ }
RefreshAllAccountInfo(true);
UpdateChildInfo();
}

Powered by Google App Engine
This is Rietveld 408576698