Index: content/browser/download/parallel_download_job.cc |
diff --git a/content/browser/download/parallel_download_job.cc b/content/browser/download/parallel_download_job.cc |
index b9df978537da94ee946704a3c3d0cb3d82dfa233..1301a6d3f8e4797c9a1741fe756199400f32c215 100644 |
--- a/content/browser/download/parallel_download_job.cc |
+++ b/content/browser/download/parallel_download_job.cc |
@@ -6,6 +6,7 @@ |
#include "base/memory/ptr_util.h" |
#include "content/browser/download/download_create_info.h" |
+#include "content/browser/download/download_stats.h" |
#include "content/browser/download/parallel_download_utils.h" |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/storage_partition.h" |
@@ -102,6 +103,7 @@ void ParallelDownloadJob::OnByteStreamReady( |
std::unique_ptr<ByteStreamReader> stream_reader) { |
bool success = DownloadJob::AddByteStream(std::move(stream_reader), |
worker->offset(), worker->length()); |
+ RecordParallelDownloadAddStreamSuccess(success); |
// Destroy the request if the sink is gone. |
if (!success) { |
@@ -170,21 +172,31 @@ void ParallelDownloadJob::BuildParallelRequests() { |
void ParallelDownloadJob::ForkSubRequests( |
const DownloadItem::ReceivedSlices& slices_to_download) { |
bool initial_request_skipped = false; |
+ int requests_num = 0; |
+ int early_requests_num = 0; |
+ |
for (auto it = slices_to_download.begin(); it != slices_to_download.end(); |
++it) { |
// Create requests for holes before the |initial_request_offset_|. |
if (it->offset < initial_request_offset_) { |
CreateRequest(it->offset, it->received_bytes); |
+ early_requests_num++; |
+ requests_num++; |
continue; |
} |
// Assume the first slice to download after |initial_request_offset_| will |
// be handled by the initial request. |
- if (initial_request_skipped) |
+ if (initial_request_skipped) { |
CreateRequest(it->offset, it->received_bytes); |
- else |
+ requests_num++; |
+ } else |
initial_request_skipped = true; |
} |
+ |
+ RecordParallelDownloadRequestCount(requests_num + 1); |
+ if (early_requests_num > 0) |
+ RecordParallelDownloadEarlyRequests(early_requests_num); |
} |
void ParallelDownloadJob::CreateRequest(int64_t offset, int64_t length) { |