Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: content/browser/download/parallel_download_utils.h

Issue 2742093002: Glue parallel download job and download file together. (Closed)
Patch Set: Rebase, and adjust unittests with recent landed CLs. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "content/public/browser/download_item.h" 12 #include "content/public/browser/download_item.h"
12 13
13 namespace content { 14 namespace content {
14 15
16 // Return if the download should be a parallel download.
17 CONTENT_EXPORT bool ShouldUseParallelDownload(
18 const DownloadCreateInfo& create_info);
19
20 // Return the slices to download for the remaining content.
21 // This function chunks the content into slices.
22 CONTENT_EXPORT std::vector<DownloadItem::ReceivedSlice>
23 FindSlicesForRemainingContent(int64_t bytes_received,
24 int64_t content_length,
25 int request_count);
26
15 // Given an array of slices that are received, returns an array of slices to 27 // Given an array of slices that are received, returns an array of slices to
16 // download. |received_slices| must be ordered by offsets. 28 // download. |received_slices| must be ordered by offsets.
17 CONTENT_EXPORT std::vector<DownloadItem::ReceivedSlice> FindSlicesToDownload( 29 CONTENT_EXPORT std::vector<DownloadItem::ReceivedSlice> FindSlicesToDownload(
18 const std::vector<DownloadItem::ReceivedSlice>& received_slices); 30 const std::vector<DownloadItem::ReceivedSlice>& received_slices);
19 31
20 // Adds or merges a new received slice into a vector of sorted slices. If the 32 // Adds or merges a new received slice into a vector of sorted slices. If the
21 // slice can be merged with the slice preceding it, merge the 2 slices. 33 // slice can be merged with the slice preceding it, merge the 2 slices.
22 // Otherwise, insert the slice and keep the vector sorted. Returns the index 34 // Otherwise, insert the slice and keep the vector sorted. Returns the index
23 // of the newly updated slice. 35 // of the newly updated slice.
24 CONTENT_EXPORT size_t AddOrMergeReceivedSliceIntoSortedArray( 36 CONTENT_EXPORT size_t AddOrMergeReceivedSliceIntoSortedArray(
(...skipping 10 matching lines...) Expand all
35 // Get the request count for parallel download from finch configuration. 47 // Get the request count for parallel download from finch configuration.
36 CONTENT_EXPORT int GetParallelRequestCountConfig(); 48 CONTENT_EXPORT int GetParallelRequestCountConfig();
37 49
38 // 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
39 // request is handled. 51 // request is handled.
40 CONTENT_EXPORT base::TimeDelta GetParallelRequestDelayConfig(); 52 CONTENT_EXPORT base::TimeDelta GetParallelRequestDelayConfig();
41 53
42 } // namespace content 54 } // namespace content
43 55
44 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_ 56 #endif // CONTENT_BROWSER_DOWNLOAD_PARALLEL_DOWNLOAD_UTILS_H_
OLDNEW
« no previous file with comments | « content/browser/download/parallel_download_job_unittest.cc ('k') | content/browser/download/parallel_download_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698