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

Issue 10829051: [Sync] Avoid unnecessary DB rewrite for TokenService credentials that were just read from DB (Closed)

Created:
8 years, 5 months ago by Raghu Simha
Modified:
8 years, 4 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

[Sync] Avoid unnecessary DB rewrite for TokenService credentials that were just read from DB When the token service is initialized, tokens are read from disk via LoadTokensFromDB. The callback for this function after the DB read completes is LoadTokensIntoMemory. When LoadTokensIntoMemory is run, it calls UpdateCredentials, which implicitly rewrites the just-read credentials back to the DB. This DB write is unnecessary. An unintended side effect is that the credential caching service does an unnecessary file-write to "Sync Credentials" every single time Chrome is restarted, even though the sync credentials haven't changed in any way. This patch modifies LoadTokensIntoMemory to merely update |credentials_|, the in-memory credentials object, without updating the DB too. BUG=139263 TEST=unit_tests; Sign in to sync, restart chrome, and make sure TokenService credentials are not re-written to DB during initialization. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=148863

Patch Set 1 #

Total comments: 5

Patch Set 2 : Add DCHECK #

Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -4 lines) Patch
M chrome/browser/signin/token_service.cc View 1 2 chunks +9 lines, -4 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Raghu Simha
Roger, please review. Thanks!
8 years, 5 months ago (2012-07-27 00:48:40 UTC) #1
Raghu Simha
DIdn't see Roger in today. Drew, could you take a look, please?
8 years, 4 months ago (2012-07-27 17:50:24 UTC) #2
Andrew T Wilson (Slow)
http://codereview.chromium.org/10829051/diff/1/chrome/browser/signin/token_service.cc File chrome/browser/signin/token_service.cc (right): http://codereview.chromium.org/10829051/diff/1/chrome/browser/signin/token_service.cc#newcode372 chrome/browser/signin/token_service.cc:372: credentials_ = GaiaAuthConsumer::ClientLoginResult(sid, Are you sure it's safe to ...
8 years, 4 months ago (2012-07-27 18:01:16 UTC) #3
Roger Tawa OOO till Jul 10th
http://codereview.chromium.org/10829051/diff/1/chrome/browser/signin/token_service.cc File chrome/browser/signin/token_service.cc (right): http://codereview.chromium.org/10829051/diff/1/chrome/browser/signin/token_service.cc#newcode372 chrome/browser/signin/token_service.cc:372: credentials_ = GaiaAuthConsumer::ClientLoginResult(sid, I think it may be safer ...
8 years, 4 months ago (2012-07-27 18:18:35 UTC) #4
Andrew T Wilson (Slow)
Actually, can we just change UpdateCredentials to do nothing if the credentials themselves have not ...
8 years, 4 months ago (2012-07-27 18:20:33 UTC) #5
Raghu Simha
On 2012/07/27 18:20:33, Andrew T Wilson wrote: > Actually, can we just change UpdateCredentials to ...
8 years, 4 months ago (2012-07-27 21:04:35 UTC) #6
Roger Tawa OOO till Jul 10th
http://r885-1d6aae961b36-rogerta.chromiumcodereview-hr.appspot.com/10829051/diff/1/chrome/browser/signin/token_service.cc File chrome/browser/signin/token_service.cc (right): http://r885-1d6aae961b36-rogerta.chromiumcodereview-hr.appspot.com/10829051/diff/1/chrome/browser/signin/token_service.cc#newcode372 chrome/browser/signin/token_service.cc:372: credentials_ = GaiaAuthConsumer::ClientLoginResult(sid, On 2012/07/27 21:04:35, rsimha wrote: > ...
8 years, 4 months ago (2012-07-27 21:21:45 UTC) #7
Andrew T Wilson (Slow)
LGTM with Roger's suggestion of an assert.
8 years, 4 months ago (2012-07-27 21:35:39 UTC) #8
Raghu Simha
http://codereview.chromium.org/10829051/diff/1/chrome/browser/signin/token_service.cc File chrome/browser/signin/token_service.cc (right): http://codereview.chromium.org/10829051/diff/1/chrome/browser/signin/token_service.cc#newcode372 chrome/browser/signin/token_service.cc:372: credentials_ = GaiaAuthConsumer::ClientLoginResult(sid, On 2012/07/27 21:21:45, Roger Tawa wrote: ...
8 years, 4 months ago (2012-07-27 21:37:01 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rsimha@chromium.org/10829051/9002
8 years, 4 months ago (2012-07-27 23:14:53 UTC) #10
commit-bot: I haz the power
8 years, 4 months ago (2012-07-28 01:20:50 UTC) #11
Change committed as 148863

Powered by Google App Engine
This is Rietveld 408576698