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

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

Issue 2752603002: Propagate server response error and interrupt the download. (Closed)
Patch Set: 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
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..b3bed6a4b35d8eb62f1b21056ac861f3a6c6ea25 100644
--- a/content/browser/download/download_worker.h
+++ b/content/browser/download/download_worker.h
@@ -23,9 +23,21 @@ namespace content {
// download.
class DownloadWorker : public UrlDownloader::Delegate {
public:
- DownloadWorker();
+ class Delegate {
+ public:
+ // Called when there is an error caused by the server response.
+ virtual void OnServerResponseError(DownloadWorker* worker,
+ DownloadInterruptReason reason) = 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 +58,14 @@ class DownloadWorker : public UrlDownloader::Delegate {
std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>
downloader);
+ DownloadWorker::Delegate* delegate_;
David Trainor- moved to gerrit 2017/03/14 18:01:43 DownloadWorker::Delegate* const delegate_?
xingliu 2017/03/14 21:33:21 Done.
+
+ // 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_;

Powered by Google App Engine
This is Rietveld 408576698