Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 state_machine_.SetNeedsManageTiles(); | 91 state_machine_.SetNeedsManageTiles(); |
| 92 ProcessScheduledActions(); | 92 ProcessScheduledActions(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void Scheduler::SetMaxSwapsPending(int max) { | 95 void Scheduler::SetMaxSwapsPending(int max) { |
| 96 state_machine_.SetMaxSwapsPending(max); | 96 state_machine_.SetMaxSwapsPending(max); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void Scheduler::DidSwapBuffers() { | 99 void Scheduler::DidSwapBuffers() { |
| 100 state_machine_.DidSwapBuffers(); | 100 state_machine_.DidSwapBuffers(); |
| 101 | |
| 102 // Swap should not occur by readback operation. | |
| 103 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_DRAW_AND_READBACK)); | |
|
brianderson
2014/04/24 01:54:15
Can you move this DCHECK into the state machine? I
simonhong
2014/04/25 01:13:37
I tried but i think checking this condition in sta
| |
| 104 | |
| 101 // There is no need to call ProcessScheduledActions here because | 105 // There is no need to call ProcessScheduledActions here because |
| 102 // swapping should not trigger any new actions. | 106 // swapping should not trigger any new actions. |
| 103 if (!inside_process_scheduled_actions_) { | 107 if (!inside_process_scheduled_actions_) { |
| 104 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 108 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); |
| 105 } | 109 } |
| 106 } | 110 } |
| 107 | 111 |
| 108 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { | 112 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { |
| 109 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); | 113 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); |
| 110 ProcessScheduledActions(); | 114 ProcessScheduledActions(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 DrawSwapReadbackResult result = | 447 DrawSwapReadbackResult result = |
| 444 client_->ScheduledActionDrawAndSwapIfPossible(); | 448 client_->ScheduledActionDrawAndSwapIfPossible(); |
| 445 state_machine_.DidDrawIfPossibleCompleted(result.draw_result); | 449 state_machine_.DidDrawIfPossibleCompleted(result.draw_result); |
| 446 } | 450 } |
| 447 | 451 |
| 448 void Scheduler::DrawAndSwapForced() { | 452 void Scheduler::DrawAndSwapForced() { |
| 449 client_->ScheduledActionDrawAndSwapForced(); | 453 client_->ScheduledActionDrawAndSwapForced(); |
| 450 } | 454 } |
| 451 | 455 |
| 452 void Scheduler::DrawAndReadback() { | 456 void Scheduler::DrawAndReadback() { |
| 453 DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback(); | 457 client_->ScheduledActionDrawAndReadback(); |
| 454 DCHECK(!result.did_request_swap); | |
| 455 } | 458 } |
| 456 | 459 |
| 457 void Scheduler::ProcessScheduledActions() { | 460 void Scheduler::ProcessScheduledActions() { |
| 458 // We do not allow ProcessScheduledActions to be recursive. | 461 // We do not allow ProcessScheduledActions to be recursive. |
| 459 // The top-level call will iteratively execute the next action for us anyway. | 462 // The top-level call will iteratively execute the next action for us anyway. |
| 460 if (inside_process_scheduled_actions_) | 463 if (inside_process_scheduled_actions_) |
| 461 return; | 464 return; |
| 462 | 465 |
| 463 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); | 466 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); |
| 464 | 467 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 574 } | 577 } |
| 575 | 578 |
| 576 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 579 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 577 return (state_machine_.commit_state() == | 580 return (state_machine_.commit_state() == |
| 578 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 581 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 579 state_machine_.commit_state() == | 582 state_machine_.commit_state() == |
| 580 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 583 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 581 } | 584 } |
| 582 | 585 |
| 583 } // namespace cc | 586 } // namespace cc |
| OLD | NEW |