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_RENDERER_IDLE_TIME_ESTIMATOR_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_ |
6 #define COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_ |
7 | 7 |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
10 #include "cc/base/rolling_time_delta_history.h" | 10 #include "cc/base/rolling_time_delta_history.h" |
11 #include "components/scheduler/base/task_queue.h" | 11 #include "components/scheduler/base/task_queue.h" |
12 #include "components/scheduler/scheduler_export.h" | 12 #include "components/scheduler/scheduler_export.h" |
13 | 13 |
14 namespace scheduler { | 14 namespace scheduler { |
15 | 15 |
16 // Estimates how much idle time there is available. | 16 // Estimates how much idle time there is available. Ignores nested tasks. |
17 class SCHEDULER_EXPORT IdleTimeEstimator | 17 class SCHEDULER_EXPORT IdleTimeEstimator |
18 : public base::MessageLoop::TaskObserver { | 18 : public base::MessageLoop::TaskObserver { |
19 public: | 19 public: |
20 IdleTimeEstimator(const scoped_refptr<TaskQueue>& compositor_task_runner, | 20 IdleTimeEstimator(const scoped_refptr<TaskQueue>& compositor_task_runner, |
21 int sample_count, | 21 int sample_count, |
22 double estimation_percentile); | 22 double estimation_percentile); |
23 | 23 |
24 ~IdleTimeEstimator() override; | 24 ~IdleTimeEstimator() override; |
25 | 25 |
26 // Expected Idle time is defined as: |compositor_frame_interval| minus | 26 // Expected Idle time is defined as: |compositor_frame_interval| minus |
(...skipping 22 matching lines...) Expand all Loading... |
49 base::TimeDelta cumulative_compositor_runtime_; | 49 base::TimeDelta cumulative_compositor_runtime_; |
50 int nesting_level_; | 50 int nesting_level_; |
51 bool did_commit_; | 51 bool did_commit_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(IdleTimeEstimator); | 53 DISALLOW_COPY_AND_ASSIGN(IdleTimeEstimator); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace scheduler | 56 } // namespace scheduler |
57 | 57 |
58 #endif // COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_ | 58 #endif // COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_ |
OLD | NEW |