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 #Messages
Total messages: 11 (0 generated)
|