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

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

Issue 2806923002: Don't create parallel request if download is about to complete (Closed)
Patch Set: add UMA and finch Created 3 years, 8 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') | tools/metrics/histograms/histograms.xml » ('j') | 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 5fe904367a0c4946e2ec3a22dab17e89fe88938b..cf47408ed822ae129476b4f9c9e32ee04cacdc97 100644
--- a/content/browser/download/parallel_download_utils.cc
+++ b/content/browser/download/parallel_download_utils.cc
@@ -33,6 +33,15 @@ const int kParallelRequestCount = 2;
// parallel requests after response of the original request is handled.
const char kParallelRequestDelayFinchKey[] = "parallel_request_delay";
+// Finch parameter key value for the remaining time in seconds that is required
+// to send parallel requests.
+const char kParallelRequestRemainingTimeFinchKey[] =
+ "parallel_request_remaining_time";
+
+// The default remaining download time in seconds required for parallel request
+// creation.
+const int kDefaultRemainingTimeInSeconds = 10;
+
// TODO(qinmin): replace this with a comparator operator in
// DownloadItem::ReceivedSlice.
bool compareReceivedSlices(const DownloadItem::ReceivedSlice& lhs,
@@ -141,6 +150,15 @@ base::TimeDelta GetParallelRequestDelayConfig() {
: base::TimeDelta::FromMilliseconds(0);
}
+base::TimeDelta GetParallelRequestRemainingTimeConfig() {
+ std::string finch_value = base::GetFieldTrialParamValueByFeature(
+ features::kParallelDownloading, kParallelRequestRemainingTimeFinchKey);
+ int time_in_seconds = 0;
+ return base::StringToInt(finch_value, &time_in_seconds)
+ ? base::TimeDelta::FromSeconds(time_in_seconds)
+ : base::TimeDelta::FromSeconds(kDefaultRemainingTimeInSeconds);
+}
+
void DebugSlicesInfo(const DownloadItem::ReceivedSlices& slices) {
DVLOG(1) << "Received slices size : " << slices.size();
for (const auto& it : slices) {
« no previous file with comments | « content/browser/download/parallel_download_utils.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698