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

Unified Diff: content/browser/download/download_worker.h

Issue 2742093002: Glue parallel download job and download file together. (Closed)
Patch Set: Rebase, and adjust unittests with recent landed CLs. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_request_core.cc ('k') | content/browser/download/download_worker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_worker.h
diff --git a/content/browser/download/download_worker.h b/content/browser/download/download_worker.h
index 75a7f96c04d2a70b3160ad678d59be91b83445dc..111927471865d74b2d032f7e1217042bafedf6aa 100644
--- a/content/browser/download/download_worker.h
+++ b/content/browser/download/download_worker.h
@@ -23,9 +23,24 @@ namespace content {
// download.
class DownloadWorker : public UrlDownloader::Delegate {
public:
- DownloadWorker();
+ class Delegate {
+ public:
+ // Called when the the byte stream is established after server response is
+ // handled. The stream contains data starts from |offset| of the
+ // destination file.
+ virtual void OnByteStreamReady(
+ DownloadWorker* worker,
+ std::unique_ptr<ByteStreamReader> stream_reader) = 0;
+ };
+
+ DownloadWorker(DownloadWorker::Delegate* delegate,
+ int64_t offset,
+ int64_t length);
virtual ~DownloadWorker();
+ int64_t offset() const { return offset_; }
+ int64_t length() const { return length_; }
+
// Send network request to ask for a download.
void SendRequest(std::unique_ptr<DownloadUrlParameters> params);
@@ -46,6 +61,14 @@ class DownloadWorker : public UrlDownloader::Delegate {
std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>
downloader);
+ DownloadWorker::Delegate* delegate_;
+
+ // The starting position of the content for this worker to download.
+ int64_t offset_;
+
+ // The length of the request. May be 0 to fetch to the end of the file.
+ int64_t length_;
+
// Used to control the network request. Live on UI thread.
std::unique_ptr<DownloadRequestHandleInterface> request_handle_;
« no previous file with comments | « content/browser/download/download_request_core.cc ('k') | content/browser/download/download_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698