[Sync] Avoid unnecessary DB rewrite for TokenService credentials that were just read from DB
[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.


Review URL: https://chromiumcodereview.appspot.com/10829051

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@148863 0039d316-1c4b-4281-b951-d872f2087c98

jaruba/chromium.src,Pluto-tv/chromium-crosswalk,ondra-novak/chromium.src,hujiajie/pa-chromium,littlstar/chromium.src,mogoweb/chromium-crosswalk,mogoweb/chromium-crosswalk,ltilve/chromium,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,Just-D/chromium-1,mogoweb/chromium-crosswalk,Jonekee/chromium.src,timopulkkinen/BubbleFish,anirudhSK/chromium,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,axinging/chromium-crosswalk,Chilledheart/chromium,littlstar/chromium.src,Chilledheart/chromium,patrickm/chromium.src,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,timopulkkinen/BubbleFish,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,anirudhSK/chromium,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,dushu1203/chromium.src,zcbenz/cefode-chromium,chuan9/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,patrickm/chromium.src,Just-D/chromium-1,nacl-webkit/chrome_deps,mohamed--abdel-maksoud/chromium.src,hujiajie/pa-chromium,zcbenz/cefode-chromium,markYoungH/chromium.src,ltilve/chromium,Just-D/chromium-1,Fireblend/chromium-crosswalk,mogoweb/chromium-crosswalk,hujiajie/pa-chromium,hujiajie/pa-chromium,hgl888/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,M4sse/chromium.src,hgl888/chromium-crosswalk,Just-D/chromium-1,M4sse/chromium.src,nacl-webkit/chrome_deps,TheTypoMaster/chromium-crosswalk,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,patrickm/chromium.src,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,nacl-webkit/chrome_deps,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,Fireblend/chromium-crosswalk,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,M4sse/chromium.src,dushu1203/chromium.src,zcbenz/cefode-chromium,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,ChromiumWebApps/chromium,littlstar/chromium.src,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,patrickm/chromium.src,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,nacl-webkit/chrome_deps,nacl-webkit/chrome_deps,TheTypoMaster/chromium-crosswalk,junmin-zhu/chromium-rivertrail,littlstar/chromium.src,junmin-zhu/chromium-rivertrail,littlstar/chromium.src,M4sse/chromium.src,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,Jonekee/chromium.src,hgl888/chromium-crosswalk-efl,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,markYoungH/chromium.src,bright-sparks/chromium-spacewalk,pozdnyakov/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,axinging/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,ltilve/chromium,axinging/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Chilledheart/chromium,ondra-novak/chromium.src,jaruba/chromium.src,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,ChromiumWebApps/chromium,Fireblend/chromium-crosswalk,mogoweb/chromium-crosswalk,zcbenz/cefode-chromium,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,anirudhSK/chromium,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,Fireblend/chromium-crosswalk,littlstar/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,anirudhSK/chromium,hujiajie/pa-chromium,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,dednal/chromium.src,dednal/chromium.src,pozdnyakov/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,Just-D/chromium-1,dednal/chromium.src,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,dednal/chromium.src,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,timopulkkinen/BubbleFish,anirudhSK/chromium,ChromiumWebApps/chromium,patrickm/chromium.src,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,zcbenz/cefode-chromium,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,timopulkkinen/BubbleFish,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,M4sse/chromium.src,chuan9/chromium-crosswalk,markYoungH/chromium.src,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,markYoungH/chromium.src,junmin-zhu/chromium-rivertrail,Jonekee/chromium.src,fujunwei/chromium-crosswalk,Fireblend/chromium-crosswalk,pozdnyakov/chromium-crosswalk,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,chuan9/chromium-crosswalk,littlstar/chromium.src,Chilledheart/chromium,Just-D/chromium-1,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,Chilledheart/chromium,markYoungH/chromium.src,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk,ondra-novak/chromium.src,bright-sparks/chromium-spacewalk,dushu1203/chromium.src,hgl888/chromium-crosswalk,timopulkkinen/BubbleFish,ondra-novak/chromium.src,ltilve/chromium,hgl888/chromium-crosswalk,dednal/chromium.src,krieger-od/nwjs_chromium.src,Chilledheart/chromium,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,hujiajie/pa-chromium,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,dushu1203/chromium.src,axinging/chromium-crosswalk,ondra-novak/chromium.src,dednal/chromium.src,M4sse/chromium.src,patrickm/chromium.src,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,markYoungH/chromium.src,ltilve/chromium,Fireblend/chromium-crosswalk,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,axinging/chromium-crosswalk,pozdnyakov/chromium-crosswalk,Chilledheart/chromium,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,axinging/chromium-crosswalk,Jonekee/chromium.src,M4sse/chromium.src,zcbenz/cefode-chromium,anirudhSK/chromium,markYoungH/chromium.src,anirudhSK/chromium,dednal/chromium.src,hujiajie/pa-chromium,zcbenz/cefode-chromium,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,nacl-webkit/chrome_deps,dushu1203/chromium.src,dednal/chromium.src,Jonekee/chromium.src,ltilve/chromium,Jonekee/chromium.src,patrickm/chromium.src,dednal/chromium.src,ondra-novak/chromium.src,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,anirudhSK/chromium,ChromiumWebApps/chromium,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,zcbenz/cefode-chromium,zcbenz/cefode-chromium,anirudhSK/chromium,jaruba/chromium.src,krieger-od/nwjs_chromium.src,ltilve/chromium,axinging/chromium-crosswalk,Jonekee/chromium.src,pozdnyakov/chromium-crosswalk,markYoungH/chromium.src,nacl-webkit/chrome_deps,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,Fireblend/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,mogoweb/chromium-crosswalk,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,junmin-zhu/chromium-rivertrail,timopulkkinen/BubbleFish,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,jaruba/chromium.src,axinging/chromium-crosswalk,ChromiumWebApps/chromium,markYoungH/chromium.src,TheTypoMaster/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,Jonekee/chromium.src,zcbenz/cefode-chromium,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,ChromiumWebApps/chromium,ondra-novak/chromium.src,Just-D/chromium-1,nacl-webkit/chrome_deps,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,jaruba/chromium.src,patrickm/chromium.src,junmin-zhu/chromium-rivertrail,ltilve/chromium,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,littlstar/chromium.src,jaruba/chromium.src,patrickm/chromium.src,fujunwei/chromium-crosswalk,mogoweb/chromium-crosswalk,jaruba/chromium.src