| Index: content/browser/download/parallel_download_utils.cc
|
| diff --git a/content/browser/download/parallel_download_utils.cc b/content/browser/download/parallel_download_utils.cc
|
| index ea3c29d69dbd28fefa00468802f436defe1c3e87..d21ea49f20c061e15a062e6fec4758ea0e905705 100644
|
| --- a/content/browser/download/parallel_download_utils.cc
|
| +++ b/content/browser/download/parallel_download_utils.cc
|
| @@ -4,10 +4,32 @@
|
|
|
| #include "content/browser/download/parallel_download_utils.h"
|
|
|
| +#include "base/metrics/field_trial_params.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "content/public/browser/download_save_info.h"
|
| +#include "content/public/common/content_features.h"
|
|
|
| namespace content {
|
|
|
| +namespace {
|
| +
|
| +// Finch parameter key value for minimum slice size in bytes to use parallel
|
| +// download.
|
| +const char kMinSliceSizeFinchKey[] = "min_slice_size";
|
| +
|
| +// Default value for |kMinSliceSizeFinchKey|, when no parameter is specified.
|
| +const int64_t kMinSliceSizeParallelDownload = 2097152;
|
| +
|
| +// Finch parameter key value for number of parallel requests in a parallel
|
| +// download, including the original request.
|
| +const char kParallelRequestCountFinchKey[] = "request_count";
|
| +
|
| +// Default value for |kParallelRequestCountFinchKey|, when no parameter is
|
| +// specified.
|
| +const int kParallelRequestCount = 2;
|
| +
|
| +} // namespace
|
| +
|
| std::vector<DownloadItem::ReceivedSlice> FindSlicesToDownload(
|
| const std::vector<DownloadItem::ReceivedSlice>& received_slices) {
|
| std::vector<DownloadItem::ReceivedSlice> result;
|
| @@ -39,4 +61,22 @@ std::vector<DownloadItem::ReceivedSlice> FindSlicesToDownload(
|
| return result;
|
| }
|
|
|
| +int64_t GetMinSliceSizeConfig() {
|
| + std::string finch_value = base::GetFieldTrialParamValueByFeature(
|
| + features::kParallelDownloading, kMinSliceSizeFinchKey);
|
| + int64_t result;
|
| + return !finch_value.empty() && base::StringToInt64(finch_value, &result)
|
| + ? result
|
| + : kMinSliceSizeParallelDownload;
|
| +}
|
| +
|
| +int GetParallelRequestCountConfig() {
|
| + std::string finch_value = base::GetFieldTrialParamValueByFeature(
|
| + features::kParallelDownloading, kParallelRequestCountFinchKey);
|
| + int result;
|
| + return !finch_value.empty() && base::StringToInt(finch_value, &result)
|
| + ? result
|
| + : kParallelRequestCount;
|
| +}
|
| +
|
| } // namespace content
|
|
|