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

Unified Diff: content/browser/download/parallel_download_utils.cc

Issue 2730363004: Parallel Download finch config parameters on Chrome client. (Closed)
Patch Set: Fix for new code merged in. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/parallel_download_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/download/parallel_download_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698