OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TASK_RUNNER_DELEGATE_IMPL_H_ | 5 #ifndef COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGATE_IMPL_H_ |
6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TASK_RUNNER_DELEGATE_IMPL_H_ | 6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGATE_IMPL_H_ |
7 | 7 |
| 8 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
9 #include "components/scheduler/child/scheduler_task_runner_delegate.h" | 10 #include "base/time/tick_clock.h" |
| 11 #include "components/scheduler/child/scheduler_tqm_delegate.h" |
10 #include "components/scheduler/scheduler_export.h" | 12 #include "components/scheduler/scheduler_export.h" |
11 | 13 |
12 namespace scheduler { | 14 namespace scheduler { |
13 | 15 |
14 class SCHEDULER_EXPORT SchedulerTaskRunnerDelegateImpl | 16 class SCHEDULER_EXPORT SchedulerTqmDelegateImpl : public SchedulerTqmDelegate { |
15 : public SchedulerTaskRunnerDelegate { | |
16 public: | 17 public: |
17 // |message_loop| is not owned and must outlive the lifetime of this object. | 18 // |message_loop| is not owned and must outlive the lifetime of this object. |
18 static scoped_refptr<SchedulerTaskRunnerDelegateImpl> Create( | 19 static scoped_refptr<SchedulerTqmDelegateImpl> Create( |
19 base::MessageLoop* message_loop); | 20 base::MessageLoop* message_loop, |
| 21 scoped_ptr<base::TickClock> time_source); |
20 | 22 |
21 // SchedulerTaskRunnerDelegate implementation | 23 // SchedulerTqmDelegate implementation |
22 void SetDefaultTaskRunner( | 24 void SetDefaultTaskRunner( |
23 scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; | 25 scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; |
24 void RestoreDefaultTaskRunner() override; | 26 void RestoreDefaultTaskRunner() override; |
25 bool PostDelayedTask(const tracked_objects::Location& from_here, | 27 bool PostDelayedTask(const tracked_objects::Location& from_here, |
26 const base::Closure& task, | 28 const base::Closure& task, |
27 base::TimeDelta delay) override; | 29 base::TimeDelta delay) override; |
28 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 30 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
29 const base::Closure& task, | 31 const base::Closure& task, |
30 base::TimeDelta delay) override; | 32 base::TimeDelta delay) override; |
31 bool RunsTasksOnCurrentThread() const override; | 33 bool RunsTasksOnCurrentThread() const override; |
32 bool IsNested() const override; | 34 bool IsNested() const override; |
| 35 base::TimeTicks NowTicks() override; |
| 36 void OnNoMoreImmediateWork() override; |
33 | 37 |
34 protected: | 38 protected: |
35 ~SchedulerTaskRunnerDelegateImpl() override; | 39 ~SchedulerTqmDelegateImpl() override; |
36 | 40 |
37 private: | 41 private: |
38 explicit SchedulerTaskRunnerDelegateImpl(base::MessageLoop* message_loop); | 42 SchedulerTqmDelegateImpl(base::MessageLoop* message_loop, |
| 43 scoped_ptr<base::TickClock> time_source); |
39 | 44 |
40 // Not owned. | 45 // Not owned. |
41 base::MessageLoop* message_loop_; | 46 base::MessageLoop* message_loop_; |
42 scoped_refptr<SingleThreadTaskRunner> message_loop_task_runner_; | 47 scoped_refptr<SingleThreadTaskRunner> message_loop_task_runner_; |
| 48 scoped_ptr<base::TickClock> time_source_; |
43 | 49 |
44 DISALLOW_COPY_AND_ASSIGN(SchedulerTaskRunnerDelegateImpl); | 50 DISALLOW_COPY_AND_ASSIGN(SchedulerTqmDelegateImpl); |
45 }; | 51 }; |
46 | 52 |
47 } // namespace scheduler | 53 } // namespace scheduler |
48 | 54 |
49 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TASK_RUNNER_DELEGATE_IMPL_H_ | 55 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGATE_IMPL_H_ |
OLD | NEW |