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

Side by Side Diff: chrome/browser/net/predictor.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Rebase Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/predictor.h" 5 #include "chrome/browser/net/predictor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <iterator> 9 #include <iterator>
10 #include <set> 10 #include <set>
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // Recall list of URLs we learned about during last session. 262 // Recall list of URLs we learned about during last session.
263 // This may catch secondary hostnames, pulled in by the homepages. It will 263 // This may catch secondary hostnames, pulled in by the homepages. It will
264 // also catch more of the "primary" home pages, since that was (presumably) 264 // also catch more of the "primary" home pages, since that was (presumably)
265 // rendered first (and will be rendered first this time too). 265 // rendered first (and will be rendered first this time too).
266 const base::ListValue* startup_list = 266 const base::ListValue* startup_list =
267 user_prefs->GetList(prefs::kDnsPrefetchingStartupList); 267 user_prefs->GetList(prefs::kDnsPrefetchingStartupList);
268 268
269 if (startup_list) { 269 if (startup_list) {
270 base::ListValue::const_iterator it = startup_list->begin(); 270 base::ListValue::const_iterator it = startup_list->begin();
271 int format_version = -1; 271 int format_version = -1;
272 if (it != startup_list->end() && 272 if (it != startup_list->end() && it->GetAsInteger(&format_version) &&
273 (*it)->GetAsInteger(&format_version) &&
274 format_version == kPredictorStartupFormatVersion) { 273 format_version == kPredictorStartupFormatVersion) {
275 ++it; 274 ++it;
276 for (; it != startup_list->end(); ++it) { 275 for (; it != startup_list->end(); ++it) {
277 std::string url_spec; 276 std::string url_spec;
278 if (!(*it)->GetAsString(&url_spec)) { 277 if (!it->GetAsString(&url_spec)) {
279 LOG(DFATAL); 278 LOG(DFATAL);
280 break; // Format incompatibility. 279 break; // Format incompatibility.
281 } 280 }
282 GURL url(url_spec); 281 GURL url(url_spec);
283 if (!url.has_host() || !url.has_scheme()) { 282 if (!url.has_host() || !url.has_scheme()) {
284 LOG(DFATAL); 283 LOG(DFATAL);
285 break; // Format incompatibility. 284 break; // Format incompatibility.
286 } 285 }
287 286
288 urls.push_back(url); 287 urls.push_back(url);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 } 1200 }
1202 1201
1203 void SimplePredictor::ShutdownOnUIThread() { 1202 void SimplePredictor::ShutdownOnUIThread() {
1204 SetShutdown(true); 1203 SetShutdown(true);
1205 } 1204 }
1206 1205
1207 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } 1206 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; }
1208 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } 1207 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; }
1209 1208
1210 } // namespace chrome_browser_net 1209 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/metrics/plugin_metrics_provider.cc ('k') | chrome/browser/net/predictor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698