| 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 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 primary_frame_source_internal_(external_begin_frame_source.Pass()), | 85 primary_frame_source_internal_(external_begin_frame_source.Pass()), |
| 86 background_frame_source_internal_(), | 86 background_frame_source_internal_(), |
| 87 vsync_observer_(NULL), | 87 vsync_observer_(NULL), |
| 88 settings_(scheduler_settings), | 88 settings_(scheduler_settings), |
| 89 client_(client), | 89 client_(client), |
| 90 layer_tree_host_id_(layer_tree_host_id), | 90 layer_tree_host_id_(layer_tree_host_id), |
| 91 task_runner_(task_runner), | 91 task_runner_(task_runner), |
| 92 power_monitor_(power_monitor), | 92 power_monitor_(power_monitor), |
| 93 state_machine_(scheduler_settings), | 93 state_machine_(scheduler_settings), |
| 94 inside_process_scheduled_actions_(false), | 94 inside_process_scheduled_actions_(false), |
| 95 inside_action_(SchedulerStateMachine::ACTION_NONE), | 95 inside_action_(SchedulerStateMachine::Action::NONE), |
| 96 weak_factory_(this) { | 96 weak_factory_(this) { |
| 97 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 97 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), |
| 98 "Scheduler::Scheduler", | 98 "Scheduler::Scheduler", |
| 99 "settings", | 99 "settings", |
| 100 settings_.AsValue()); | 100 settings_.AsValue()); |
| 101 DCHECK(client_); | 101 DCHECK(client_); |
| 102 DCHECK(!state_machine_.BeginFrameNeeded()); | 102 DCHECK(!state_machine_.BeginFrameNeeded()); |
| 103 | 103 |
| 104 begin_retro_frame_closure_ = | 104 begin_retro_frame_closure_ = |
| 105 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr()); | 105 base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 state_machine_.SetNeedsRedraw(); | 217 state_machine_.SetNeedsRedraw(); |
| 218 ProcessScheduledActions(); | 218 ProcessScheduledActions(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void Scheduler::SetNeedsAnimate() { | 221 void Scheduler::SetNeedsAnimate() { |
| 222 state_machine_.SetNeedsAnimate(); | 222 state_machine_.SetNeedsAnimate(); |
| 223 ProcessScheduledActions(); | 223 ProcessScheduledActions(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void Scheduler::SetNeedsPrepareTiles() { | 226 void Scheduler::SetNeedsPrepareTiles() { |
| 227 DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_PREPARE_TILES)); | 227 DCHECK(!IsInsideAction(SchedulerStateMachine::Action::PREPARE_TILES)); |
| 228 state_machine_.SetNeedsPrepareTiles(); | 228 state_machine_.SetNeedsPrepareTiles(); |
| 229 ProcessScheduledActions(); | 229 ProcessScheduledActions(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void Scheduler::SetMaxSwapsPending(int max) { | 232 void Scheduler::SetMaxSwapsPending(int max) { |
| 233 state_machine_.SetMaxSwapsPending(max); | 233 state_machine_.SetMaxSwapsPending(max); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void Scheduler::DidSwapBuffers() { | 236 void Scheduler::DidSwapBuffers() { |
| 237 state_machine_.DidSwapBuffers(); | 237 state_machine_.DidSwapBuffers(); |
| 238 | 238 |
| 239 // There is no need to call ProcessScheduledActions here because | 239 // There is no need to call ProcessScheduledActions here because |
| 240 // swapping should not trigger any new actions. | 240 // swapping should not trigger any new actions. |
| 241 if (!inside_process_scheduled_actions_) { | 241 if (!inside_process_scheduled_actions_) { |
| 242 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 242 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::Action::NONE); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 void Scheduler::DidSwapBuffersComplete() { | 246 void Scheduler::DidSwapBuffersComplete() { |
| 247 state_machine_.DidSwapBuffersComplete(); | 247 state_machine_.DidSwapBuffersComplete(); |
| 248 ProcessScheduledActions(); | 248 ProcessScheduledActions(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { | 251 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { |
| 252 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); | 252 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 void Scheduler::SetupNextBeginFrameIfNeeded() { | 310 void Scheduler::SetupNextBeginFrameIfNeeded() { |
| 311 if (!task_runner_.get()) | 311 if (!task_runner_.get()) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 if (state_machine_.ShouldSetNeedsBeginFrames( | 314 if (state_machine_.ShouldSetNeedsBeginFrames( |
| 315 frame_source_->NeedsBeginFrames())) { | 315 frame_source_->NeedsBeginFrames())) { |
| 316 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); | 316 frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 if (state_machine_.begin_impl_frame_state() == | 319 if (state_machine_.begin_impl_frame_state() == |
| 320 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) { | 320 SchedulerStateMachine::BeginImplFrameState::INSIDE_DEADLINE) { |
| 321 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); | 321 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); |
| 322 } | 322 } |
| 323 | 323 |
| 324 PostBeginRetroFrameIfNeeded(); | 324 PostBeginRetroFrameIfNeeded(); |
| 325 SetupPollingMechanisms(); | 325 SetupPollingMechanisms(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 // We may need to poll when we can't rely on BeginFrame to advance certain | 328 // We may need to poll when we can't rely on BeginFrame to advance certain |
| 329 // state or to avoid deadlock. | 329 // state or to avoid deadlock. |
| 330 void Scheduler::SetupPollingMechanisms() { | 330 void Scheduler::SetupPollingMechanisms() { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 bool should_defer_begin_frame; | 411 bool should_defer_begin_frame; |
| 412 if (settings_.using_synchronous_renderer_compositor) { | 412 if (settings_.using_synchronous_renderer_compositor) { |
| 413 should_defer_begin_frame = false; | 413 should_defer_begin_frame = false; |
| 414 } else { | 414 } else { |
| 415 should_defer_begin_frame = | 415 should_defer_begin_frame = |
| 416 !begin_retro_frame_args_.empty() || | 416 !begin_retro_frame_args_.empty() || |
| 417 !begin_retro_frame_task_.IsCancelled() || | 417 !begin_retro_frame_task_.IsCancelled() || |
| 418 !frame_source_->NeedsBeginFrames() || | 418 !frame_source_->NeedsBeginFrames() || |
| 419 (state_machine_.begin_impl_frame_state() != | 419 (state_machine_.begin_impl_frame_state() != |
| 420 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 420 SchedulerStateMachine::BeginImplFrameState::IDLE); |
| 421 } | 421 } |
| 422 | 422 |
| 423 if (should_defer_begin_frame) { | 423 if (should_defer_begin_frame) { |
| 424 begin_retro_frame_args_.push_back(adjusted_args); | 424 begin_retro_frame_args_.push_back(adjusted_args); |
| 425 TRACE_EVENT_INSTANT0( | 425 TRACE_EVENT_INSTANT0( |
| 426 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); | 426 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); |
| 427 // Queuing the frame counts as "using it", so we need to return true. | 427 // Queuing the frame counts as "using it", so we need to return true. |
| 428 } else { | 428 } else { |
| 429 BeginImplFrame(adjusted_args); | 429 BeginImplFrame(adjusted_args); |
| 430 } | 430 } |
| 431 return true; | 431 return true; |
| 432 } | 432 } |
| 433 | 433 |
| 434 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { | 434 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { |
| 435 DCHECK(settings_.forward_begin_frames_to_children); | 435 DCHECK(settings_.forward_begin_frames_to_children); |
| 436 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames); | 436 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames); |
| 437 ProcessScheduledActions(); | 437 ProcessScheduledActions(); |
| 438 } | 438 } |
| 439 | 439 |
| 440 // BeginRetroFrame is called for BeginFrames that we've deferred because | 440 // BeginRetroFrame is called for BeginFrames that we've deferred because |
| 441 // the scheduler was in the middle of processing a previous BeginFrame. | 441 // the scheduler was in the middle of processing a previous BeginFrame. |
| 442 void Scheduler::BeginRetroFrame() { | 442 void Scheduler::BeginRetroFrame() { |
| 443 TRACE_EVENT0("cc", "Scheduler::BeginRetroFrame"); | 443 TRACE_EVENT0("cc", "Scheduler::BeginRetroFrame"); |
| 444 DCHECK(!settings_.using_synchronous_renderer_compositor); | 444 DCHECK(!settings_.using_synchronous_renderer_compositor); |
| 445 DCHECK(!begin_retro_frame_args_.empty()); | 445 DCHECK(!begin_retro_frame_args_.empty()); |
| 446 DCHECK(!begin_retro_frame_task_.IsCancelled()); | 446 DCHECK(!begin_retro_frame_task_.IsCancelled()); |
| 447 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 447 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
| 448 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 448 SchedulerStateMachine::BeginImplFrameState::IDLE); |
| 449 | 449 |
| 450 begin_retro_frame_task_.Cancel(); | 450 begin_retro_frame_task_.Cancel(); |
| 451 | 451 |
| 452 // Discard expired BeginRetroFrames | 452 // Discard expired BeginRetroFrames |
| 453 // Today, we should always end up with at most one un-expired BeginRetroFrame | 453 // Today, we should always end up with at most one un-expired BeginRetroFrame |
| 454 // because deadlines will not be greater than the next frame time. We don't | 454 // because deadlines will not be greater than the next frame time. We don't |
| 455 // DCHECK though because some systems don't always have monotonic timestamps. | 455 // DCHECK though because some systems don't always have monotonic timestamps. |
| 456 // TODO(brianderson): In the future, long deadlines could result in us not | 456 // TODO(brianderson): In the future, long deadlines could result in us not |
| 457 // draining the queue if we don't catch up. If we consistently can't catch | 457 // draining the queue if we don't catch up. If we consistently can't catch |
| 458 // up, our fallback should be to lower our frame rate. | 458 // up, our fallback should be to lower our frame rate. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 return; | 495 return; |
| 496 | 496 |
| 497 if (begin_retro_frame_args_.empty() || !begin_retro_frame_task_.IsCancelled()) | 497 if (begin_retro_frame_args_.empty() || !begin_retro_frame_task_.IsCancelled()) |
| 498 return; | 498 return; |
| 499 | 499 |
| 500 // begin_retro_frame_args_ should always be empty for the | 500 // begin_retro_frame_args_ should always be empty for the |
| 501 // synchronous compositor. | 501 // synchronous compositor. |
| 502 DCHECK(!settings_.using_synchronous_renderer_compositor); | 502 DCHECK(!settings_.using_synchronous_renderer_compositor); |
| 503 | 503 |
| 504 if (state_machine_.begin_impl_frame_state() != | 504 if (state_machine_.begin_impl_frame_state() != |
| 505 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE) | 505 SchedulerStateMachine::BeginImplFrameState::IDLE) |
| 506 return; | 506 return; |
| 507 | 507 |
| 508 begin_retro_frame_task_.Reset(begin_retro_frame_closure_); | 508 begin_retro_frame_task_.Reset(begin_retro_frame_closure_); |
| 509 | 509 |
| 510 task_runner_->PostTask(FROM_HERE, begin_retro_frame_task_.callback()); | 510 task_runner_->PostTask(FROM_HERE, begin_retro_frame_task_.callback()); |
| 511 } | 511 } |
| 512 | 512 |
| 513 // BeginImplFrame starts a compositor frame that will wait up until a deadline | 513 // BeginImplFrame starts a compositor frame that will wait up until a deadline |
| 514 // for a BeginMainFrame+activation to complete before it times out and draws | 514 // for a BeginMainFrame+activation to complete before it times out and draws |
| 515 // any asynchronous animation and scroll/pinch updates. | 515 // any asynchronous animation and scroll/pinch updates. |
| 516 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { | 516 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { |
| 517 bool main_thread_is_in_high_latency_mode = | 517 bool main_thread_is_in_high_latency_mode = |
| 518 state_machine_.MainThreadIsInHighLatencyMode(); | 518 state_machine_.MainThreadIsInHighLatencyMode(); |
| 519 TRACE_EVENT2("cc", | 519 TRACE_EVENT2("cc", |
| 520 "Scheduler::BeginImplFrame", | 520 "Scheduler::BeginImplFrame", |
| 521 "args", | 521 "args", |
| 522 args.AsValue(), | 522 args.AsValue(), |
| 523 "main_thread_is_high_latency", | 523 "main_thread_is_high_latency", |
| 524 main_thread_is_in_high_latency_mode); | 524 main_thread_is_in_high_latency_mode); |
| 525 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 525 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), |
| 526 "MainThreadLatency", | 526 "MainThreadLatency", |
| 527 main_thread_is_in_high_latency_mode); | 527 main_thread_is_in_high_latency_mode); |
| 528 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 528 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
| 529 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 529 SchedulerStateMachine::BeginImplFrameState::IDLE); |
| 530 DCHECK(state_machine_.HasInitializedOutputSurface()); | 530 DCHECK(state_machine_.HasInitializedOutputSurface()); |
| 531 | 531 |
| 532 advance_commit_state_task_.Cancel(); | 532 advance_commit_state_task_.Cancel(); |
| 533 | 533 |
| 534 begin_impl_frame_args_ = args; | 534 begin_impl_frame_args_ = args; |
| 535 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); | 535 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); |
| 536 | 536 |
| 537 if (!state_machine_.impl_latency_takes_priority() && | 537 if (!state_machine_.impl_latency_takes_priority() && |
| 538 main_thread_is_in_high_latency_mode && | 538 main_thread_is_in_high_latency_mode && |
| 539 CanCommitAndActivateBeforeDeadline()) { | 539 CanCommitAndActivateBeforeDeadline()) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 565 DCHECK(!settings_.using_synchronous_renderer_compositor); | 565 DCHECK(!settings_.using_synchronous_renderer_compositor); |
| 566 | 566 |
| 567 begin_impl_frame_deadline_task_.Cancel(); | 567 begin_impl_frame_deadline_task_.Cancel(); |
| 568 begin_impl_frame_deadline_task_.Reset(begin_impl_frame_deadline_closure_); | 568 begin_impl_frame_deadline_task_.Reset(begin_impl_frame_deadline_closure_); |
| 569 | 569 |
| 570 begin_impl_frame_deadline_mode_ = | 570 begin_impl_frame_deadline_mode_ = |
| 571 state_machine_.CurrentBeginImplFrameDeadlineMode(); | 571 state_machine_.CurrentBeginImplFrameDeadlineMode(); |
| 572 | 572 |
| 573 base::TimeTicks deadline; | 573 base::TimeTicks deadline; |
| 574 switch (begin_impl_frame_deadline_mode_) { | 574 switch (begin_impl_frame_deadline_mode_) { |
| 575 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE: | 575 case SchedulerStateMachine::BeginImplFrameDeadlineMode::IMMEDIATE: |
| 576 // We are ready to draw a new active tree immediately. | 576 // We are ready to draw a new active tree immediately. |
| 577 // We don't use Now() here because it's somewhat expensive to call. | 577 // We don't use Now() here because it's somewhat expensive to call. |
| 578 deadline = base::TimeTicks(); | 578 deadline = base::TimeTicks(); |
| 579 break; | 579 break; |
| 580 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR: | 580 case SchedulerStateMachine::BeginImplFrameDeadlineMode::REGULAR: |
| 581 // We are animating on the impl thread but we can wait for some time. | 581 // We are animating on the impl thread but we can wait for some time. |
| 582 deadline = begin_impl_frame_args_.deadline; | 582 deadline = begin_impl_frame_args_.deadline; |
| 583 break; | 583 break; |
| 584 case SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE: | 584 case SchedulerStateMachine::BeginImplFrameDeadlineMode::LATE: |
| 585 // We are blocked for one reason or another and we should wait. | 585 // We are blocked for one reason or another and we should wait. |
| 586 // TODO(brianderson): Handle long deadlines (that are past the next | 586 // TODO(brianderson): Handle long deadlines (that are past the next |
| 587 // frame's frame time) properly instead of using this hack. | 587 // frame's frame time) properly instead of using this hack. |
| 588 deadline = | 588 deadline = |
| 589 begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; | 589 begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval; |
| 590 break; | 590 break; |
| 591 } | 591 } |
| 592 | 592 |
| 593 TRACE_EVENT1( | 593 TRACE_EVENT1( |
| 594 "cc", "Scheduler::ScheduleBeginImplFrameDeadline", "deadline", deadline); | 594 "cc", "Scheduler::ScheduleBeginImplFrameDeadline", "deadline", deadline); |
| 595 | 595 |
| 596 base::TimeDelta delta = deadline - Now(); | 596 base::TimeDelta delta = deadline - Now(); |
| 597 if (delta <= base::TimeDelta()) | 597 if (delta <= base::TimeDelta()) |
| 598 delta = base::TimeDelta(); | 598 delta = base::TimeDelta(); |
| 599 task_runner_->PostDelayedTask( | 599 task_runner_->PostDelayedTask( |
| 600 FROM_HERE, begin_impl_frame_deadline_task_.callback(), delta); | 600 FROM_HERE, begin_impl_frame_deadline_task_.callback(), delta); |
| 601 } | 601 } |
| 602 | 602 |
| 603 void Scheduler::RescheduleBeginImplFrameDeadlineIfNeeded() { | 603 void Scheduler::RescheduleBeginImplFrameDeadlineIfNeeded() { |
| 604 if (settings_.using_synchronous_renderer_compositor) | 604 if (settings_.using_synchronous_renderer_compositor) |
| 605 return; | 605 return; |
| 606 | 606 |
| 607 if (state_machine_.begin_impl_frame_state() != | 607 if (state_machine_.begin_impl_frame_state() != |
| 608 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) | 608 SchedulerStateMachine::BeginImplFrameState::INSIDE_BEGIN_FRAME) |
| 609 return; | 609 return; |
| 610 | 610 |
| 611 if (begin_impl_frame_deadline_mode_ != | 611 if (begin_impl_frame_deadline_mode_ != |
| 612 state_machine_.CurrentBeginImplFrameDeadlineMode()) | 612 state_machine_.CurrentBeginImplFrameDeadlineMode()) |
| 613 ScheduleBeginImplFrameDeadline(); | 613 ScheduleBeginImplFrameDeadline(); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void Scheduler::OnBeginImplFrameDeadline() { | 616 void Scheduler::OnBeginImplFrameDeadline() { |
| 617 TRACE_EVENT0("cc", "Scheduler::OnBeginImplFrameDeadline"); | 617 TRACE_EVENT0("cc", "Scheduler::OnBeginImplFrameDeadline"); |
| 618 begin_impl_frame_deadline_task_.Cancel(); | 618 begin_impl_frame_deadline_task_.Cancel(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 "SchedulerStateMachine", | 665 "SchedulerStateMachine", |
| 666 "state", | 666 "state", |
| 667 AsValue()); | 667 AsValue()); |
| 668 VLOG(2) << "Scheduler::ProcessScheduledActions: " | 668 VLOG(2) << "Scheduler::ProcessScheduledActions: " |
| 669 << SchedulerStateMachine::ActionToString(action) << " " | 669 << SchedulerStateMachine::ActionToString(action) << " " |
| 670 << state_machine_.GetStatesForDebugging(); | 670 << state_machine_.GetStatesForDebugging(); |
| 671 state_machine_.UpdateState(action); | 671 state_machine_.UpdateState(action); |
| 672 base::AutoReset<SchedulerStateMachine::Action> | 672 base::AutoReset<SchedulerStateMachine::Action> |
| 673 mark_inside_action(&inside_action_, action); | 673 mark_inside_action(&inside_action_, action); |
| 674 switch (action) { | 674 switch (action) { |
| 675 case SchedulerStateMachine::ACTION_NONE: | 675 case SchedulerStateMachine::Action::NONE: |
| 676 break; | 676 break; |
| 677 case SchedulerStateMachine::ACTION_ANIMATE: | 677 case SchedulerStateMachine::Action::ANIMATE: |
| 678 client_->ScheduledActionAnimate(); | 678 client_->ScheduledActionAnimate(); |
| 679 break; | 679 break; |
| 680 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: | 680 case SchedulerStateMachine::Action::SEND_BEGIN_MAIN_FRAME: |
| 681 client_->ScheduledActionSendBeginMainFrame(); | 681 client_->ScheduledActionSendBeginMainFrame(); |
| 682 break; | 682 break; |
| 683 case SchedulerStateMachine::ACTION_COMMIT: | 683 case SchedulerStateMachine::Action::COMMIT: |
| 684 client_->ScheduledActionCommit(); | 684 client_->ScheduledActionCommit(); |
| 685 break; | 685 break; |
| 686 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: | 686 case SchedulerStateMachine::Action::ACTIVATE_SYNC_TREE: |
| 687 client_->ScheduledActionActivateSyncTree(); | 687 client_->ScheduledActionActivateSyncTree(); |
| 688 break; | 688 break; |
| 689 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: | 689 case SchedulerStateMachine::Action::DRAW_AND_SWAP_IF_POSSIBLE: |
| 690 DrawAndSwapIfPossible(); | 690 DrawAndSwapIfPossible(); |
| 691 break; | 691 break; |
| 692 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: | 692 case SchedulerStateMachine::Action::DRAW_AND_SWAP_FORCED: |
| 693 client_->ScheduledActionDrawAndSwapForced(); | 693 client_->ScheduledActionDrawAndSwapForced(); |
| 694 break; | 694 break; |
| 695 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: | 695 case SchedulerStateMachine::Action::DRAW_AND_SWAP_ABORT: |
| 696 // No action is actually performed, but this allows the state machine to | 696 // No action is actually performed, but this allows the state machine to |
| 697 // advance out of its waiting to draw state without actually drawing. | 697 // advance out of its waiting to draw state without actually drawing. |
| 698 break; | 698 break; |
| 699 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 699 case SchedulerStateMachine::Action::BEGIN_OUTPUT_SURFACE_CREATION: |
| 700 client_->ScheduledActionBeginOutputSurfaceCreation(); | 700 client_->ScheduledActionBeginOutputSurfaceCreation(); |
| 701 break; | 701 break; |
| 702 case SchedulerStateMachine::ACTION_PREPARE_TILES: | 702 case SchedulerStateMachine::Action::PREPARE_TILES: |
| 703 client_->ScheduledActionPrepareTiles(); | 703 client_->ScheduledActionPrepareTiles(); |
| 704 break; | 704 break; |
| 705 } | 705 } |
| 706 } while (action != SchedulerStateMachine::ACTION_NONE); | 706 } while (action != SchedulerStateMachine::Action::NONE); |
| 707 | 707 |
| 708 SetupNextBeginFrameIfNeeded(); | 708 SetupNextBeginFrameIfNeeded(); |
| 709 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 709 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
| 710 | 710 |
| 711 RescheduleBeginImplFrameDeadlineIfNeeded(); | 711 RescheduleBeginImplFrameDeadlineIfNeeded(); |
| 712 } | 712 } |
| 713 | 713 |
| 714 scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue() | 714 scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue() |
| 715 const { | 715 const { |
| 716 scoped_refptr<base::debug::TracedValue> state = | 716 scoped_refptr<base::debug::TracedValue> state = |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 "time_left_after_drawing_ms", | 783 "time_left_after_drawing_ms", |
| 784 (begin_impl_frame_args_.deadline - estimated_draw_time).InMillisecondsF(), | 784 (begin_impl_frame_args_.deadline - estimated_draw_time).InMillisecondsF(), |
| 785 "state", | 785 "state", |
| 786 AsValue()); | 786 AsValue()); |
| 787 | 787 |
| 788 return estimated_draw_time < begin_impl_frame_args_.deadline; | 788 return estimated_draw_time < begin_impl_frame_args_.deadline; |
| 789 } | 789 } |
| 790 | 790 |
| 791 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 791 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 792 return (state_machine_.commit_state() == | 792 return (state_machine_.commit_state() == |
| 793 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 793 SchedulerStateMachine::CommitState::BEGIN_MAIN_FRAME_SENT || |
| 794 state_machine_.commit_state() == | 794 state_machine_.commit_state() == |
| 795 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 795 SchedulerStateMachine::CommitState::BEGIN_MAIN_FRAME_STARTED); |
| 796 } | 796 } |
| 797 | 797 |
| 798 } // namespace cc | 798 } // namespace cc |
| OLD | NEW |