OLD | NEW |
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 Loading... |
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() && it->GetAsInteger(&format_version) && | 272 if (it != startup_list->end() && |
| 273 (*it)->GetAsInteger(&format_version) && |
273 format_version == kPredictorStartupFormatVersion) { | 274 format_version == kPredictorStartupFormatVersion) { |
274 ++it; | 275 ++it; |
275 for (; it != startup_list->end(); ++it) { | 276 for (; it != startup_list->end(); ++it) { |
276 std::string url_spec; | 277 std::string url_spec; |
277 if (!it->GetAsString(&url_spec)) { | 278 if (!(*it)->GetAsString(&url_spec)) { |
278 LOG(DFATAL); | 279 LOG(DFATAL); |
279 break; // Format incompatibility. | 280 break; // Format incompatibility. |
280 } | 281 } |
281 GURL url(url_spec); | 282 GURL url(url_spec); |
282 if (!url.has_host() || !url.has_scheme()) { | 283 if (!url.has_host() || !url.has_scheme()) { |
283 LOG(DFATAL); | 284 LOG(DFATAL); |
284 break; // Format incompatibility. | 285 break; // Format incompatibility. |
285 } | 286 } |
286 | 287 |
287 urls.push_back(url); | 288 urls.push_back(url); |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 } | 1201 } |
1201 | 1202 |
1202 void SimplePredictor::ShutdownOnUIThread() { | 1203 void SimplePredictor::ShutdownOnUIThread() { |
1203 SetShutdown(true); | 1204 SetShutdown(true); |
1204 } | 1205 } |
1205 | 1206 |
1206 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } | 1207 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } |
1207 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } | 1208 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } |
1208 | 1209 |
1209 } // namespace chrome_browser_net | 1210 } // namespace chrome_browser_net |
OLD | NEW |