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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_task_runner.cc

Issue 2980503002: [Extensions][TaskScheduler] Update ActivityLog for scheduling migration (Closed)
Patch Set: Use SingleThreadTaskRunner to be safe Created 3 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/activity_log/activity_log_task_runner.h"
6
7 #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.
8 #include "base/task_scheduler/lazy_task_runner.h"
9 #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.
10
11 namespace extensions {
12
13 namespace {
14
15 base::SingleThreadTaskRunner* g_task_runner_for_testing = nullptr;
16
17 base::LazySingleThreadTaskRunner g_task_runner =
18 LAZY_SINGLE_THREAD_TASK_RUNNER_INITIALIZER(
19 base::TaskTraits({base::MayBlock(), base::TaskPriority::BACKGROUND}),
20 base::SingleThreadTaskRunnerThreadMode::SHARED);
21
22 } // namespace
23
24 const scoped_refptr<base::SingleThreadTaskRunner> GetActivityLogTaskRunner() {
25 if (g_task_runner_for_testing)
26 return g_task_runner_for_testing;
27
28 return g_task_runner.Get();
29 }
30
31 void SetActivityLogTaskRunnerForTesting(
32 base::SingleThreadTaskRunner* task_runner) {
33 g_task_runner_for_testing = task_runner;
34 }
35
36 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698