Chromium Code Reviews| Index: content/browser/download/parallel_download_job.cc |
| diff --git a/content/browser/download/parallel_download_job.cc b/content/browser/download/parallel_download_job.cc |
| index c8bba093fa4d9ed30d7e44329826058fa4f3727c..827d348f00c0cec7670a51da1889884f0583cca6 100644 |
| --- a/content/browser/download/parallel_download_job.cc |
| +++ b/content/browser/download/parallel_download_job.cc |
| @@ -49,6 +49,14 @@ void ParallelDownloadJob::Resume(bool resume_request) { |
| worker->Resume(); |
| } |
| +void ParallelDownloadJob::OnServerResponseError( |
| + DownloadWorker* worker, |
| + DownloadInterruptReason reason) { |
| + // TODO(xingliu): Consider to let the original request to cover the full |
|
David Trainor- moved to gerrit
2017/03/14 18:01:43
Would this ever depend on how much content we've '
xingliu
2017/03/14 21:33:21
Yes, we have the logic to limit the length of prec
|
| + // content if the sub-requests get invalid response. |
| + DownloadJob::Interrupt(reason); |
| +} |
| + |
| void ParallelDownloadJob::ForkRequestsForNewDownload(int64_t bytes_received, |
| int64_t total_bytes, |
| int request_count) { |
| @@ -63,7 +71,6 @@ void ParallelDownloadJob::ForkRequestsForNewDownload(int64_t bytes_received, |
| int num_requests = bytes_left / slice_size; |
| int64_t current_offset = bytes_received + slice_size; |
| - // TODO(xingliu): Add records for slices in history db. |
| for (int i = 0; i < num_requests - 1; ++i) { |
| int64_t length = (i == (num_requests - 2)) |
| ? slice_size + (bytes_left % slice_size) |
| @@ -100,7 +107,8 @@ void ParallelDownloadJob::BuildParallelRequests() { |
| } |
| void ParallelDownloadJob::CreateRequest(int64_t offset, int64_t length) { |
| - std::unique_ptr<DownloadWorker> worker = base::MakeUnique<DownloadWorker>(); |
| + std::unique_ptr<DownloadWorker> worker = |
| + base::MakeUnique<DownloadWorker>(this, offset, length); |
| DCHECK(download_item_); |
| StoragePartition* storage_partition = |