summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/download/download_util.cc')
-rw-r--r--chrome/browser/download/download_util.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 90fe73d..f68d676 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -809,13 +809,24 @@ void DownloadUrl(
*context);
}
-void CancelDownloadRequest(ResourceDispatcherHost* rdh,
- int render_process_id,
- int request_id) {
+static void CancelDownloadRequestOnIOThread(
+ ResourceDispatcherHost* rdh, DownloadProcessHandle process_handle) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// |rdh| may be NULL in unit tests.
- if (rdh)
- rdh->CancelRequest(render_process_id, request_id, false);
+ if (!rdh)
+ return;
+
+ rdh->CancelRequest(process_handle.child_id(),
+ process_handle.request_id(),
+ false);
+}
+
+void CancelDownloadRequest(ResourceDispatcherHost* rdh,
+ DownloadProcessHandle process_handle) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ NewRunnableFunction(&download_util::CancelDownloadRequestOnIOThread,
+ rdh, process_handle));
}
void NotifyDownloadInitiated(int render_process_id, int render_view_id) {