Index: content/browser/download/download_item.cc |
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc |
index b993a6db2208649688763c126f80a510ae92d826..570c764e07bad212418d039852f40958f2cc1e1a 100644 |
--- a/content/browser/download/download_item.cc |
+++ b/content/browser/download/download_item.cc |
@@ -110,6 +110,31 @@ DownloadItem::DangerType GetDangerType(bool dangerous_file, |
DownloadItem::DANGEROUS_FILE : DownloadItem::NOT_DANGEROUS; |
} |
+// Classes to null out request handle calls (for SavePage DownloadItems, which |
+// may have, e.g., Cancel() called on them without it doing anything) |
+// and to DCHECK on them (for history DownloadItems, which should never have |
+// any operation that implies an off-thread component, since they don't |
+// have any). |
+class NullDownloadRequestHandle : public DownloadRequestHandleInterface { |
+ public: |
+ NullDownloadRequestHandle() {} |
+ |
+ // DownloadRequestHandleInterface calls |
+ virtual TabContents* GetTabContents() const OVERRIDE { |
+ return NULL; |
+ } |
+ virtual DownloadManager* GetDownloadManager() const OVERRIDE { |
+ return NULL; |
+ } |
+ virtual void PauseRequest() const OVERRIDE {} |
+ virtual void ResumeRequest() const OVERRIDE {} |
+ virtual void CancelRequest() const OVERRIDE {} |
+ virtual std::string DebugString() const OVERRIDE { |
+ return "Null DownloadRequestHandle"; |
+ } |
+}; |
+ |
+ |
} // namespace |
// Our download table ID starts at 1, so we use 0 to represent a download that |
@@ -199,7 +224,8 @@ DownloadItem::DownloadItem(DownloadManager* download_manager, |
const GURL& url, |
bool is_otr, |
DownloadId download_id) |
- : download_id_(download_id), |
+ : request_handle_(new NullDownloadRequestHandle()), |
+ download_id_(download_id), |
full_path_(path), |
url_chain_(1, url), |
referrer_url_(GURL()), |