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

Unified Diff: chrome/browser/extensions/activity_log/activity_log_task_runner.cc

Issue 2980503002: [Extensions][TaskScheduler] Update ActivityLog for scheduling migration (Closed)
Patch Set: . 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: chrome/browser/extensions/activity_log/activity_log_task_runner.cc
diff --git a/chrome/browser/extensions/activity_log/activity_log_task_runner.cc b/chrome/browser/extensions/activity_log/activity_log_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cd5d6e51f09791289bb2d8849d6f58a7946968eb
--- /dev/null
+++ b/chrome/browser/extensions/activity_log/activity_log_task_runner.cc
@@ -0,0 +1,36 @@
+// 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 "chrome/browser/extensions/activity_log/activity_log_task_runner.h"
+
+#include "base/single_thread_task_runner.h"
+#include "base/task_scheduler/lazy_task_runner.h"
+#include "base/task_scheduler/single_thread_task_runner_thread_mode.h"
+
+namespace extensions {
+
+namespace {
+
+base::SingleThreadTaskRunner* g_task_runner_for_testing = nullptr;
+
+base::LazySingleThreadTaskRunner g_task_runner =
+ LAZY_SINGLE_THREAD_TASK_RUNNER_INITIALIZER(
+ base::TaskTraits({base::MayBlock(), base::TaskPriority::BACKGROUND}),
+ base::SingleThreadTaskRunnerThreadMode::SHARED);
+
+} // namespace
+
+const scoped_refptr<base::SingleThreadTaskRunner> GetActivityLogTaskRunner() {
+ if (g_task_runner_for_testing)
+ return g_task_runner_for_testing;
+
+ return g_task_runner.Get();
+}
+
+void SetActivityLogTaskRunnerForTesting(
+ base::SingleThreadTaskRunner* task_runner) {
+ g_task_runner_for_testing = task_runner;
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698