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

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

Issue 2823273004: Add new UMA stats for parallelizable download (Closed)
Patch Set: 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
Index: content/browser/download/download_file_impl.cc
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index f65534b2c0783a97d5f587a70711d2d625077644..a45b3da5d47c99c2ea32c287298b8d23edc26d2e 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -129,7 +129,8 @@ DownloadFileImpl::~DownloadFileImpl() {
void DownloadFileImpl::Initialize(
const InitializeCallback& callback,
- const DownloadItem::ReceivedSlices& received_slices) {
+ const DownloadItem::ReceivedSlices& received_slices,
+ bool is_parallelizable) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
update_timer_.reset(new base::RepeatingTimer());
@@ -155,6 +156,7 @@ void DownloadFileImpl::Initialize(
download_start_ = base::TimeTicks::Now();
last_update_time_ = download_start_;
+ record_stream_bandwidth_ = is_parallelizable;
xingliu 2017/04/19 02:18:11 Can we initialize this to false in the constructor
qinmin 2017/04/19 22:42:33 Done.
// Primarily to make reset to zero in restart visible to owner.
SendUpdate();
@@ -482,11 +484,12 @@ void DownloadFileImpl::StreamActive(SourceStream* source_stream) {
if (IsDownloadCompleted()) {
RecordFileBandwidth(bytes_seen_, disk_writes_time_,
base::TimeTicks::Now() - download_start_);
- if (IsSparseFile() && record_stream_bandwidth_) {
- RecordParallelDownloadStats(bytes_seen_with_parallel_streams_,
- download_time_with_parallel_streams_,
- bytes_seen_without_parallel_streams_,
- download_time_without_parallel_streams_);
+ if (record_stream_bandwidth_) {
+ RecordParallelizableDownloadStats(
+ bytes_seen_with_parallel_streams_,
+ download_time_with_parallel_streams_,
+ bytes_seen_without_parallel_streams_,
+ download_time_without_parallel_streams_, IsSparseFile());
}
weak_factory_.InvalidateWeakPtrs();
std::unique_ptr<crypto::SecureHash> hash_state = file_.Finish();

Powered by Google App Engine
This is Rietveld 408576698