Chromium Code Reviews| Index: content/browser/download/download_job.cc |
| diff --git a/content/browser/download/download_job.cc b/content/browser/download/download_job.cc |
| index 4da7eb429ae6eca4a6b880e8924dbe5f79e7a054..712cc2b5d02d2ffc9fcaf04f016c26e21f4e6b9a 100644 |
| --- a/content/browser/download/download_job.cc |
| +++ b/content/browser/download/download_job.cc |
| @@ -4,7 +4,10 @@ |
| #include "content/browser/download/download_job.h" |
| +#include "base/bind_helpers.h" |
| +#include "content/browser/download/download_file.h" |
| #include "content/browser/download/download_item_impl.h" |
| +#include "content/public/browser/browser_thread.h" |
| namespace content { |
| @@ -25,4 +28,20 @@ void DownloadJob::StartDownload() const { |
| download_item_->StartDownload(); |
| } |
| +void DownloadJob::AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, |
| + int64_t offset, |
| + int64_t length) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + DownloadFile* download_file = download_item_->download_file_.get(); |
| + if (!download_file) |
| + return; |
|
David Trainor- moved to gerrit
2017/03/14 17:59:10
When do we expect this to happen?
xingliu
2017/03/14 18:26:31
Done, added a VLOG.
download_file is invalidated
David Trainor- moved to gerrit
2017/03/17 07:15:27
sg. add a TODO to investigate/file a bug?
xingliu
2017/03/17 19:08:25
Done.
|
| + |
| + // The life cycle of download file is controlled by download item, so it's |
| + // safe to use base::Unretained here. |
| + BrowserThread::PostTask( |
| + BrowserThread::FILE, FROM_HERE, |
| + base::Bind(&DownloadFile::AddByteStream, base::Unretained(download_file), |
| + base::Passed(&stream_reader), offset, length)); |
| +} |
| + |
| } // namespace content |