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..825ad0fe7203c39d434e5ce383ec8b0782f6992c |
--- /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/sequenced_task_runner.h" |
gab
2017/07/27 18:34:53
single_thread_task_runner.h
Devlin
2017/07/28 14:41:12
Done.
|
+#include "base/task_scheduler/lazy_task_runner.h" |
+#include "base/task_scheduler/single_thread_task_runner_thread_mode.h" |
gab
2017/07/27 18:34:53
You can keep this if you wish but it's really impl
Devlin
2017/07/28 14:41:12
I think for the spirit of IWYU, we should keep it.
|
+ |
+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 |