Commit 14adce60 authored by WangHui's avatar WangHui Committed by Chromium LUCI CQ

aw:Delete stream for download in IO thread for android_webview.

When the download request is intercepted by the webview, we will delete
the ResourceDownloader and stream as soon as possible. But the stream is
deleted in the Download task runner and the ResourceDownloader is
deleted in the IO task runner, there will be a race that the error caused by
destroying the stream send to webview before the ResourceDownloader is destroyed.

Bug:1048335

Change-Id: Iae2a62688debee6adaa7161209dd33d6ac3b32f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2592280
Commit-Queue: HuiWang <wanghui210@huawei.com>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837947}
parent 916a023b
...@@ -476,7 +476,7 @@ void InProgressDownloadManager::StartDownload( ...@@ -476,7 +476,7 @@ void InProgressDownloadManager::StartDownload(
if (delegate_ && delegate_->InterceptDownload(*info)) { if (delegate_ && delegate_->InterceptDownload(*info)) {
if (cancel_request_callback) if (cancel_request_callback)
std::move(cancel_request_callback).Run(false); std::move(cancel_request_callback).Run(false);
GetDownloadTaskRunner()->DeleteSoon(FROM_HERE, stream.release()); GetIOTaskRunner()->DeleteSoon(FROM_HERE, std::move(stream));
return; return;
} }
} }
...@@ -534,7 +534,7 @@ void InProgressDownloadManager::StartDownloadWithItem( ...@@ -534,7 +534,7 @@ void InProgressDownloadManager::StartDownloadWithItem(
std::move(cancel_request_callback).Run(false); std::move(cancel_request_callback).Run(false);
// The ByteStreamReader lives and dies on the download sequence. // The ByteStreamReader lives and dies on the download sequence.
if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE) if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE)
GetDownloadTaskRunner()->DeleteSoon(FROM_HERE, stream.release()); GetIOTaskRunner()->DeleteSoon(FROM_HERE, std::move(stream));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment