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.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 state_machine_.SetNeedsManageTiles(); | 179 state_machine_.SetNeedsManageTiles(); |
180 ProcessScheduledActions(); | 180 ProcessScheduledActions(); |
181 } | 181 } |
182 | 182 |
183 void Scheduler::SetMaxSwapsPending(int max) { | 183 void Scheduler::SetMaxSwapsPending(int max) { |
184 state_machine_.SetMaxSwapsPending(max); | 184 state_machine_.SetMaxSwapsPending(max); |
185 } | 185 } |
186 | 186 |
187 void Scheduler::DidSwapBuffers() { | 187 void Scheduler::DidSwapBuffers() { |
188 state_machine_.DidSwapBuffers(); | 188 state_machine_.DidSwapBuffers(); |
189 | |
190 // Swap should not occur by readback operation. | |
Sami
2014/05/01 10:21:44
s/by/inside/?
simonhong
2014/05/08 01:14:57
Done.
| |
191 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_DRAW_AND_READBACK)); | |
192 | |
189 // There is no need to call ProcessScheduledActions here because | 193 // There is no need to call ProcessScheduledActions here because |
190 // swapping should not trigger any new actions. | 194 // swapping should not trigger any new actions. |
191 if (!inside_process_scheduled_actions_) { | 195 if (!inside_process_scheduled_actions_) { |
192 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 196 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); |
193 } | 197 } |
194 } | 198 } |
195 | 199 |
196 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { | 200 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { |
197 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); | 201 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); |
198 ProcessScheduledActions(); | 202 ProcessScheduledActions(); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
587 advance_commit_state_task_.Cancel(); | 591 advance_commit_state_task_.Cancel(); |
588 ProcessScheduledActions(); | 592 ProcessScheduledActions(); |
589 } | 593 } |
590 | 594 |
591 bool Scheduler::IsBeginMainFrameSent() const { | 595 bool Scheduler::IsBeginMainFrameSent() const { |
592 return state_machine_.commit_state() == | 596 return state_machine_.commit_state() == |
593 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT; | 597 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT; |
594 } | 598 } |
595 | 599 |
596 void Scheduler::DrawAndSwapIfPossible() { | 600 void Scheduler::DrawAndSwapIfPossible() { |
597 DrawSwapReadbackResult result = | 601 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); |
598 client_->ScheduledActionDrawAndSwapIfPossible(); | 602 state_machine_.DidDrawIfPossibleCompleted(result); |
599 state_machine_.DidDrawIfPossibleCompleted(result.draw_result); | |
600 } | 603 } |
601 | 604 |
602 void Scheduler::DrawAndSwapForced() { | 605 void Scheduler::DrawAndSwapForced() { |
Sami
2014/05/01 10:21:44
Looks like this and the next function could be rem
simonhong
2014/05/08 01:14:57
Yep. Both are removed.
| |
603 client_->ScheduledActionDrawAndSwapForced(); | 606 client_->ScheduledActionDrawAndSwapForced(); |
604 } | 607 } |
605 | 608 |
606 void Scheduler::DrawAndReadback() { | 609 void Scheduler::DrawAndReadback() { |
607 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback(); | 610 client_->ScheduledActionDrawAndReadback(); |
608 DCHECK(!result.did_request_swap); | |
609 } | 611 } |
610 | 612 |
611 void Scheduler::ProcessScheduledActions() { | 613 void Scheduler::ProcessScheduledActions() { |
612 // We do not allow ProcessScheduledActions to be recursive. | 614 // We do not allow ProcessScheduledActions to be recursive. |
613 // The top-level call will iteratively execute the next action for us anyway. | 615 // The top-level call will iteratively execute the next action for us anyway. |
614 if (inside_process_scheduled_actions_) | 616 if (inside_process_scheduled_actions_) |
615 return; | 617 return; |
616 | 618 |
617 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); | 619 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); |
618 | 620 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 } | 730 } |
729 | 731 |
730 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 732 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
731 return (state_machine_.commit_state() == | 733 return (state_machine_.commit_state() == |
732 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 734 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
733 state_machine_.commit_state() == | 735 state_machine_.commit_state() == |
734 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 736 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
735 } | 737 } |
736 | 738 |
737 } // namespace cc | 739 } // namespace cc |
OLD | NEW |