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

Unified Diff: content/browser/download/download_item_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_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 2d0a2c4a7489b3298a2e9eb0e73697350c036d9d..1fdb4adcc90dfe898f3d8d86bc2e30165dc9931a 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -271,7 +271,8 @@ DownloadItemImpl::DownloadItemImpl(
current_path_(path),
net_log_(net_log),
weak_ptr_factory_(this) {
- job_ = base::MakeUnique<DownloadJobImpl>(this, std::move(request_handle));
+ job_ =
+ base::MakeUnique<DownloadJobImpl>(this, std::move(request_handle), false);
delegate_->Attach();
Init(true /* actively downloading */, SRC_SAVE_PAGE_AS);
}
@@ -1224,8 +1225,10 @@ void DownloadItemImpl::Start(
download_file_ = std::move(file);
job_ = DownloadJobFactory::CreateJob(this, std::move(req_handle),
new_create_info);
- if (job_->UsesParallelRequests())
- RecordParallelDownloadCount(START_COUNT);
+ if (job_->IsParallelizable()) {
+ RecordParallelizableDownloadCount(START_COUNT,
+ job_->UsesParallelRequests());
+ }
deferred_interrupt_reason_ = DOWNLOAD_INTERRUPT_REASON_NONE;
@@ -1276,8 +1279,9 @@ void DownloadItemImpl::Start(
if (state_ == INITIAL_INTERNAL) {
RecordDownloadCount(NEW_DOWNLOAD_COUNT);
- if (job_->UsesParallelRequests())
- RecordParallelDownloadCount(NEW_DOWNLOAD_COUNT);
+ if (job_->IsParallelizable())
+ RecordParallelizableDownloadCount(NEW_DOWNLOAD_COUNT,
+ job_->UsesParallelRequests());
RecordDownloadMimeType(mime_type_);
if (!GetBrowserContext()->IsOffTheRecord()) {
RecordDownloadCount(NEW_DOWNLOAD_COUNT_NORMAL_PROFILE);
@@ -1305,7 +1309,7 @@ void DownloadItemImpl::StartDownload() {
base::Unretained(download_file_.get()),
base::Bind(&DownloadItemImpl::OnDownloadFileInitialized,
weak_ptr_factory_.GetWeakPtr()),
- received_slices_));
+ received_slices_, job_ && job_->IsParallelizable()));
}
void DownloadItemImpl::OnDownloadFileInitialized(
@@ -1608,8 +1612,10 @@ void DownloadItemImpl::Completed() {
if (!GetBrowserContext()->IsOffTheRecord()) {
RecordDownloadCount(COMPLETED_COUNT_NORMAL_PROFILE);
}
- if (job_ && job_->UsesParallelRequests())
- RecordParallelDownloadCount(COMPLETED_COUNT);
+ if (job_ && job_->IsParallelizable()) {
+ RecordParallelizableDownloadCount(COMPLETED_COUNT,
+ job_->UsesParallelRequests());
+ }
if (auto_opened_) {
// If it was already handled by the delegate, do nothing.
@@ -1757,14 +1763,17 @@ void DownloadItemImpl::InterruptWithPartialState(
}
RecordDownloadCount(CANCELLED_COUNT);
- if (job_ && job_->UsesParallelRequests())
- RecordParallelDownloadCount(CANCELLED_COUNT);
+ if (job_ && job_->IsParallelizable()) {
+ RecordParallelizableDownloadCount(CANCELLED_COUNT,
+ job_->UsesParallelRequests());
+ }
DCHECK_EQ(last_reason_, reason);
TransitionTo(CANCELLED_INTERNAL);
return;
}
RecordDownloadInterrupted(reason, received_bytes_, total_bytes_,
+ job_ && job_->IsParallelizable(),
job_ && job_->UsesParallelRequests());
if (!GetWebContents())
RecordDownloadCount(INTERRUPTED_WITHOUT_WEBCONTENTS);

Powered by Google App Engine
This is Rietveld 408576698