| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGAT
E_IMPL_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGAT
E_IMPL_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGAT
E_IMPL_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_TQM_DELEGAT
E_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
| 13 #include "platform/scheduler/child/scheduler_tqm_delegate.h" | 14 #include "platform/scheduler/child/scheduler_tqm_delegate.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 namespace scheduler { | 17 namespace scheduler { |
| 17 | 18 |
| 18 class BLINK_PLATFORM_EXPORT SchedulerTqmDelegateImpl | 19 class BLINK_PLATFORM_EXPORT SchedulerTqmDelegateImpl |
| 19 : public SchedulerTqmDelegate { | 20 : public SchedulerTqmDelegate { |
| 20 public: | 21 public: |
| 21 // |message_loop| is not owned and must outlive the lifetime of this object. | 22 // |message_loop| is not owned and must outlive the lifetime of this object. |
| 22 static scoped_refptr<SchedulerTqmDelegateImpl> Create( | 23 static scoped_refptr<SchedulerTqmDelegateImpl> Create( |
| 23 base::MessageLoop* message_loop, | 24 base::MessageLoop* message_loop, |
| 24 std::unique_ptr<base::TickClock> time_source); | 25 std::unique_ptr<base::TickClock> time_source); |
| 25 | 26 |
| 26 // SchedulerTqmDelegate implementation | 27 // SchedulerTqmDelegate implementation |
| 27 void SetDefaultTaskRunner( | 28 void SetDefaultTaskRunner( |
| 28 scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; | 29 scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; |
| 29 void RestoreDefaultTaskRunner() override; | 30 void RestoreDefaultTaskRunner() override; |
| 30 bool PostDelayedTask(const tracked_objects::Location& from_here, | 31 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 31 const base::Closure& task, | 32 base::Closure task, |
| 32 base::TimeDelta delay) override; | 33 base::TimeDelta delay) override; |
| 33 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 34 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
| 34 const base::Closure& task, | 35 base::Closure task, |
| 35 base::TimeDelta delay) override; | 36 base::TimeDelta delay) override; |
| 36 bool RunsTasksOnCurrentThread() const override; | 37 bool RunsTasksOnCurrentThread() const override; |
| 37 bool IsNested() const override; | 38 bool IsNested() const override; |
| 38 void AddNestingObserver( | 39 void AddNestingObserver( |
| 39 base::MessageLoop::NestingObserver* observer) override; | 40 base::MessageLoop::NestingObserver* observer) override; |
| 40 void RemoveNestingObserver( | 41 void RemoveNestingObserver( |
| 41 base::MessageLoop::NestingObserver* observer) override; | 42 base::MessageLoop::NestingObserver* observer) override; |
| 42 base::TimeTicks NowTicks() override; | 43 base::TimeTicks NowTicks() override; |
| 43 | 44 |
| 44 protected: | 45 protected: |
| 45 ~SchedulerTqmDelegateImpl() override; | 46 ~SchedulerTqmDelegateImpl() override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 SchedulerTqmDelegateImpl(base::MessageLoop* message_loop, | 49 SchedulerTqmDelegateImpl(base::MessageLoop* message_loop, |
| 49 std::unique_ptr<base::TickClock> time_source); | 50 std::unique_ptr<base::TickClock> time_source); |
| 50 | 51 |
| 51 // Not owned. | 52 // Not owned. |
| 52 base::MessageLoop* message_loop_; | 53 base::MessageLoop* message_loop_; |
| 53 scoped_refptr<SingleThreadTaskRunner> message_loop_task_runner_; | 54 scoped_refptr<SingleThreadTaskRunner> message_loop_task_runner_; |
| 54 std::unique_ptr<base::TickClock> time_source_; | 55 std::unique_ptr<base::TickClock> time_source_; |
| 55 | 56 |
| 56 DISALLOW_COPY_AND_ASSIGN(SchedulerTqmDelegateImpl); | 57 DISALLOW_COPY_AND_ASSIGN(SchedulerTqmDelegateImpl); |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 } // namespace scheduler | 60 } // namespace scheduler |
| 60 } // namespace blink | 61 } // namespace blink |
| 61 | 62 |
| 62 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_TQM_DELE
GATE_IMPL_H_ | 63 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_TQM_DELE
GATE_IMPL_H_ |
| OLD | NEW |