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

Side by Side Diff: content/browser/download/download_job.cc

Issue 2689373003: Introduce ParallelDownloadJob. (Closed)
Patch Set: nits. Created 3 years, 9 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/download_job.h" 5 #include "content/browser/download/download_job.h"
6 6
7 #include "content/browser/download/download_item_impl.h"
8
7 namespace content { 9 namespace content {
8 10
9 // Unknown download progress. 11 DownloadJob::DownloadJob(DownloadItemImpl* download_item)
10 const int kDownloadProgressUnknown = -1; 12 : download_item_(download_item), is_paused_(false) {}
11
12 // Unknown download speed.
13 const int kDownloadSpeedUnknown = -1;
14
15 DownloadJob::DownloadJob() : manager_(nullptr) {}
16 13
17 DownloadJob::~DownloadJob() = default; 14 DownloadJob::~DownloadJob() = default;
18 15
19 void DownloadJob::OnAttached(DownloadJob::Manager* manager) { 16 void DownloadJob::Pause() {
20 DCHECK(!manager_) << "DownloadJob::Manager has already been attached."; 17 is_paused_ = true;
21 manager_ = manager;
22 } 18 }
23 19
24 void DownloadJob::OnBeforeDetach() { 20 void DownloadJob::Resume(bool resume_request) {
25 manager_ = nullptr; 21 is_paused_ = false;
26 } 22 }
27 23
28 void DownloadJob::StartedSavingResponse() { 24 void DownloadJob::StartDownload() const {
29 if (manager_) 25 download_item_->StartDownload();
30 manager_->OnSavingStarted(this);
31 }
32
33 void DownloadJob::Interrupt(DownloadInterruptReason reason) {
34 if (manager_)
35 manager_->OnDownloadInterrupted(this, reason);
36 }
37
38 void DownloadJob::Complete() {
39 if (manager_)
40 manager_->OnDownloadComplete(this);
41 } 26 }
42 27
43 } // namespace content 28 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_job.h ('k') | content/browser/download/download_job_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698