| 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_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "content/browser/download/download_create_info.h" | 10 #include "content/browser/download/download_create_info.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/browser/download_item.h" | 12 #include "content/public/browser/download_item.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // Return if the download should be a parallel download. | |
| 17 CONTENT_EXPORT bool ShouldUseParallelDownload( | |
| 18 const DownloadCreateInfo& create_info); | |
| 19 | |
| 20 // Chunks the content that starts from |current_offset|, into at most | 16 // Chunks the content that starts from |current_offset|, into at most |
| 21 // std::max(|request_count|, 1) smaller slices. | 17 // std::max(|request_count|, 1) smaller slices. |
| 22 // Each slice contains at least |min_slice_size| bytes unless |total_length| | 18 // Each slice contains at least |min_slice_size| bytes unless |total_length| |
| 23 // is less than |min_slice_size|. | 19 // is less than |min_slice_size|. |
| 24 // The last slice is half opened. | 20 // The last slice is half opened. |
| 25 CONTENT_EXPORT std::vector<DownloadItem::ReceivedSlice> | 21 CONTENT_EXPORT std::vector<DownloadItem::ReceivedSlice> |
| 26 FindSlicesForRemainingContent(int64_t current_offset, | 22 FindSlicesForRemainingContent(int64_t current_offset, |
| 27 int64_t total_length, | 23 int64_t total_length, |
| 28 int request_count, | 24 int request_count, |
| 29 int64_t min_slice_size); | 25 int64_t min_slice_size); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 54 // Get the time delay to send parallel requests after the response of original | 50 // Get the time delay to send parallel requests after the response of original |
| 55 // request is handled. | 51 // request is handled. |
| 56 CONTENT_EXPORT base::TimeDelta GetParallelRequestDelayConfig(); | 52 CONTENT_EXPORT base::TimeDelta GetParallelRequestDelayConfig(); |
| 57 | 53 |
| 58 // Print the states of received slices for debugging. | 54 // Print the states of received slices for debugging. |
| 59 CONTENT_EXPORT void DebugSlicesInfo(const DownloadItem::ReceivedSlices& slices); | 55 CONTENT_EXPORT void DebugSlicesInfo(const DownloadItem::ReceivedSlices& slices); |
| 60 | 56 |
| 61 } // namespace content | 57 } // namespace content |
| 62 | 58 |
| 63 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_ | 59 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_ |
| OLD | NEW |