OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_SCHEDULER_SCHEDULER_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_H_ |
6 #define CC_SCHEDULER_SCHEDULER_H_ | 6 #define CC_SCHEDULER_SCHEDULER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/output/begin_frame_args.h" |
14 #include "cc/scheduler/scheduler_settings.h" | 15 #include "cc/scheduler/scheduler_settings.h" |
15 #include "cc/scheduler/scheduler_state_machine.h" | 16 #include "cc/scheduler/scheduler_state_machine.h" |
16 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 class Thread; | 21 class Thread; |
21 | 22 |
22 struct ScheduledActionDrawAndSwapResult { | 23 struct ScheduledActionDrawAndSwapResult { |
23 ScheduledActionDrawAndSwapResult() | 24 ScheduledActionDrawAndSwapResult() |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 bool CommitPending() const { return state_machine_.CommitPending(); } | 94 bool CommitPending() const { return state_machine_.CommitPending(); } |
94 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 95 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
95 | 96 |
96 bool WillDrawIfNeeded() const; | 97 bool WillDrawIfNeeded() const; |
97 | 98 |
98 base::TimeTicks AnticipatedDrawTime(); | 99 base::TimeTicks AnticipatedDrawTime(); |
99 | 100 |
100 base::TimeTicks LastBeginFrameOnImplThreadTime(); | 101 base::TimeTicks LastBeginFrameOnImplThreadTime(); |
101 | 102 |
102 void BeginFrame(base::TimeTicks frame_time); | 103 void BeginFrame(BeginFrameArgs args); |
103 | 104 |
104 std::string StateAsStringForTesting() { return state_machine_.ToString(); } | 105 std::string StateAsStringForTesting() { return state_machine_.ToString(); } |
105 | 106 |
106 private: | 107 private: |
107 Scheduler(SchedulerClient* client, | 108 Scheduler(SchedulerClient* client, |
108 const SchedulerSettings& scheduler_settings); | 109 const SchedulerSettings& scheduler_settings); |
109 | 110 |
110 void SetupNextBeginFrameIfNeeded(); | 111 void SetupNextBeginFrameIfNeeded(); |
111 void DrawAndSwapIfPossible(); | 112 void DrawAndSwapIfPossible(); |
112 void DrawAndSwapForced(); | 113 void DrawAndSwapForced(); |
113 void ProcessScheduledActions(); | 114 void ProcessScheduledActions(); |
114 | 115 |
115 const SchedulerSettings settings_; | 116 const SchedulerSettings settings_; |
116 SchedulerClient* client_; | 117 SchedulerClient* client_; |
117 | 118 |
118 base::WeakPtrFactory<Scheduler> weak_factory_; | 119 base::WeakPtrFactory<Scheduler> weak_factory_; |
119 bool last_set_needs_begin_frame_; | 120 bool last_set_needs_begin_frame_; |
120 bool has_pending_begin_frame_; | 121 bool has_pending_begin_frame_; |
121 base::TimeTicks last_begin_frame_time_; | 122 BeginFrameArgs last_begin_frame_args_; |
122 base::TimeDelta interval_; | |
123 | 123 |
124 SchedulerStateMachine state_machine_; | 124 SchedulerStateMachine state_machine_; |
125 bool inside_process_scheduled_actions_; | 125 bool inside_process_scheduled_actions_; |
126 | 126 |
127 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 127 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
128 }; | 128 }; |
129 | 129 |
130 } // namespace cc | 130 } // namespace cc |
131 | 131 |
132 #endif // CC_SCHEDULER_SCHEDULER_H_ | 132 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |