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 class LayerTreeSettings; |
19 | 20 |
20 struct ScheduledActionDrawAndSwapResult { | 21 struct ScheduledActionDrawAndSwapResult { |
21 ScheduledActionDrawAndSwapResult() | 22 ScheduledActionDrawAndSwapResult() |
22 : didDraw(false) | 23 : didDraw(false) |
23 , didSwap(false) | 24 , didSwap(false) |
24 { | 25 { |
25 } | 26 } |
26 ScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) | 27 ScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) |
27 : didDraw(didDraw) | 28 : didDraw(didDraw) |
28 , didSwap(didSwap) | 29 , didSwap(didSwap) |
(...skipping 13 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 LayerTreeSettings &layerTreeSettin
gs) |
53 { | 56 { |
54 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass())
); | 57 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass(),
layerTreeSettings)); |
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 23 matching lines...) Expand all Loading... |
88 bool redrawPending() const { return m_stateMachine.redrawPending(); } | 91 bool redrawPending() const { return m_stateMachine.redrawPending(); } |
89 | 92 |
90 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv
al); | 93 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv
al); |
91 | 94 |
92 base::TimeTicks anticipatedDrawTime(); | 95 base::TimeTicks anticipatedDrawTime(); |
93 | 96 |
94 // FrameRateControllerClient implementation | 97 // FrameRateControllerClient implementation |
95 virtual void vsyncTick(bool throttled) OVERRIDE; | 98 virtual void vsyncTick(bool throttled) OVERRIDE; |
96 | 99 |
97 private: | 100 private: |
98 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>); | 101 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>, |
| 102 const LayerTreeSettings &layerTreeSettings); |
99 | 103 |
100 void processScheduledActions(); | 104 void processScheduledActions(); |
101 | 105 |
102 SchedulerClient* m_client; | 106 SchedulerClient* m_client; |
103 scoped_ptr<FrameRateController> m_frameRateController; | 107 scoped_ptr<FrameRateController> m_frameRateController; |
| 108 const LayerTreeSettings& m_layerTreeSettings; |
104 SchedulerStateMachine m_stateMachine; | 109 SchedulerStateMachine m_stateMachine; |
105 bool m_insideProcessScheduledActions; | 110 bool m_insideProcessScheduledActions; |
106 | 111 |
107 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 112 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
108 }; | 113 }; |
109 | 114 |
110 } // namespace cc | 115 } // namespace cc |
111 | 116 |
112 #endif // CC_SCHEDULER_H_ | 117 #endif // CC_SCHEDULER_H_ |
OLD | NEW |