Chromium Code Reviews| 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..7a0dfe8cdd702a470ab5b58eaf3928edc2236833 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/activity_log/activity_log_task_runner.cc |
| @@ -0,0 +1,30 @@ |
| +// 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" |
| +#include "base/task_scheduler/lazy_task_runner.h" |
| + |
| +namespace extensions { |
| + |
| +namespace { |
| +base::TaskRunner* g_task_runner_for_testing = nullptr; |
| +} |
| + |
| +const scoped_refptr<base::TaskRunner> GetActivityLogTaskRunner() { |
| + if (g_task_runner_for_testing) |
| + return g_task_runner_for_testing; |
| + |
| + static base::LazySequencedTaskRunner task_runner = |
|
gab
2017/07/20 16:26:43
The documentation states to put this in the anonym
Devlin
2017/07/27 13:41:19
Sure thing; done.
|
| + LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER( |
| + base::TaskTraits({base::MayBlock(), base::TaskPriority::BACKGROUND})); |
| + return task_runner.Get(); |
| +} |
| + |
| +void SetActivityLogTaskRunnerForTesting(base::TaskRunner* task_runner) { |
| + g_task_runner_for_testing = task_runner; |
| +} |
| + |
| +} // namespace extensions |