Chromium Code Reviews| 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 5bd4413c9628aaa6cb4e5ed3f6428919ae1613fd..d4ce68163b5dadad1265b1dffa403222f4ee0cfe 100644 |
| --- a/content/browser/download/parallel_download_utils.cc |
| +++ b/content/browser/download/parallel_download_utils.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/metrics/field_trial_params.h" |
| #include "base/strings/string_number_conversions.h" |
| +#include "base/time/time.h" |
| #include "content/public/browser/download_save_info.h" |
| #include "content/public/common/content_features.h" |
| @@ -28,6 +29,14 @@ const char kParallelRequestCountFinchKey[] = "request_count"; |
| // specified. |
| const int kParallelRequestCount = 2; |
| +// Finch parameter key value for the delay time in milliseconds to send |
| +// parallel requests after response of the original request is handled. |
| +const char kParallelRequestDelayFinchKey[] = "parallel_request_delay"; |
| + |
| +// Default value for parallel request delay. |
| +const base::TimeDelta kParallelRequestDelay = |
|
qinmin
2017/03/15 05:49:18
move this inside GetParallelRequestDelayConfig(),
xingliu
2017/03/15 17:48:52
Done.
|
| + base::TimeDelta::FromMilliseconds(0); |
| + |
| // TODO(qinmin): replace this with a comparator operator in |
| // DownloadItem::ReceivedSlice. |
| bool compareReceivedSlices(const DownloadItem::ReceivedSlice& lhs, |
| @@ -104,4 +113,13 @@ int GetParallelRequestCountConfig() { |
| : kParallelRequestCount; |
| } |
| +base::TimeDelta GetParallelRequestDelayConfig() { |
| + std::string finch_value = base::GetFieldTrialParamValueByFeature( |
| + features::kParallelDownloading, kParallelRequestDelayFinchKey); |
| + int64_t time_ms = 0; |
| + return !finch_value.empty() && base::StringToInt64(finch_value, &time_ms) |
|
David Trainor- moved to gerrit
2017/03/15 03:47:38
base::StringToInt64 will return false if you pass
xingliu
2017/03/15 17:48:52
Done, oh, i see, removed !finch_value.empty().
|
| + ? base::TimeDelta::FromMilliseconds(time_ms) |
| + : kParallelRequestDelay; |
| +} |
| + |
| } // namespace content |