| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Test helpers. | 105 // Test helpers. |
| 106 SchedulerHelper* GetSchedulerHelperForTesting(); | 106 SchedulerHelper* GetSchedulerHelperForTesting(); |
| 107 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); | 107 TaskCostEstimator* GetLoadingTaskCostEstimatorForTesting(); |
| 108 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); | 108 TaskCostEstimator* GetTimerTaskCostEstimatorForTesting(); |
| 109 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); | 109 IdleTimeEstimator* GetIdleTimeEstimatorForTesting(); |
| 110 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; | 110 base::TimeTicks CurrentIdleTaskDeadlineForTesting() const; |
| 111 void RunIdleTasksForTesting(const base::Closure& callback); | 111 void RunIdleTasksForTesting(const base::Closure& callback); |
| 112 void EndIdlePeriodForTesting(const base::Closure& callback, | 112 void EndIdlePeriodForTesting(const base::Closure& callback, |
| 113 base::TimeTicks time_remaining); | 113 base::TimeTicks time_remaining); |
| 114 bool PolicyNeedsUpdateForTesting(); |
| 114 | 115 |
| 115 base::TickClock* tick_clock() const; | 116 base::TickClock* tick_clock() const; |
| 116 | 117 |
| 117 RealTimeDomain* real_time_domain() const { | 118 RealTimeDomain* real_time_domain() const { |
| 118 return helper_.real_time_domain(); | 119 return helper_.real_time_domain(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 ThrottlingHelper* throttling_helper() { return throttling_helper_.get(); } | 122 ThrottlingHelper* throttling_helper() { return throttling_helper_.get(); } |
| 122 | 123 |
| 123 private: | 124 private: |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 256 |
| 256 // Helper for computing the use case. |expected_usecase_duration| will be | 257 // Helper for computing the use case. |expected_usecase_duration| will be |
| 257 // filled with the amount of time after which the use case should be updated | 258 // filled with the amount of time after which the use case should be updated |
| 258 // again. If the duration is zero, a new use case update should not be | 259 // again. If the duration is zero, a new use case update should not be |
| 259 // scheduled. Must be called with |any_thread_lock_| held. Can be called from | 260 // scheduled. Must be called with |any_thread_lock_| held. Can be called from |
| 260 // any thread. | 261 // any thread. |
| 261 UseCase ComputeCurrentUseCase( | 262 UseCase ComputeCurrentUseCase( |
| 262 base::TimeTicks now, | 263 base::TimeTicks now, |
| 263 base::TimeDelta* expected_use_case_duration) const; | 264 base::TimeDelta* expected_use_case_duration) const; |
| 264 | 265 |
| 265 // Works out if a gesture appears to be in progress based on the current | |
| 266 // input signals. Can be called from any thread. | |
| 267 bool InputSignalsSuggestGestureInProgress(base::TimeTicks now) const; | |
| 268 | |
| 269 // An input event of some sort happened, the policy may need updating. | 266 // An input event of some sort happened, the policy may need updating. |
| 270 void UpdateForInputEventOnCompositorThread(blink::WebInputEvent::Type type, | 267 void UpdateForInputEventOnCompositorThread(blink::WebInputEvent::Type type, |
| 271 InputEventState input_event_state); | 268 InputEventState input_event_state); |
| 272 | 269 |
| 273 // Returns true if there has been at least one idle period in the last | 270 // Returns true if there has been at least one idle period in the last |
| 274 // |kIdlePeriodStarvationThresholdMillis|. | 271 // |kIdlePeriodStarvationThresholdMillis|. |
| 275 bool HadAnIdlePeriodRecently(base::TimeTicks now) const; | 272 bool HadAnIdlePeriodRecently(base::TimeTicks now) const; |
| 276 | 273 |
| 277 // Helpers for safely suspending/resuming the timer queue after a | 274 // Helpers for safely suspending/resuming the timer queue after a |
| 278 // background/foreground signal. | 275 // background/foreground signal. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 414 |
| 418 PollableThreadSafeFlag policy_may_need_update_; | 415 PollableThreadSafeFlag policy_may_need_update_; |
| 419 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 416 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
| 420 | 417 |
| 421 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 418 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
| 422 }; | 419 }; |
| 423 | 420 |
| 424 } // namespace scheduler | 421 } // namespace scheduler |
| 425 | 422 |
| 426 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ | 423 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_IMPL_H_ |
| OLD | NEW |