Index: chrome/browser/net/predictor_api.cc |
diff --git a/chrome/browser/net/predictor_api.cc b/chrome/browser/net/predictor_api.cc |
index 232cb9fffe3ca0795abe9e688b39af67a1709a05..d9434f308337b404efd80c0f90bcb86295b9856d 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,12 +485,15 @@ 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(), |
jar (doing other things)
2011/04/04 19:18:33
This makes very little sense to me. I'm *guessing
jar (doing other things)
2011/04/05 06:18:39
I suspect this may actually be the source of a lar
battre
2011/04/05 14:09:50
I thought about this.
I think the code is safe be
jar (doing other things)
2011/04/05 16:03:11
<sigh> Ok... I'm convinced your change is correct
|
+ update_referral_list.Get(), |
&completion)); |
DCHECK(posted); |
@@ -505,11 +509,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) && |