Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: content/browser/download/download_job.cc

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Revert ScopedCOMInitializer invocations. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_job.cc
diff --git a/content/browser/download/download_job.cc b/content/browser/download/download_job.cc
index 5bd23a4291bf7355f6158cbe798f70fd7d22006a..3771700ef6ade945187d5e85adbc9090083b9b5d 100644
--- a/content/browser/download/download_job.cc
+++ b/content/browser/download/download_job.cc
@@ -6,6 +6,7 @@
#include "base/bind_helpers.h"
#include "content/browser/download/download_item_impl.h"
+#include "content/browser/download/download_task_runner.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
@@ -48,8 +49,8 @@ WebContents* DownloadJob::GetWebContents() const {
void DownloadJob::Start(DownloadFile* download_file_,
const DownloadFile::InitializeCallback& callback,
const DownloadItem::ReceivedSlices& received_slices) {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ GetDownloadTaskRunner()->PostTask(
+ FROM_HERE,
base::Bind(&DownloadFile::Initialize,
// Safe because we control download file lifetime.
base::Unretained(download_file_),
@@ -75,10 +76,10 @@ bool DownloadJob::AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
return false;
// download_file_ is owned by download_item_ on the UI thread and is always
- // deleted on the FILE thread after download_file_ is nulled out.
+ // deleted on the download task runner after download_file_ is nulled out.
// So it's safe to use base::Unretained here.
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ GetDownloadTaskRunner()->PostTask(
+ FROM_HERE,
base::Bind(&DownloadFile::AddByteStream, base::Unretained(download_file),
base::Passed(&stream_reader), offset, length));
return true;

Powered by Google App Engine
This is Rietveld 408576698