diff options
author | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-05 17:03:58 +0000 |
---|---|---|
committer | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-05 17:03:58 +0000 |
commit | 9c16051c8b721ef81ded80e618020957133491ab (patch) | |
tree | 5847b902887e8647fea6b845c8cf04d59dab0e12 /chrome/browser/net | |
parent | 553602e16e938000f103cc7d58e4aac3247508d7 (diff) | |
download | chromium_src-9c16051c8b721ef81ded80e618020957133491ab.zip chromium_src-9c16051c8b721ef81ded80e618020957133491ab.tar.gz chromium_src-9c16051c8b721ef81ded80e618020957133491ab.tar.bz2 |
Get rid of PrefService::GetMutableDictionary/GetMutableList
BUG=77914
TEST=none, trybots remain green
Review URL: http://codereview.chromium.org/6720016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/predictor_api.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/net/predictor_api.cc b/chrome/browser/net/predictor_api.cc index 232cb9f..d71402b 100644 --- a/chrome/browser/net/predictor_api.cc +++ b/chrome/browser/net/predictor_api.cc @@ -21,6 +21,7 @@ #include "chrome/browser/net/url_info.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -407,7 +408,7 @@ static void InitNetworkPredictor(TimeDelta max_dns_queue_delay, GetPredictedUrlListAtStartup(user_prefs, local_state); ListValue* referral_list = - static_cast<ListValue*>(user_prefs->GetMutableList( + static_cast<ListValue*>(user_prefs->GetList( prefs::kDnsPrefetchingHostReferralList)->DeepCopy()); // Remove obsolete preferences from local state if necessary. @@ -484,14 +485,19 @@ void SavePredictorStateForNextStartupAndTrim(PrefService* prefs) { base::WaitableEvent completion(true, false); + ListPrefUpdate update_startup_list(prefs, prefs::kDnsPrefetchingStartupList); + ListPrefUpdate update_referral_list(prefs, + prefs::kDnsPrefetchingHostReferralList); bool posted = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, NewRunnableFunction(SaveDnsPrefetchStateForNextStartupAndTrimOnIOThread, - prefs->GetMutableList(prefs::kDnsPrefetchingStartupList), - prefs->GetMutableList(prefs::kDnsPrefetchingHostReferralList), + update_startup_list.Get(), + update_referral_list.Get(), &completion)); + // TODO(jar): Synchronous waiting for the IO thread is a potential source + // to deadlocks and should be investigated. See http://crbug.com/78451. DCHECK(posted); if (posted) completion.Wait(); @@ -505,11 +511,11 @@ static UrlList GetPredictedUrlListAtStartup(PrefService* user_prefs, // This may catch secondary hostnames, pulled in by the homepages. It will // also catch more of the "primary" home pages, since that was (presumably) // rendered first (and will be rendered first this time too). - ListValue* startup_list = - user_prefs->GetMutableList(prefs::kDnsPrefetchingStartupList); + const ListValue* startup_list = + user_prefs->GetList(prefs::kDnsPrefetchingStartupList); if (startup_list) { - ListValue::iterator it = startup_list->begin(); + ListValue::const_iterator it = startup_list->begin(); int format_version = -1; if (it != startup_list->end() && (*it)->GetAsInteger(&format_version) && |