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

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

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Add a missing mock expectation. Created 3 years, 6 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_task_runner.cc
diff --git a/content/browser/download/download_task_runner.cc b/content/browser/download/download_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..abaa7db808d7f069e3b1dc990b984063d0d365d5
--- /dev/null
+++ b/content/browser/download/download_task_runner.cc
@@ -0,0 +1,29 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/download/download_task_runner.h"
+
+#include "base/lazy_instance.h"
+#include "base/task_scheduler/post_task.h"
+
+namespace content {
+
+namespace {
+
+struct DownloadTaskRunner {
+ const scoped_refptr<base::SingleThreadTaskRunner> task_runner =
+ base::CreateSingleThreadTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND});
gab 2017/06/21 19:42:24 Isn't this USER_VISIBLE?
Sigurður Ásgeirsson 2017/06/22 14:50:09 I'm not sure either way, the activity on this sequ
gab 2017/06/22 17:10:08 Right not interactive but user visible, i.e. not U
Sigurður Ásgeirsson 2017/06/22 18:47:28 Done.
+};
+
+base::LazyInstance<DownloadTaskRunner>::Leaky g_download_task_runner =
+ LAZY_INSTANCE_INITIALIZER;
gab 2017/06/21 19:42:24 Francois added a new API to do all of this in one
Sigurður Ásgeirsson 2017/06/22 14:50:09 Done.
+
+} // namespace
+
+scoped_refptr<base::SingleThreadTaskRunner> GetDownloadTaskRunner() {
+ return g_download_task_runner.Get().task_runner;
+}
+
+} // content

Powered by Google App Engine
This is Rietveld 408576698