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

Unified Diff: chrome/browser/net/file_downloader.cc

Issue 2835303002: [reland] Use TaskScheduler instead of blocking pool in file_downloader.cc. (Closed)
Patch Set: self-review Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/net/file_downloader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/file_downloader.cc
diff --git a/chrome/browser/net/file_downloader.cc b/chrome/browser/net/file_downloader.cc
index ffbb4f96680d0740295fe45f3f16c8f93ff18e63..f8f3f792d8fa597dfe1e517d8197dca738985274 100644
--- a/chrome/browser/net/file_downloader.cc
+++ b/chrome/browser/net/file_downloader.cc
@@ -8,7 +8,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/threading/sequenced_worker_pool.h"
+#include "base/task_scheduler/post_task.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
@@ -43,9 +43,12 @@ FileDownloader::FileDownloader(
fetcher_->Start();
} else {
base::PostTaskAndReplyWithResult(
- BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)
+ base::CreateTaskRunnerWithTraits(
+ base::TaskTraits()
+ .MayBlock()
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN))
.get(),
FROM_HERE, base::Bind(&base::PathExists, local_path_),
base::Bind(&FileDownloader::OnFileExistsCheckDone,
@@ -82,9 +85,12 @@ void FileDownloader::OnURLFetchComplete(const net::URLFetcher* source) {
}
base::PostTaskAndReplyWithResult(
- BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)
+ base::CreateTaskRunnerWithTraits(
+ base::TaskTraits()
+ .MayBlock()
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN))
.get(),
FROM_HERE, base::Bind(&base::Move, response_path, local_path_),
base::Bind(&FileDownloader::OnFileMoveDone,
« no previous file with comments | « no previous file | chrome/browser/net/file_downloader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698