OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/precache/core/precache_fetcher.h" | 5 #include "components/precache/core/precache_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 DCHECK_NE(std::string(), prefix) | 331 DCHECK_NE(std::string(), prefix) |
332 << "Could not determine the precache manifest URL prefix."; | 332 << "Could not determine the precache manifest URL prefix."; |
333 | 333 |
334 // Keep track of manifest URLs that are being fetched, in order to remove | 334 // Keep track of manifest URLs that are being fetched, in order to remove |
335 // duplicates. | 335 // duplicates. |
336 base::hash_set<std::string> unique_manifest_urls; | 336 base::hash_set<std::string> unique_manifest_urls; |
337 | 337 |
338 // Attempt to fetch manifests for starting hosts up to the maximum top sites | 338 // Attempt to fetch manifests for starting hosts up to the maximum top sites |
339 // count. If a manifest does not exist for a particular starting host, then | 339 // count. If a manifest does not exist for a particular starting host, then |
340 // the fetch will fail, and that starting host will be ignored. | 340 // the fetch will fail, and that starting host will be ignored. |
341 int64 rank = 0; | 341 int64_t rank = 0; |
342 for (const std::string& host : starting_hosts_) { | 342 for (const std::string& host : starting_hosts_) { |
343 ++rank; | 343 ++rank; |
344 if (rank > config.top_sites_count()) | 344 if (rank > config.top_sites_count()) |
345 break; | 345 break; |
346 unique_manifest_urls.insert(ConstructManifestURL(prefix, host)); | 346 unique_manifest_urls.insert(ConstructManifestURL(prefix, host)); |
347 } | 347 } |
348 | 348 |
349 for (const std::string& url : config.forced_site()) | 349 for (const std::string& url : config.forced_site()) |
350 unique_manifest_urls.insert(ConstructManifestURL(prefix, url)); | 350 unique_manifest_urls.insert(ConstructManifestURL(prefix, url)); |
351 | 351 |
(...skipping 18 matching lines...) Expand all Loading... |
370 StartNextFetch(); | 370 StartNextFetch(); |
371 } | 371 } |
372 | 372 |
373 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { | 373 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { |
374 // The resource has already been put in the cache during the fetch process, so | 374 // The resource has already been put in the cache during the fetch process, so |
375 // nothing more needs to be done for the resource. | 375 // nothing more needs to be done for the resource. |
376 StartNextFetch(); | 376 StartNextFetch(); |
377 } | 377 } |
378 | 378 |
379 } // namespace precache | 379 } // namespace precache |
OLD | NEW |