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

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

Issue 2901383007: Don't create parallel request until download file is initialized (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_job.h
diff --git a/content/browser/download/download_job.h b/content/browser/download/download_job.h
index cef1c47f4d02ac78454c7e4cac092e74adeabc62..b7df0085a003fb523dea327ed3dc433a67830fb2 100644
--- a/content/browser/download/download_job.h
+++ b/content/browser/download/download_job.h
@@ -6,8 +6,10 @@
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_JOB_H_
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "content/browser/byte_stream.h"
+#include "content/browser/download/download_file.h"
#include "content/common/content_export.h"
#include "content/public/browser/download_danger_type.h"
#include "content/public/browser/download_interrupt_reasons.h"
@@ -26,7 +28,11 @@ class CONTENT_EXPORT DownloadJob {
virtual ~DownloadJob();
// Download operations.
- virtual void Start() = 0;
+ // TODO(qinmin): Remove the |callback| and |download_file_| parameter if
+ // DownloadJob owns download file.
+ void Start(DownloadFile* download_file_,
+ const DownloadFile::InitializeCallback& callback,
+ const DownloadItem::ReceivedSlices& received_slices);
virtual void Cancel(bool user_cancel) = 0;
virtual void Pause();
virtual void Resume(bool resume_request);
@@ -50,7 +56,10 @@ class CONTENT_EXPORT DownloadJob {
virtual void CancelRequestWithOffset(int64_t offset);
protected:
- void StartDownload() const;
+ // Callback from file thread when we initialize the DownloadFile.
+ virtual void OnDownloadFileInitialized(
+ const DownloadFile::InitializeCallback& callback,
+ DownloadInterruptReason result);
// Add a byte stream to the download sink. Return false if we start to
// destroy download file.
@@ -64,6 +73,8 @@ class CONTENT_EXPORT DownloadJob {
// If the download progress is paused by the user.
bool is_paused_;
+ base::WeakPtrFactory<DownloadJob> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadJob);
};
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698