| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // Build one http request for each slice from the second slice. | 69 // Build one http request for each slice from the second slice. |
| 70 // The first slice represents the original request. | 70 // The first slice represents the original request. |
| 71 void ForkSubRequests(const DownloadItem::ReceivedSlices& slices_to_download); | 71 void ForkSubRequests(const DownloadItem::ReceivedSlices& slices_to_download); |
| 72 | 72 |
| 73 // Create one range request, virtual for testing. | 73 // Create one range request, virtual for testing. |
| 74 virtual void CreateRequest(int64_t offset, int64_t length); | 74 virtual void CreateRequest(int64_t offset, int64_t length); |
| 75 | 75 |
| 76 // Information about the initial request when download is started. | 76 // Information about the initial request when download is started. |
| 77 int64_t initial_request_offset_; | 77 int64_t initial_request_offset_; |
| 78 int64_t initial_request_length_; | |
| 79 | 78 |
| 80 // The length of the response body of the original request. | 79 // The length of the response body of the original request. |
| 81 // Used to estimate the remaining size of the content when the initial | 80 // Used to estimate the remaining size of the content when the initial |
| 82 // request is half open, i.e, |initial_request_length_| is | 81 // request is half open, i.e, |initial_request_length_| is |
| 83 // DownloadSaveInfo::kLengthFullContent. | 82 // DownloadSaveInfo::kLengthFullContent. |
| 84 int64_t content_length_; | 83 int64_t content_length_; |
| 85 | 84 |
| 86 // Used to send parallel requests after a delay based on Finch config. | 85 // Used to send parallel requests after a delay based on Finch config. |
| 87 base::OneShotTimer timer_; | 86 base::OneShotTimer timer_; |
| 88 | 87 |
| 89 // If we have sent parallel requests. | 88 // If we have sent parallel requests. |
| 90 bool requests_sent_; | 89 bool requests_sent_; |
| 91 | 90 |
| 92 // If the download progress is canceled. | 91 // If the download progress is canceled. |
| 93 bool is_canceled_; | 92 bool is_canceled_; |
| 94 | 93 |
| 95 DISALLOW_COPY_AND_ASSIGN(ParallelDownloadJob); | 94 DISALLOW_COPY_AND_ASSIGN(ParallelDownloadJob); |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 } // namespace content | 97 } // namespace content |
| 99 | 98 |
| 100 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ | 99 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_JOB_H_ |
| OLD | NEW |