| Index: components/precache/core/precache_fetcher.cc
|
| diff --git a/components/precache/core/precache_fetcher.cc b/components/precache/core/precache_fetcher.cc
|
| index cfcc3dcffb43c4c109cc7dfa3d5a3b334e24ee79..16effb64d34e3a866d075fe49b50748012a9b219 100644
|
| --- a/components/precache/core/precache_fetcher.cc
|
| +++ b/components/precache/core/precache_fetcher.cc
|
| @@ -46,11 +46,15 @@ const int kNoTracking =
|
| net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES |
|
| net::LOAD_DO_NOT_SEND_AUTH_DATA;
|
|
|
| -namespace {
|
| -
|
| // The maximum number of URLFetcher requests that can be on flight in parallel.
|
| const int kMaxParallelFetches = 10;
|
|
|
| +int GetDefaultMaxParallelFetches() {
|
| + return kMaxParallelFetches;
|
| +}
|
| +
|
| +namespace {
|
| +
|
| // The maximum for the Precache.Fetch.ResponseBytes.* histograms. We set this to
|
| // a number we expect to be in the 99th percentile for the histogram, give or
|
| // take.
|
| @@ -327,7 +331,7 @@ PrecacheFetcher::PrecacheFetcher(
|
| config_url_(config_url),
|
| manifest_url_prefix_(manifest_url_prefix),
|
| precache_delegate_(precache_delegate),
|
| - pool_(kMaxParallelFetches),
|
| + pool_(GetDefaultMaxParallelFetches()),
|
| experiment_id_(experiment_id) {
|
| DCHECK(request_context_.get()); // Request context must be non-NULL.
|
| DCHECK(precache_delegate_); // Precache delegate must be non-NULL.
|
| @@ -416,14 +420,11 @@ void PrecacheFetcher::StartNextResourceFetch() {
|
| }
|
|
|
| void PrecacheFetcher::StartNextManifestFetch() {
|
| - if (manifest_urls_to_fetch_.empty())
|
| + if (manifest_urls_to_fetch_.empty() || !pool_.IsAvailable())
|
| return;
|
|
|
| // We only fetch one manifest at a time to keep the size of
|
| // resource_urls_to_fetch_ as small as possible.
|
| - DCHECK(pool_.IsAvailable())
|
| - << "There are no available parallel requests to fetch the next manifest. "
|
| - "Did you forget to call Delete?";
|
| VLOG(3) << "Fetching " << manifest_urls_to_fetch_.front();
|
| pool_.Add(base::WrapUnique(new Fetcher(
|
| request_context_.get(), manifest_urls_to_fetch_.front(),
|
|
|