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_state_machine.h" | 14 #include "cc/scheduler_state_machine.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class Thread; | 18 class Thread; |
19 | 19 |
20 class SchedulerSettings | |
21 { | |
22 public: | |
23 SchedulerSettings(); | |
24 virtual ~SchedulerSettings() { } | |
nduca
2013/01/16 02:16:02
its POD so you dont need ~
| |
25 | |
26 bool implSidePainting; | |
27 }; | |
28 | |
20 struct ScheduledActionDrawAndSwapResult { | 29 struct ScheduledActionDrawAndSwapResult { |
21 ScheduledActionDrawAndSwapResult() | 30 ScheduledActionDrawAndSwapResult() |
22 : didDraw(false) | 31 : didDraw(false) |
23 , didSwap(false) | 32 , didSwap(false) |
24 { | 33 { |
25 } | 34 } |
26 ScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) | 35 ScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) |
27 : didDraw(didDraw) | 36 : didDraw(didDraw) |
28 , didSwap(didSwap) | 37 , didSwap(didSwap) |
29 { | 38 { |
(...skipping 12 matching lines...) Expand all Loading... | |
42 virtual void scheduledActionBeginContextRecreation() = 0; | 51 virtual void scheduledActionBeginContextRecreation() = 0; |
43 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; | 52 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; |
44 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0; | 53 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0; |
45 | 54 |
46 protected: | 55 protected: |
47 virtual ~SchedulerClient() { } | 56 virtual ~SchedulerClient() { } |
48 }; | 57 }; |
49 | 58 |
50 class CC_EXPORT Scheduler : FrameRateControllerClient { | 59 class CC_EXPORT Scheduler : FrameRateControllerClient { |
51 public: | 60 public: |
52 static scoped_ptr<Scheduler> create(SchedulerClient* client, scoped_ptr<Fram eRateController> frameRateController) | 61 static scoped_ptr<Scheduler> create(SchedulerClient* client, |
62 scoped_ptr<FrameRateController> frameRat eController, | |
63 const SchedulerSettings &schedulerSettin gs) | |
53 { | 64 { |
54 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass()) ); | 65 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass(), schedulerSettings)); |
55 } | 66 } |
56 | 67 |
57 virtual ~Scheduler(); | 68 virtual ~Scheduler(); |
58 | 69 |
59 void setCanBeginFrame(bool); | 70 void setCanBeginFrame(bool); |
60 | 71 |
61 void setVisible(bool); | 72 void setVisible(bool); |
62 void setCanDraw(bool); | 73 void setCanDraw(bool); |
63 void setHasPendingTree(bool); | 74 void setHasPendingTree(bool); |
64 | 75 |
(...skipping 23 matching lines...) Expand all Loading... | |
88 bool redrawPending() const { return m_stateMachine.redrawPending(); } | 99 bool redrawPending() const { return m_stateMachine.redrawPending(); } |
89 | 100 |
90 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv al); | 101 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv al); |
91 | 102 |
92 base::TimeTicks anticipatedDrawTime(); | 103 base::TimeTicks anticipatedDrawTime(); |
93 | 104 |
94 // FrameRateControllerClient implementation | 105 // FrameRateControllerClient implementation |
95 virtual void vsyncTick(bool throttled) OVERRIDE; | 106 virtual void vsyncTick(bool throttled) OVERRIDE; |
96 | 107 |
97 private: | 108 private: |
98 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>); | 109 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>, |
110 const SchedulerSettings &schedulerSettings); | |
nduca
2013/01/16 02:16:02
style looks funky
const Foo& foo
| |
99 | 111 |
100 void processScheduledActions(); | 112 void processScheduledActions(); |
101 | 113 |
114 const SchedulerSettings m_settings; | |
102 SchedulerClient* m_client; | 115 SchedulerClient* m_client; |
103 scoped_ptr<FrameRateController> m_frameRateController; | 116 scoped_ptr<FrameRateController> m_frameRateController; |
104 SchedulerStateMachine m_stateMachine; | 117 SchedulerStateMachine m_stateMachine; |
105 bool m_insideProcessScheduledActions; | 118 bool m_insideProcessScheduledActions; |
106 | 119 |
107 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 120 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
108 }; | 121 }; |
109 | 122 |
110 } // namespace cc | 123 } // namespace cc |
111 | 124 |
112 #endif // CC_SCHEDULER_H_ | 125 #endif // CC_SCHEDULER_H_ |
OLD | NEW |