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

Unified Diff: chrome/browser/signin/token_service.cc

Issue 10829051: [Sync] Avoid unnecessary DB rewrite for TokenService credentials that were just read from DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECK Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/token_service.cc
diff --git a/chrome/browser/signin/token_service.cc b/chrome/browser/signin/token_service.cc
index 536dcfa85d6dd65ed41bfd19e84204c1950cd31c..3e4d2f9312d3471ec23e744b987076f11381f6c3 100644
--- a/chrome/browser/signin/token_service.cc
+++ b/chrome/browser/signin/token_service.cc
@@ -347,6 +347,11 @@ void TokenService::OnWebDataServiceRequestDone(WebDataService::Handle h,
void TokenService::LoadTokensIntoMemory(
const std::map<std::string, std::string>& db_tokens,
std::map<std::string, std::string>* in_memory_tokens) {
+ // Ensure that there are no active fetchers at the time we first load
+ // tokens from the DB into memory.
+ for (size_t i = 0; i < arraysize(kServices); ++i) {
+ DCHECK(NULL == fetchers_[i].get());
+ }
for (size_t i = 0; i < arraysize(kServices); i++) {
LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens, kServices[i]);
@@ -369,10 +374,10 @@ void TokenService::LoadTokensIntoMemory(
sid = db_tokens.find(GaiaConstants::kGaiaSid)->second;
if (!lsid.empty() && !sid.empty()) {
- UpdateCredentials(GaiaAuthConsumer::ClientLoginResult(sid,
- lsid,
- std::string(),
- std::string()));
+ credentials_ = GaiaAuthConsumer::ClientLoginResult(sid,
+ lsid,
+ std::string(),
+ std::string());
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698