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 #include "cc/scheduler/scheduler_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
6 | 6 |
7 #include "cc/scheduler/scheduler.h" | 7 #include "cc/scheduler/scheduler.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const SchedulerStateMachine::CommitState all_commit_states[] = { | 14 const SchedulerStateMachine::CommitState all_commit_states[] = { |
15 SchedulerStateMachine::COMMIT_STATE_IDLE, | 15 SchedulerStateMachine::COMMIT_STATE_IDLE, |
16 SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, | 16 SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, |
17 SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, | 17 SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, |
18 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW | 18 SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW |
19 }; | 19 }; |
20 | 20 |
21 // Exposes the protected state fields of the SchedulerStateMachine for testing | 21 // Exposes the protected state fields of the SchedulerStateMachine for testing |
22 class StateMachine : public SchedulerStateMachine { | 22 class StateMachine : public SchedulerStateMachine { |
23 public: | 23 public: |
24 StateMachine(const SchedulerSettings& scheduler_settings) | 24 explicit StateMachine(const SchedulerSettings& scheduler_settings) |
25 : SchedulerStateMachine(scheduler_settings) {} | 25 : SchedulerStateMachine(scheduler_settings) {} |
26 void SetCommitState(CommitState cs) { commit_state_ = cs; } | 26 void SetCommitState(CommitState cs) { commit_state_ = cs; } |
27 CommitState CommitState() const { return commit_state_; } | 27 CommitState CommitState() const { return commit_state_; } |
28 | 28 |
29 bool NeedsCommit() const { return needs_commit_; } | 29 bool NeedsCommit() const { return needs_commit_; } |
30 | 30 |
31 void SetNeedsRedraw(bool b) { needs_redraw_ = b; } | 31 void SetNeedsRedraw(bool b) { needs_redraw_ = b; } |
32 bool NeedsRedraw() const { return needs_redraw_; } | 32 bool NeedsRedraw() const { return needs_redraw_; } |
33 | 33 |
34 void SetNeedsForcedRedraw(bool b) { needs_forced_redraw_ = b; } | 34 void SetNeedsForcedRedraw(bool b) { needs_forced_redraw_ = b; } |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); | 1072 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); |
1073 state.SetNeedsForcedRedraw(true); | 1073 state.SetNeedsForcedRedraw(true); |
1074 EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.NextAction()); | 1074 EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.NextAction()); |
1075 state.UpdateState(state.NextAction()); | 1075 state.UpdateState(state.NextAction()); |
1076 state.DidDrawIfPossibleCompleted(true); | 1076 state.DidDrawIfPossibleCompleted(true); |
1077 state.DidLeaveVSync(); | 1077 state.DidLeaveVSync(); |
1078 } | 1078 } |
1079 | 1079 |
1080 } // namespace | 1080 } // namespace |
1081 } // namespace cc | 1081 } // namespace cc |
OLD | NEW |