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" |
(...skipping 27 matching lines...) Expand all Loading... |
38 virtual ScheduledActionDrawAndSwapResult | 38 virtual ScheduledActionDrawAndSwapResult |
39 ScheduledActionDrawAndSwapIfPossible() = 0; | 39 ScheduledActionDrawAndSwapIfPossible() = 0; |
40 virtual ScheduledActionDrawAndSwapResult | 40 virtual ScheduledActionDrawAndSwapResult |
41 ScheduledActionDrawAndSwapForced() = 0; | 41 ScheduledActionDrawAndSwapForced() = 0; |
42 virtual void ScheduledActionCommit() = 0; | 42 virtual void ScheduledActionCommit() = 0; |
43 virtual void ScheduledActionCheckForCompletedTileUploads() = 0; | 43 virtual void ScheduledActionCheckForCompletedTileUploads() = 0; |
44 virtual void ScheduledActionActivatePendingTreeIfNeeded() = 0; | 44 virtual void ScheduledActionActivatePendingTreeIfNeeded() = 0; |
45 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 45 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
46 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; | 46 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; |
47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
| 48 virtual void PostBeginFrameDeadlineTask(base::TimeTicks deadline) = 0; |
48 | 49 |
49 protected: | 50 protected: |
50 virtual ~SchedulerClient() {} | 51 virtual ~SchedulerClient() {} |
51 }; | 52 }; |
52 | 53 |
53 class CC_EXPORT Scheduler { | 54 class CC_EXPORT Scheduler { |
54 public: | 55 public: |
55 static scoped_ptr<Scheduler> Create( | 56 static scoped_ptr<Scheduler> Create( |
56 SchedulerClient* client, | 57 SchedulerClient* client, |
57 const SchedulerSettings& scheduler_settings) { | 58 const SchedulerSettings& scheduler_settings) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool CommitPending() const { return state_machine_.CommitPending(); } | 95 bool CommitPending() const { return state_machine_.CommitPending(); } |
95 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 96 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
96 | 97 |
97 bool WillDrawIfNeeded() const; | 98 bool WillDrawIfNeeded() const; |
98 | 99 |
99 base::TimeTicks AnticipatedDrawTime(); | 100 base::TimeTicks AnticipatedDrawTime(); |
100 | 101 |
101 base::TimeTicks LastBeginFrameOnImplThreadTime(); | 102 base::TimeTicks LastBeginFrameOnImplThreadTime(); |
102 | 103 |
103 void BeginFrame(BeginFrameArgs args); | 104 void BeginFrame(BeginFrameArgs args); |
| 105 void OnBeginFrameDeadline(); |
104 | 106 |
105 std::string StateAsStringForTesting() { return state_machine_.ToString(); } | 107 std::string StateAsStringForTesting() { return state_machine_.ToString(); } |
106 | 108 |
107 private: | 109 private: |
108 Scheduler(SchedulerClient* client, | 110 Scheduler(SchedulerClient* client, |
109 const SchedulerSettings& scheduler_settings); | 111 const SchedulerSettings& scheduler_settings); |
110 | 112 |
111 void SetupNextBeginFrameIfNeeded(); | 113 void SetupNextBeginFrameIfNeeded(); |
112 void DrawAndSwapIfPossible(); | 114 void DrawAndSwapIfPossible(); |
113 void DrawAndSwapForced(); | 115 void DrawAndSwapForced(); |
114 void ProcessScheduledActions(); | 116 void ProcessScheduledActions(); |
115 | 117 |
116 const SchedulerSettings settings_; | 118 const SchedulerSettings settings_; |
117 SchedulerClient* client_; | 119 SchedulerClient* client_; |
118 | 120 |
119 base::WeakPtrFactory<Scheduler> weak_factory_; | 121 base::WeakPtrFactory<Scheduler> weak_factory_; |
120 bool last_set_needs_begin_frame_; | 122 bool last_set_needs_begin_frame_; |
121 bool has_pending_begin_frame_; | 123 bool has_pending_begin_frame_; |
122 BeginFrameArgs last_begin_frame_args_; | 124 BeginFrameArgs last_begin_frame_args_; |
123 | 125 |
124 SchedulerStateMachine state_machine_; | 126 SchedulerStateMachine state_machine_; |
125 bool inside_process_scheduled_actions_; | 127 bool inside_process_scheduled_actions_; |
126 | 128 |
127 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 129 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
128 }; | 130 }; |
129 | 131 |
130 } // namespace cc | 132 } // namespace cc |
131 | 133 |
132 #endif // CC_SCHEDULER_SCHEDULER_H_ | 134 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |