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

Side by Side Diff: base/task_scheduler/scheduler_service_thread.h

Issue 2405243003: TaskScheduler: Replace the SchedulerServiceThread with a base::Thread. (Closed)
Patch Set: CR robliao #9 Created 4 years, 2 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 2016 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 #ifndef BASE_TASK_SCHEDULER_SERVICE_THREAD_H_
6 #define BASE_TASK_SCHEDULER_SERVICE_THREAD_H_
7
8 #include <memory>
9
10 #include "base/base_export.h"
11 #include "base/macros.h"
12
13 namespace base {
14 namespace internal {
15
16 class DelayedTaskManager;
17 class SchedulerWorker;
18 class TaskTracker;
19
20 // A thread dedicated to performing Task Scheduler related work.
21 class BASE_EXPORT SchedulerServiceThread {
22 public:
23 ~SchedulerServiceThread();
24
25 // Creates a SchedulerServiceThread. |task_tracker| and |delayed_task_manager|
26 // are passed through to the underlying SchedulerWorker. Returns a nullptr on
27 // failure.
28 static std::unique_ptr<SchedulerServiceThread> Create(
29 TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager);
30
31 // Wakes the SchedulerServiceThread if it wasn't already awake. This also has
32 // the impact of updating the amount of time the thread sleeps for delayed
33 // tasks.
34 void WakeUp();
35
36 // Joins this SchedulerServiceThread. This can only be called once.
37 void JoinForTesting();
38
39 private:
40 SchedulerServiceThread(std::unique_ptr<SchedulerWorker> worker);
41
42 const std::unique_ptr<SchedulerWorker> worker_;
43
44 DISALLOW_COPY_AND_ASSIGN(SchedulerServiceThread);
45 };
46
47 } // namespace internal
48 } // namespace base
49
50 #endif // BASE_TASK_SCHEDULER_SERVICE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698