Index: content/browser/download/download_item.cc |
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc |
index e3eff9943cf34b37c35f0b76a1f26125076bdb2f..46c8639c6dcd5de9d4ed75e69d781b2e54fa3d49 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 |
@@ -201,7 +226,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()), |