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

Unified Diff: chrome/browser/net/predictor_api.cc

Issue 5800004: Migrate HostReferralList and StartupDNSPrefetchList from local_state to user ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/predictor_api.cc
===================================================================
--- chrome/browser/net/predictor_api.cc (revision 68772)
+++ chrome/browser/net/predictor_api.cc (working copy)
@@ -133,12 +133,9 @@
g_browser_process->io_thread()->ChangedToOnTheRecord();
}
-void RegisterPrefs(PrefService* local_state) {
- local_state->RegisterListPref(prefs::kDnsStartupPrefetchList);
- local_state->RegisterListPref(prefs::kDnsHostReferralList);
-}
-
void RegisterUserPrefs(PrefService* user_prefs) {
+ user_prefs->RegisterListPref(prefs::kDnsStartupPrefetchList);
+ user_prefs->RegisterListPref(prefs::kDnsHostReferralList);
user_prefs->RegisterBooleanPref(prefs::kDnsPrefetchingEnabled, true);
}
@@ -392,9 +389,13 @@
UrlList urls =
GetPredictedUrlListAtStartup(user_prefs, local_state);
+ // Migrate HostReferralList from local_state to user prefs if needed.
ListValue* referral_list =
- static_cast<ListValue*>(
- local_state->GetMutableList(prefs::kDnsHostReferralList)->DeepCopy());
+ (local_state->FindPreference(prefs::kDnsHostReferralList)) ?
jar (doing other things) 2010/12/13 20:27:29 If this is where you migrate the data, perhaps it
Miranda Callahan 2010/12/14 01:03:49 I think everything you say about deleting old data
+ static_cast<ListValue*>(
+ local_state->GetMutableList(prefs::kDnsHostReferralList)->DeepCopy()) :
+ static_cast<ListValue*>(
+ user_prefs->GetMutableList(prefs::kDnsHostReferralList)->DeepCopy());
g_browser_process->io_thread()->InitNetworkPredictor(
prefetching_enabled, max_dns_queue_delay, max_parallel_resolves, urls,
@@ -479,8 +480,12 @@
// 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).
+ // Migrate StartupPrefetchList from local_state to user prefs if needed.
ListValue* startup_list =
- local_state->GetMutableList(prefs::kDnsStartupPrefetchList);
+ (local_state->FindPreference(prefs::kDnsStartupPrefetchList)) ?
+ local_state->GetMutableList(prefs::kDnsStartupPrefetchList) :
+ user_prefs->GetMutableList(prefs::kDnsStartupPrefetchList);
+
if (startup_list) {
ListValue::iterator it = startup_list->begin();
int format_version = -1;

Powered by Google App Engine
This is Rietveld 408576698