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

Side by Side Diff: content/browser/download/parallel_download_job.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/parallel_download_job.h" 5 #include "content/browser/download/parallel_download_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/browser/download/download_create_info.h" 12 #include "content/browser/download/download_create_info.h"
13 #include "content/browser/download/download_stats.h" 13 #include "content/browser/download/download_stats.h"
14 #include "content/browser/download/parallel_download_utils.h" 14 #include "content/browser/download/parallel_download_utils.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/storage_partition.h" 16 #include "content/public/browser/storage_partition.h"
17 17
18 namespace content { 18 namespace content {
19 namespace { 19 namespace {
20 20
21 const int kVerboseLevel = 1; 21 const int kVerboseLevel = 1;
22 22
23 } // namespace 23 } // namespace
24 24
25 ParallelDownloadJob::ParallelDownloadJob( 25 ParallelDownloadJob::ParallelDownloadJob(
26 DownloadItemImpl* download_item, 26 DownloadItemImpl* download_item,
27 std::unique_ptr<DownloadRequestHandleInterface> request_handle, 27 std::unique_ptr<DownloadRequestHandleInterface> request_handle,
28 const DownloadCreateInfo& create_info) 28 const DownloadCreateInfo& create_info)
29 : DownloadJobImpl(download_item, std::move(request_handle)), 29 : DownloadJobImpl(download_item, std::move(request_handle), true),
30 initial_request_offset_(create_info.offset), 30 initial_request_offset_(create_info.offset),
31 content_length_(create_info.total_bytes), 31 content_length_(create_info.total_bytes),
32 requests_sent_(false), 32 requests_sent_(false),
33 is_canceled_(false) {} 33 is_canceled_(false) {}
34 34
35 ParallelDownloadJob::~ParallelDownloadJob() = default; 35 ParallelDownloadJob::~ParallelDownloadJob() = default;
36 36
37 void ParallelDownloadJob::Start() { 37 void ParallelDownloadJob::Start() {
38 DownloadJobImpl::Start(); 38 DownloadJobImpl::Start();
39 39
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // download request. 236 // download request.
237 download_params->set_referrer(Referrer(download_item_->GetReferrerUrl(), 237 download_params->set_referrer(Referrer(download_item_->GetReferrerUrl(),
238 blink::kWebReferrerPolicyAlways)); 238 blink::kWebReferrerPolicyAlways));
239 // Send the request. 239 // Send the request.
240 worker->SendRequest(std::move(download_params)); 240 worker->SendRequest(std::move(download_params));
241 DCHECK(workers_.find(offset) == workers_.end()); 241 DCHECK(workers_.find(offset) == workers_.end());
242 workers_[offset] = std::move(worker); 242 workers_[offset] = std::move(worker);
243 } 243 }
244 244
245 } // namespace content 245 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698