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

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

Issue 2872943003: Reduce unnecessary download interruptions due to parallel requests (Closed)
Patch Set: more restrictions on DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE Created 3 years, 7 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/byte_stream.h" 10 #include "content/browser/byte_stream.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // parallel requests as it can be disabled through flags. 44 // parallel requests as it can be disabled through flags.
45 virtual bool IsParallelizable() const; 45 virtual bool IsParallelizable() const;
46 46
47 // Cancel a particular request starts from |offset|, while the download is not 47 // Cancel a particular request starts from |offset|, while the download is not
48 // canceled. Used in parallel download. 48 // canceled. Used in parallel download.
49 // TODO(xingliu): Remove this function if download job owns download file. 49 // TODO(xingliu): Remove this function if download job owns download file.
50 virtual void CancelRequestWithOffset(int64_t offset); 50 virtual void CancelRequestWithOffset(int64_t offset);
51 51
52 protected: 52 protected:
53 void StartDownload() const; 53 void StartDownload() const;
54 void Interrupt(DownloadInterruptReason reason);
55 54
56 // Add a byte stream to the download sink. Return false if we start to 55 // Add a byte stream to the download sink. Return false if we start to
57 // destroy download file. 56 // destroy download file.
58 bool AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, 57 bool AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
59 int64_t offset, 58 int64_t offset,
60 int64_t length); 59 int64_t length);
61 60
62 // Sets the potential length of the file.
63 void SetPotentialFileLength(int64_t length);
64
65 DownloadItemImpl* download_item_; 61 DownloadItemImpl* download_item_;
66 62
67 private: 63 private:
68 // If the download progress is paused by the user. 64 // If the download progress is paused by the user.
69 bool is_paused_; 65 bool is_paused_;
70 66
71 DISALLOW_COPY_AND_ASSIGN(DownloadJob); 67 DISALLOW_COPY_AND_ASSIGN(DownloadJob);
72 }; 68 };
73 69
74 } // namespace content 70 } // namespace content
75 71
76 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_ 72 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_file_impl.cc ('k') | content/browser/download/download_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698