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_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 } | 76 } |
| 77 | 77 |
| 78 const char* SchedulerStateMachine::CommitStateToString(CommitState state) { | 78 const char* SchedulerStateMachine::CommitStateToString(CommitState state) { |
| 79 switch (state) { | 79 switch (state) { |
| 80 case COMMIT_STATE_IDLE: | 80 case COMMIT_STATE_IDLE: |
| 81 return "COMMIT_STATE_IDLE"; | 81 return "COMMIT_STATE_IDLE"; |
| 82 case COMMIT_STATE_FRAME_IN_PROGRESS: | 82 case COMMIT_STATE_FRAME_IN_PROGRESS: |
| 83 return "COMMIT_STATE_FRAME_IN_PROGRESS"; | 83 return "COMMIT_STATE_FRAME_IN_PROGRESS"; |
| 84 case COMMIT_STATE_READY_TO_COMMIT: | 84 case COMMIT_STATE_READY_TO_COMMIT: |
| 85 return "COMMIT_STATE_READY_TO_COMMIT"; | 85 return "COMMIT_STATE_READY_TO_COMMIT"; |
| 86 case COMMIT_STATE_WAITING_FOR_FIRST_DRAW: | |
| 87 return "COMMIT_STATE_WAITING_FOR_FIRST_DRAW"; | |
| 88 } | 86 } |
| 89 NOTREACHED(); | 87 NOTREACHED(); |
| 90 return "???"; | 88 return "???"; |
| 91 } | 89 } |
| 92 | 90 |
| 93 const char* SchedulerStateMachine::TextureStateToString(TextureState state) { | 91 const char* SchedulerStateMachine::TextureStateToString(TextureState state) { |
| 94 switch (state) { | 92 switch (state) { |
| 95 case LAYER_TEXTURE_STATE_UNLOCKED: | 93 case LAYER_TEXTURE_STATE_UNLOCKED: |
| 96 return "LAYER_TEXTURE_STATE_UNLOCKED"; | 94 return "LAYER_TEXTURE_STATE_UNLOCKED"; |
| 97 case LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD: | 95 case LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD: |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 if (HasDrawnThisDrawAttempt()) | 342 if (HasDrawnThisDrawAttempt()) |
| 345 return false; | 343 return false; |
| 346 | 344 |
| 347 // After a readback, make sure not to draw again until we've replaced the | 345 // After a readback, make sure not to draw again until we've replaced the |
| 348 // readback commit with a real one. | 346 // readback commit with a real one. |
| 349 if (readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT || | 347 if (readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT || |
| 350 readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) | 348 readback_state_ == READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) |
| 351 return false; | 349 return false; |
| 352 | 350 |
| 353 // Draw immediately for readbacks to unblock the main thread quickly. | 351 // Draw immediately for readbacks to unblock the main thread quickly. |
| 354 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) { | 352 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) |
| 355 DCHECK_EQ(commit_state_, COMMIT_STATE_WAITING_FOR_FIRST_DRAW); | |
|
danakj
2013/09/17 17:05:07
Should we DCHECK(active_tree_waiting_for_first_dra
brianderson
2013/10/03 14:44:38
Yes, that would be a good DCHECK to add.
| |
| 356 return true; | 353 return true; |
| 357 } | |
| 358 | 354 |
| 359 // If we need to abort draws, we should do so ASAP since the draw could | 355 // If we need to abort draws, we should do so ASAP since the draw could |
| 360 // be blocking other important actions (like output surface initialization), | 356 // be blocking other important actions (like output surface initialization), |
| 361 // from occuring. If we are waiting for the first draw, then perfom the | 357 // from occuring. If we are waiting for the first draw, then perfom the |
| 362 // aborted draw to keep things moving. If we are not waiting for the first | 358 // aborted draw to keep things moving. If we are not waiting for the first |
| 363 // draw however, we don't want to abort for no reason. | 359 // draw however, we don't want to abort for no reason. |
| 364 if (PendingDrawsShouldBeAborted()) | 360 if (PendingDrawsShouldBeAborted()) |
| 365 return active_tree_needs_first_draw_; | 361 return active_tree_needs_first_draw_; |
| 366 | 362 |
| 367 // After this line, we only want to swap once per frame. | 363 // After this line, we only want to swap once per frame. |
| 368 if (HasSwappedThisFrame()) | 364 if (HasSwappedThisFrame()) |
| 369 return false; | 365 return false; |
| 370 | 366 |
| 371 // Except for the cases above, do not draw outside of the BeginFrame deadline. | 367 // Except for the cases above, do not draw outside of the BeginFrame deadline. |
| 372 if (begin_frame_state_ != BEGIN_FRAME_STATE_INSIDE_DEADLINE) | 368 if (begin_frame_state_ != BEGIN_FRAME_STATE_INSIDE_DEADLINE) |
| 373 return false; | 369 return false; |
| 374 | 370 |
| 375 // Only handle forced redraws due to timeouts on the regular deadline. | 371 // Only handle forced redraws due to timeouts on the regular deadline. |
| 376 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) { | 372 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
| 377 DCHECK_EQ(commit_state_, COMMIT_STATE_WAITING_FOR_FIRST_DRAW); | |
|
danakj
2013/09/17 17:05:07
Should we DCHECK(active_tree_waiting_for_first_dra
| |
| 378 return true; | 373 return true; |
| 379 } | |
| 380 | 374 |
| 381 return needs_redraw_; | 375 return needs_redraw_; |
| 382 } | 376 } |
| 383 | 377 |
| 384 bool SchedulerStateMachine::ShouldAcquireLayerTexturesForMainThread() const { | 378 bool SchedulerStateMachine::ShouldAcquireLayerTexturesForMainThread() const { |
| 385 if (!main_thread_needs_layer_textures_) | 379 if (!main_thread_needs_layer_textures_) |
| 386 return false; | 380 return false; |
| 387 if (texture_state_ == LAYER_TEXTURE_STATE_UNLOCKED) | 381 if (texture_state_ == LAYER_TEXTURE_STATE_UNLOCKED) |
| 388 return true; | 382 return true; |
| 389 DCHECK_EQ(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD); | 383 DCHECK_EQ(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 } | 430 } |
| 437 | 431 |
| 438 bool SchedulerStateMachine::ShouldSendBeginFrameToMainThread() const { | 432 bool SchedulerStateMachine::ShouldSendBeginFrameToMainThread() const { |
| 439 if (!needs_commit_) | 433 if (!needs_commit_) |
| 440 return false; | 434 return false; |
| 441 | 435 |
| 442 // Only send BeginFrame to the main thread when idle. | 436 // Only send BeginFrame to the main thread when idle. |
| 443 if (commit_state_ != COMMIT_STATE_IDLE) | 437 if (commit_state_ != COMMIT_STATE_IDLE) |
| 444 return false; | 438 return false; |
| 445 | 439 |
| 446 // We can't accept a commit if we have a pending tree. | 440 // Starting the commit while we still have a pending tree will block the |
| 447 if (has_pending_tree_) | 441 // main thread until the pending tree activates. |
| 442 if (has_pending_tree_ && | |
| 443 !settings_.start_commit_before_activate_enabled) | |
| 444 return false; | |
| 445 | |
| 446 // If we are not impl-side-painting, starting the commit before the active | |
| 447 // tree has drawn will block the main thread until the first draw occurs. | |
| 448 // If we are impl-side-painting however, we will not block the main thread | |
| 449 // by starting the commit before the active tree has drawn since the pending | |
| 450 // tree is free to accept the commit. | |
| 451 if (active_tree_needs_first_draw_ && | |
|
Sami
2013/10/03 13:31:11
It's a little hard to see how this condition relat
brianderson
2013/10/03 14:44:38
The decision to be made here is the same regardles
| |
| 452 !settings_.start_commit_before_draw_enabled) | |
| 448 return false; | 453 return false; |
| 449 | 454 |
| 450 // We want to handle readback commits immediately to unblock the main thread. | 455 // We want to handle readback commits immediately to unblock the main thread. |
| 451 // Note: This BeginFrame will correspond to the replacement commit that comes | 456 // Note: This BeginFrame will correspond to the replacement commit that comes |
| 452 // after the readback commit itself, so we only send the BeginFrame if a | 457 // after the readback commit itself, so we only send the BeginFrame if a |
| 453 // commit isn't already pending behind the readback. | 458 // commit isn't already pending behind the readback. |
| 454 if (readback_state_ == READBACK_STATE_NEEDS_BEGIN_FRAME) | 459 if (readback_state_ == READBACK_STATE_NEEDS_BEGIN_FRAME) |
| 455 return !CommitPending(); | 460 return !CommitPending(); |
| 456 | 461 |
| 457 // We do not need commits if we are not visible, unless there's a | 462 // We do not need commits if we are not visible, unless there's a |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 483 return true; | 488 return true; |
| 484 | 489 |
| 485 // After this point, we only start a commit once per frame. | 490 // After this point, we only start a commit once per frame. |
| 486 if (HasSentBeginFrameToMainThreadThisFrame()) | 491 if (HasSentBeginFrameToMainThreadThisFrame()) |
| 487 return false; | 492 return false; |
| 488 | 493 |
| 489 return true; | 494 return true; |
| 490 } | 495 } |
| 491 | 496 |
| 492 bool SchedulerStateMachine::ShouldCommit() const { | 497 bool SchedulerStateMachine::ShouldCommit() const { |
| 493 return commit_state_ == COMMIT_STATE_READY_TO_COMMIT; | 498 if (commit_state_ != COMMIT_STATE_READY_TO_COMMIT) |
| 499 return false; | |
| 500 | |
| 501 // We must not finish the commit until the pending tree is free. | |
| 502 if (has_pending_tree_) { | |
| 503 DCHECK(settings_.start_commit_before_activate_enabled); | |
| 504 return false; | |
| 505 } | |
| 506 | |
| 507 // If not impl-side-painting, we must not finish the commit until the | |
| 508 // previous commit has been drawn. | |
| 509 if (active_tree_needs_first_draw_ && !settings_.impl_side_painting) { | |
| 510 DCHECK(settings_.start_commit_before_draw_enabled); | |
| 511 return false; | |
| 512 } | |
| 513 | |
| 514 return true; | |
| 494 } | 515 } |
| 495 | 516 |
| 496 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const { | 517 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const { |
| 497 if (ShouldAcquireLayerTexturesForMainThread()) | 518 if (ShouldAcquireLayerTexturesForMainThread()) |
| 498 return ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD; | 519 return ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD; |
| 499 if (ShouldUpdateVisibleTiles()) | 520 if (ShouldUpdateVisibleTiles()) |
| 500 return ACTION_UPDATE_VISIBLE_TILES; | 521 return ACTION_UPDATE_VISIBLE_TILES; |
| 501 if (ShouldActivatePendingTree()) | 522 if (ShouldActivatePendingTree()) |
| 502 return ACTION_ACTIVATE_PENDING_TREE; | 523 return ACTION_ACTIVATE_PENDING_TREE; |
| 503 if (ShouldCommit()) | 524 if (ShouldCommit()) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 534 case ACTION_UPDATE_VISIBLE_TILES: | 555 case ACTION_UPDATE_VISIBLE_TILES: |
| 535 last_draw_attempt_count_update_visible_tiles_was_called_ = | 556 last_draw_attempt_count_update_visible_tiles_was_called_ = |
| 536 draw_attempt_count_; | 557 draw_attempt_count_; |
| 537 return; | 558 return; |
| 538 | 559 |
| 539 case ACTION_ACTIVATE_PENDING_TREE: | 560 case ACTION_ACTIVATE_PENDING_TREE: |
| 540 UpdateStateOnActivation(); | 561 UpdateStateOnActivation(); |
| 541 return; | 562 return; |
| 542 | 563 |
| 543 case ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: | 564 case ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: |
| 544 DCHECK(!has_pending_tree_); | 565 DCHECK(!has_pending_tree_ || |
| 566 settings_.start_commit_before_activate_enabled); | |
| 567 DCHECK(!active_tree_needs_first_draw_ || | |
| 568 settings_.start_commit_before_draw_enabled); | |
| 545 DCHECK(visible_ || readback_state_ == READBACK_STATE_NEEDS_BEGIN_FRAME); | 569 DCHECK(visible_ || readback_state_ == READBACK_STATE_NEEDS_BEGIN_FRAME); |
| 546 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS; | 570 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS; |
| 547 needs_commit_ = false; | 571 needs_commit_ = false; |
| 548 if (readback_state_ == READBACK_STATE_NEEDS_BEGIN_FRAME) | 572 if (readback_state_ == READBACK_STATE_NEEDS_BEGIN_FRAME) |
| 549 readback_state_ = READBACK_STATE_WAITING_FOR_COMMIT; | 573 readback_state_ = READBACK_STATE_WAITING_FOR_COMMIT; |
| 550 last_begin_frame_count_begin_frame_sent_to_main_thread_ = | 574 last_begin_frame_count_begin_frame_sent_to_main_thread_ = |
| 551 begin_frame_count_; | 575 begin_frame_count_; |
| 552 return; | 576 return; |
| 553 | 577 |
| 554 case ACTION_COMMIT: { | 578 case ACTION_COMMIT: { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD; | 611 texture_state_ = LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD; |
| 588 main_thread_needs_layer_textures_ = false; | 612 main_thread_needs_layer_textures_ = false; |
| 589 return; | 613 return; |
| 590 } | 614 } |
| 591 } | 615 } |
| 592 | 616 |
| 593 void SchedulerStateMachine::UpdateStateOnCommit(bool commit_was_aborted) { | 617 void SchedulerStateMachine::UpdateStateOnCommit(bool commit_was_aborted) { |
| 594 commit_count_++; | 618 commit_count_++; |
| 595 draw_attempt_count_++; | 619 draw_attempt_count_++; |
| 596 | 620 |
| 621 // Transition directly to idle. | |
| 622 commit_state_ = COMMIT_STATE_IDLE; | |
| 623 | |
| 597 // If we are impl-side-painting but the commit was aborted, then we behave | 624 // If we are impl-side-painting but the commit was aborted, then we behave |
| 598 // mostly as if we are not impl-side-painting since there is no pending tree. | 625 // mostly as if we are not impl-side-painting since there is no pending tree. |
| 599 has_pending_tree_ = settings_.impl_side_painting && !commit_was_aborted; | 626 has_pending_tree_ = settings_.impl_side_painting && !commit_was_aborted; |
| 600 | 627 |
| 601 // Update state related to readbacks. | 628 // Update state related to readbacks. |
| 602 if (readback_state_ == READBACK_STATE_WAITING_FOR_COMMIT) { | 629 if (readback_state_ == READBACK_STATE_WAITING_FOR_COMMIT) { |
| 603 // Update the state if this is the readback commit. | 630 // Update the state if this is the readback commit. |
| 604 readback_state_ = has_pending_tree_ | 631 readback_state_ = has_pending_tree_ |
| 605 ? READBACK_STATE_WAITING_FOR_ACTIVATION | 632 ? READBACK_STATE_WAITING_FOR_ACTIVATION |
| 606 : READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK; | 633 : READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 632 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) { | 659 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) { |
| 633 if (has_pending_tree_) { | 660 if (has_pending_tree_) { |
| 634 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION; | 661 output_surface_state_ = OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION; |
| 635 } else { | 662 } else { |
| 636 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; | 663 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; |
| 637 needs_redraw_ = true; | 664 needs_redraw_ = true; |
| 638 } | 665 } |
| 639 } | 666 } |
| 640 } | 667 } |
| 641 | 668 |
| 642 // Update the commit state. We expect and wait for a draw if the commit | |
| 643 // was not aborted or if we are in a readback or forced draw. | |
| 644 if (!commit_was_aborted) | |
| 645 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; | |
| 646 else if (readback_state_ != READBACK_STATE_IDLE || | |
| 647 forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE) | |
| 648 commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; | |
| 649 else | |
| 650 commit_state_ = COMMIT_STATE_IDLE; | |
| 651 | |
| 652 // Update state if we have a new active tree to draw, or if the active tree | 669 // Update state if we have a new active tree to draw, or if the active tree |
| 653 // was unchanged but we need to do a readback or forced draw. | 670 // was unchanged but we need to do a readback or forced draw. |
| 654 if (!has_pending_tree_ && | 671 if (!has_pending_tree_ && |
| 655 (!commit_was_aborted || | 672 (!commit_was_aborted || |
| 656 readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK || | 673 readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK || |
| 657 forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)) { | 674 forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)) { |
| 658 needs_redraw_ = true; | 675 needs_redraw_ = true; |
| 659 active_tree_needs_first_draw_ = true; | 676 active_tree_needs_first_draw_ = true; |
| 660 } | 677 } |
| 661 | 678 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 needs_redraw_ = true; | 715 needs_redraw_ = true; |
| 699 last_draw_attempt_count_tree_activation_attempted_ = draw_attempt_count_; | 716 last_draw_attempt_count_tree_activation_attempted_ = draw_attempt_count_; |
| 700 } | 717 } |
| 701 | 718 |
| 702 void SchedulerStateMachine::UpdateStateOnDraw(bool did_swap) { | 719 void SchedulerStateMachine::UpdateStateOnDraw(bool did_swap) { |
| 703 DCHECK(readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT && | 720 DCHECK(readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT && |
| 704 readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) | 721 readback_state_ != READBACK_STATE_WAITING_FOR_REPLACEMENT_ACTIVATION) |
| 705 << *AsValue(); | 722 << *AsValue(); |
| 706 | 723 |
| 707 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) { | 724 if (readback_state_ == READBACK_STATE_WAITING_FOR_DRAW_AND_READBACK) { |
| 708 // The draw correspons to a readback commit. | 725 // The draw corresponds to a readback commit. |
| 709 DCHECK_EQ(commit_state_, COMMIT_STATE_WAITING_FOR_FIRST_DRAW); | |
| 710 // We are blocking commits from the main thread until after this draw, so | 726 // We are blocking commits from the main thread until after this draw, so |
| 711 // we should not have a pending tree. | 727 // we should not have a pending tree. |
| 712 DCHECK(!has_pending_tree_); | 728 DCHECK(!has_pending_tree_); |
| 713 // We transition to COMMIT_STATE_FRAME_IN_PROGRESS because there is a | 729 // We transition to COMMIT_STATE_FRAME_IN_PROGRESS because there is a |
| 714 // pending BeginFrame on the main thread behind the readback request. | 730 // pending BeginFrame on the main thread behind the readback request. |
| 715 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS; | 731 commit_state_ = COMMIT_STATE_FRAME_IN_PROGRESS; |
| 716 readback_state_ = READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT; | 732 readback_state_ = READBACK_STATE_WAITING_FOR_REPLACEMENT_COMMIT; |
| 717 } else if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) { | 733 } else if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) { |
| 718 DCHECK_EQ(commit_state_, COMMIT_STATE_WAITING_FOR_FIRST_DRAW); | |
| 719 commit_state_ = COMMIT_STATE_IDLE; | |
| 720 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; | 734 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; |
| 721 } else if (commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW && | |
| 722 !has_pending_tree_) { | |
| 723 commit_state_ = COMMIT_STATE_IDLE; | |
| 724 } | 735 } |
| 725 | 736 |
| 726 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD) | 737 if (texture_state_ == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD) |
| 727 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; | 738 texture_state_ = LAYER_TEXTURE_STATE_UNLOCKED; |
| 728 | 739 |
| 729 needs_redraw_ = false; | 740 needs_redraw_ = false; |
| 730 draw_if_possible_failed_ = false; | 741 draw_if_possible_failed_ = false; |
| 731 active_tree_needs_first_draw_ = false; | 742 active_tree_needs_first_draw_ = false; |
| 732 last_draw_attempt_count_draw_was_called_ = draw_attempt_count_; | 743 last_draw_attempt_count_draw_was_called_ = draw_attempt_count_; |
| 733 | 744 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 898 // behind the readback request. In that case, we can skip | 909 // behind the readback request. In that case, we can skip |
| 899 // READBACK_STATE_NEEDS_BEGIN_FRAME and go directly to | 910 // READBACK_STATE_NEEDS_BEGIN_FRAME and go directly to |
| 900 // READBACK_STATE_WAITING_FOR_COMMIT | 911 // READBACK_STATE_WAITING_FOR_COMMIT |
| 901 if (commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS) | 912 if (commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS) |
| 902 readback_state_ = READBACK_STATE_WAITING_FOR_COMMIT; | 913 readback_state_ = READBACK_STATE_WAITING_FOR_COMMIT; |
| 903 else | 914 else |
| 904 readback_state_ = READBACK_STATE_NEEDS_BEGIN_FRAME; | 915 readback_state_ = READBACK_STATE_NEEDS_BEGIN_FRAME; |
| 905 } | 916 } |
| 906 | 917 |
| 907 void SchedulerStateMachine::FinishCommit() { | 918 void SchedulerStateMachine::FinishCommit() { |
| 908 DCHECK(commit_state_ == COMMIT_STATE_FRAME_IN_PROGRESS) << *AsValue(); | 919 DCHECK(commit_state_ != COMMIT_STATE_IDLE) << *AsValue(); |
| 909 commit_state_ = COMMIT_STATE_READY_TO_COMMIT; | 920 commit_state_ = COMMIT_STATE_READY_TO_COMMIT; |
| 910 } | 921 } |
| 911 | 922 |
| 912 void SchedulerStateMachine::BeginFrameAbortedByMainThread(bool did_handle) { | 923 void SchedulerStateMachine::BeginFrameAbortedByMainThread(bool did_handle) { |
| 913 DCHECK_EQ(commit_state_, COMMIT_STATE_FRAME_IN_PROGRESS); | 924 DCHECK_EQ(commit_state_, COMMIT_STATE_FRAME_IN_PROGRESS); |
| 914 if (did_handle) { | 925 if (did_handle) { |
| 915 bool commit_was_aborted = true; | 926 bool commit_was_aborted = true; |
| 916 UpdateStateOnCommit(commit_was_aborted); | 927 UpdateStateOnCommit(commit_was_aborted); |
| 917 } else { | 928 } else { |
| 918 DCHECK_NE(readback_state_, READBACK_STATE_WAITING_FOR_COMMIT); | 929 DCHECK_NE(readback_state_, READBACK_STATE_WAITING_FOR_COMMIT); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 955 case OUTPUT_SURFACE_ACTIVE: | 966 case OUTPUT_SURFACE_ACTIVE: |
| 956 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 967 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
| 957 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 968 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
| 958 return true; | 969 return true; |
| 959 } | 970 } |
| 960 NOTREACHED(); | 971 NOTREACHED(); |
| 961 return false; | 972 return false; |
| 962 } | 973 } |
| 963 | 974 |
| 964 } // namespace cc | 975 } // namespace cc |
| OLD | NEW |