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

Unified Diff: extensions/browser/api/storage/backend_task_runner.cc

Issue 2965153002: Migrate Extensions code to Task Scheduler API (Closed)
Patch Set: Self review 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: extensions/browser/api/storage/backend_task_runner.cc
diff --git a/extensions/browser/api/storage/backend_task_runner.cc b/extensions/browser/api/storage/backend_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0d5e614c311c69ee44c08b1d00bcd3eb50491257
--- /dev/null
+++ b/extensions/browser/api/storage/backend_task_runner.cc
@@ -0,0 +1,22 @@
+// 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 "extensions/browser/api/storage/backend_task_runner.h"
+
+#include "base/task_scheduler/lazy_task_runner.h"
+
+namespace extensions {
+
+base::LazySequencedTaskRunner g_sequenced_task_task_runner =
+ LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER({base::MayBlock()});
+
+scoped_refptr<base::SequencedTaskRunner> GetBackendTaskRunner() {
+ return g_sequenced_task_task_runner.Get();
+}
+
+bool IsOnBackendSequence() {
+ return GetBackendTaskRunner()->RunsTasksInCurrentSequence();
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698