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/cancelable_callback.h" | |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/time.h" | 13 #include "base/time.h" |
13 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
14 #include "cc/output/begin_frame_args.h" | 15 #include "cc/output/begin_frame_args.h" |
15 #include "cc/scheduler/scheduler_settings.h" | 16 #include "cc/scheduler/scheduler_settings.h" |
16 #include "cc/scheduler/scheduler_state_machine.h" | 17 #include "cc/scheduler/scheduler_state_machine.h" |
17 #include "cc/trees/layer_tree_host.h" | 18 #include "cc/trees/layer_tree_host.h" |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 | 21 |
(...skipping 18 matching lines...) Expand all Loading... | |
39 ScheduledActionDrawAndSwapIfPossible() = 0; | 40 ScheduledActionDrawAndSwapIfPossible() = 0; |
40 virtual ScheduledActionDrawAndSwapResult | 41 virtual ScheduledActionDrawAndSwapResult |
41 ScheduledActionDrawAndSwapForced() = 0; | 42 ScheduledActionDrawAndSwapForced() = 0; |
42 virtual void ScheduledActionCommit() = 0; | 43 virtual void ScheduledActionCommit() = 0; |
43 virtual void ScheduledActionCheckForCompletedTileUploads() = 0; | 44 virtual void ScheduledActionCheckForCompletedTileUploads() = 0; |
44 virtual void ScheduledActionActivatePendingTreeIfNeeded() = 0; | 45 virtual void ScheduledActionActivatePendingTreeIfNeeded() = 0; |
45 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 46 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
46 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; | 47 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; |
47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 48 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
48 virtual base::TimeDelta DrawDurationEstimate() = 0; | 49 virtual base::TimeDelta DrawDurationEstimate() = 0; |
50 virtual void PostBeginFrameDeadline(const base::Closure& closure, | |
nduca
2013/06/21 01:14:18
i think this should be done by the output surface,
brianderson
2013/06/21 01:42:47
I was originally going to implement it that way, b
| |
51 base::TimeTicks deadline) = 0; | |
49 | 52 |
50 protected: | 53 protected: |
51 virtual ~SchedulerClient() {} | 54 virtual ~SchedulerClient() {} |
52 }; | 55 }; |
53 | 56 |
54 class CC_EXPORT Scheduler { | 57 class CC_EXPORT Scheduler { |
55 public: | 58 public: |
56 static scoped_ptr<Scheduler> Create( | 59 static scoped_ptr<Scheduler> Create( |
57 SchedulerClient* client, | 60 SchedulerClient* client, |
58 const SchedulerSettings& scheduler_settings) { | 61 const SchedulerSettings& scheduler_settings) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 bool CommitPending() const { return state_machine_.CommitPending(); } | 98 bool CommitPending() const { return state_machine_.CommitPending(); } |
96 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 99 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
97 | 100 |
98 bool WillDrawIfNeeded() const; | 101 bool WillDrawIfNeeded() const; |
99 | 102 |
100 base::TimeTicks AnticipatedDrawTime(); | 103 base::TimeTicks AnticipatedDrawTime(); |
101 | 104 |
102 base::TimeTicks LastBeginFrameOnImplThreadTime(); | 105 base::TimeTicks LastBeginFrameOnImplThreadTime(); |
103 | 106 |
104 void BeginFrame(const BeginFrameArgs& args); | 107 void BeginFrame(const BeginFrameArgs& args); |
108 void OnBeginFrameDeadline(); | |
105 | 109 |
106 std::string StateAsStringForTesting() { return state_machine_.ToString(); } | 110 std::string StateAsStringForTesting() { return state_machine_.ToString(); } |
107 | 111 |
108 private: | 112 private: |
109 Scheduler(SchedulerClient* client, | 113 Scheduler(SchedulerClient* client, |
110 const SchedulerSettings& scheduler_settings); | 114 const SchedulerSettings& scheduler_settings); |
111 | 115 |
112 void SetupNextBeginFrameIfNeeded(); | 116 void SetupNextBeginFrameIfNeeded(); |
113 void DrawAndSwapIfPossible(); | 117 void DrawAndSwapIfPossible(); |
114 void DrawAndSwapForced(); | 118 void DrawAndSwapForced(); |
115 void ProcessScheduledActions(); | 119 void ProcessScheduledActions(); |
116 | 120 |
117 const SchedulerSettings settings_; | 121 const SchedulerSettings settings_; |
118 SchedulerClient* client_; | 122 SchedulerClient* client_; |
119 | 123 |
120 base::WeakPtrFactory<Scheduler> weak_factory_; | 124 base::WeakPtrFactory<Scheduler> weak_factory_; |
121 bool last_set_needs_begin_frame_; | 125 bool last_set_needs_begin_frame_; |
122 bool has_pending_begin_frame_; | 126 bool has_pending_begin_frame_; |
123 // TODO(brianderson): crbug.com/249806 : Remove safe_to_expect_begin_frame_ | 127 // TODO(brianderson): crbug.com/249806 : Remove safe_to_expect_begin_frame_ |
124 // workaround. | 128 // workaround. |
125 bool safe_to_expect_begin_frame_; | 129 bool safe_to_expect_begin_frame_; |
126 BeginFrameArgs last_begin_frame_args_; | 130 BeginFrameArgs last_begin_frame_args_; |
131 base::CancelableClosure begin_frame_deadline_closure_; | |
127 | 132 |
128 SchedulerStateMachine state_machine_; | 133 SchedulerStateMachine state_machine_; |
129 bool inside_process_scheduled_actions_; | 134 bool inside_process_scheduled_actions_; |
130 | 135 |
131 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 136 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
132 }; | 137 }; |
133 | 138 |
134 } // namespace cc | 139 } // namespace cc |
135 | 140 |
136 #endif // CC_SCHEDULER_SCHEDULER_H_ | 141 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |