| 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_IDLE_HELPER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| 6 #define COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "components/scheduler/base/cancelable_closure_holder.h" | 10 #include "platform/scheduler/base/cancelable_closure_holder.h" |
| 11 #include "components/scheduler/base/task_queue_selector.h" | 11 #include "platform/scheduler/base/task_queue_selector.h" |
| 12 #include "components/scheduler/child/scheduler_helper.h" | 12 #include "platform/scheduler/child/scheduler_helper.h" |
| 13 #include "components/scheduler/child/single_thread_idle_task_runner.h" | 13 #include "public/platform/scheduler/child/single_thread_idle_task_runner.h" |
| 14 #include "components/scheduler/scheduler_export.h" | 14 #include "public/platform/WebCommon.h" |
| 15 | 15 |
| 16 namespace blink { |
| 16 namespace scheduler { | 17 namespace scheduler { |
| 17 | 18 |
| 18 class SchedulerHelper; | 19 class SchedulerHelper; |
| 19 | 20 |
| 20 // Common scheduler functionality for Idle tasks. | 21 // Common scheduler functionality for Idle tasks. |
| 21 class SCHEDULER_EXPORT IdleHelper | 22 class BLINK_PLATFORM_EXPORT IdleHelper |
| 22 : public base::MessageLoop::TaskObserver, | 23 : public base::MessageLoop::TaskObserver, |
| 23 public SingleThreadIdleTaskRunner::Delegate { | 24 public SingleThreadIdleTaskRunner::Delegate { |
| 24 public: | 25 public: |
| 25 // Used to by scheduler implementations to customize idle behaviour. | 26 // Used to by scheduler implementations to customize idle behaviour. |
| 26 class SCHEDULER_EXPORT Delegate { | 27 class BLINK_PLATFORM_EXPORT Delegate { |
| 27 public: | 28 public: |
| 28 Delegate(); | 29 Delegate(); |
| 29 virtual ~Delegate(); | 30 virtual ~Delegate(); |
| 30 | 31 |
| 31 // If it's ok to enter a long idle period, return true. Otherwise return | 32 // If it's ok to enter a long idle period, return true. Otherwise return |
| 32 // false and set next_long_idle_period_delay_out so we know when to try | 33 // false and set next_long_idle_period_delay_out so we know when to try |
| 33 // again. | 34 // again. |
| 34 virtual bool CanEnterLongIdlePeriod( | 35 virtual bool CanEnterLongIdlePeriod( |
| 35 base::TimeTicks now, | 36 base::TimeTicks now, |
| 36 base::TimeDelta* next_long_idle_period_delay_out) = 0; | 37 base::TimeDelta* next_long_idle_period_delay_out) = 0; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 211 |
| 211 const char* disabled_by_default_tracing_category_; | 212 const char* disabled_by_default_tracing_category_; |
| 212 | 213 |
| 213 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; | 214 base::WeakPtr<IdleHelper> weak_idle_helper_ptr_; |
| 214 base::WeakPtrFactory<IdleHelper> weak_factory_; | 215 base::WeakPtrFactory<IdleHelper> weak_factory_; |
| 215 | 216 |
| 216 DISALLOW_COPY_AND_ASSIGN(IdleHelper); | 217 DISALLOW_COPY_AND_ASSIGN(IdleHelper); |
| 217 }; | 218 }; |
| 218 | 219 |
| 219 } // namespace scheduler | 220 } // namespace scheduler |
| 221 } // namespace blink |
| 220 | 222 |
| 221 #endif // COMPONENTS_SCHEDULER_CHILD_IDLE_HELPER_H_ | 223 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_IDLE_HELPER_H_ |
| OLD | NEW |