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_H_ | 5 #ifndef CC_SCHEDULER_H_ |
6 #define CC_SCHEDULER_H_ | 6 #define CC_SCHEDULER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
12 #include "cc/frame_rate_controller.h" | 12 #include "cc/frame_rate_controller.h" |
13 #include "cc/layer_tree_host.h" | 13 #include "cc/layer_tree_host.h" |
| 14 #include "cc/scheduler_settings.h" |
14 #include "cc/scheduler_state_machine.h" | 15 #include "cc/scheduler_state_machine.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
18 class Thread; | 19 class Thread; |
19 | 20 |
20 struct ScheduledActionDrawAndSwapResult { | 21 struct ScheduledActionDrawAndSwapResult { |
21 ScheduledActionDrawAndSwapResult() | 22 ScheduledActionDrawAndSwapResult() |
22 : didDraw(false) | 23 : didDraw(false) |
23 , didSwap(false) | 24 , didSwap(false) |
(...skipping 18 matching lines...) Expand all Loading... |
42 virtual void scheduledActionBeginContextRecreation() = 0; | 43 virtual void scheduledActionBeginContextRecreation() = 0; |
43 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; | 44 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; |
44 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0; | 45 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0; |
45 | 46 |
46 protected: | 47 protected: |
47 virtual ~SchedulerClient() { } | 48 virtual ~SchedulerClient() { } |
48 }; | 49 }; |
49 | 50 |
50 class CC_EXPORT Scheduler : FrameRateControllerClient { | 51 class CC_EXPORT Scheduler : FrameRateControllerClient { |
51 public: | 52 public: |
52 static scoped_ptr<Scheduler> create(SchedulerClient* client, scoped_ptr<Fram
eRateController> frameRateController) | 53 static scoped_ptr<Scheduler> create(SchedulerClient* client, |
| 54 scoped_ptr<FrameRateController> frameRat
eController, |
| 55 const SchedulerSettings& schedulerSettin
gs) |
53 { | 56 { |
54 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass())
); | 57 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass(),
schedulerSettings)); |
55 } | 58 } |
56 | 59 |
57 virtual ~Scheduler(); | 60 virtual ~Scheduler(); |
58 | 61 |
59 void setCanBeginFrame(bool); | 62 void setCanBeginFrame(bool); |
60 | 63 |
61 void setVisible(bool); | 64 void setVisible(bool); |
62 void setCanDraw(bool); | 65 void setCanDraw(bool); |
63 void setHasPendingTree(bool); | 66 void setHasPendingTree(bool); |
64 | 67 |
(...skipping 25 matching lines...) Expand all Loading... |
90 bool redrawPending() const { return m_stateMachine.redrawPending(); } | 93 bool redrawPending() const { return m_stateMachine.redrawPending(); } |
91 | 94 |
92 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv
al); | 95 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv
al); |
93 | 96 |
94 base::TimeTicks anticipatedDrawTime(); | 97 base::TimeTicks anticipatedDrawTime(); |
95 | 98 |
96 // FrameRateControllerClient implementation | 99 // FrameRateControllerClient implementation |
97 virtual void vsyncTick(bool throttled) OVERRIDE; | 100 virtual void vsyncTick(bool throttled) OVERRIDE; |
98 | 101 |
99 private: | 102 private: |
100 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>); | 103 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>, |
| 104 const SchedulerSettings& schedulerSettings); |
101 | 105 |
102 void processScheduledActions(); | 106 void processScheduledActions(); |
103 | 107 |
| 108 const SchedulerSettings m_settings; |
104 SchedulerClient* m_client; | 109 SchedulerClient* m_client; |
105 scoped_ptr<FrameRateController> m_frameRateController; | 110 scoped_ptr<FrameRateController> m_frameRateController; |
106 SchedulerStateMachine m_stateMachine; | 111 SchedulerStateMachine m_stateMachine; |
107 bool m_insideProcessScheduledActions; | 112 bool m_insideProcessScheduledActions; |
108 | 113 |
109 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 114 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace cc | 117 } // namespace cc |
113 | 118 |
114 #endif // CC_SCHEDULER_H_ | 119 #endif // CC_SCHEDULER_H_ |
OLD | NEW |