| 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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 DCHECK(!send_begin_main_frame_funnel_); | 686 DCHECK(!send_begin_main_frame_funnel_); |
| 687 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_SENT; | 687 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_SENT; |
| 688 needs_begin_main_frame_ = false; | 688 needs_begin_main_frame_ = false; |
| 689 send_begin_main_frame_funnel_ = true; | 689 send_begin_main_frame_funnel_ = true; |
| 690 last_frame_number_begin_main_frame_sent_ = current_frame_number_; | 690 last_frame_number_begin_main_frame_sent_ = current_frame_number_; |
| 691 last_begin_frame_sequence_number_begin_main_frame_sent_ = | 691 last_begin_frame_sequence_number_begin_main_frame_sent_ = |
| 692 begin_frame_sequence_number_; | 692 begin_frame_sequence_number_; |
| 693 } | 693 } |
| 694 | 694 |
| 695 void SchedulerStateMachine::WillCommit(bool commit_has_no_updates) { | 695 void SchedulerStateMachine::WillCommit(bool commit_has_no_updates) { |
| 696 DCHECK(!has_pending_tree_ || | 696 bool can_have_pending_tree = |
| 697 (settings_.main_frame_before_activation_enabled && | 697 commit_has_no_updates && |
| 698 commit_has_no_updates)); | 698 (settings_.main_frame_before_activation_enabled || |
| 699 current_pending_tree_is_impl_side_); |
| 700 DCHECK(!has_pending_tree_ || can_have_pending_tree); |
| 699 commit_count_++; | 701 commit_count_++; |
| 700 last_commit_had_no_updates_ = commit_has_no_updates; | 702 last_commit_had_no_updates_ = commit_has_no_updates; |
| 701 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; | 703 begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; |
| 702 | 704 |
| 703 if (commit_has_no_updates) { | 705 if (commit_has_no_updates) { |
| 704 // Pending tree might still exist from prior commit. | 706 // Pending tree might still exist from prior commit. |
| 705 if (has_pending_tree_) { | 707 if (has_pending_tree_) { |
| 706 DCHECK(settings_.main_frame_before_activation_enabled); | 708 DCHECK(can_have_pending_tree); |
| 707 last_begin_frame_sequence_number_pending_tree_was_fresh_ = | 709 last_begin_frame_sequence_number_pending_tree_was_fresh_ = |
| 708 last_begin_frame_sequence_number_begin_main_frame_sent_; | 710 last_begin_frame_sequence_number_begin_main_frame_sent_; |
| 709 } else { | 711 } else { |
| 710 if (last_begin_frame_sequence_number_compositor_frame_was_fresh_ == | 712 if (last_begin_frame_sequence_number_compositor_frame_was_fresh_ == |
| 711 last_begin_frame_sequence_number_active_tree_was_fresh_) { | 713 last_begin_frame_sequence_number_active_tree_was_fresh_) { |
| 712 // Assuming that SetNeedsRedraw() is only called at the beginning of | 714 // Assuming that SetNeedsRedraw() is only called at the beginning of |
| 713 // a BeginFrame, we can update the compositor frame freshness. | 715 // a BeginFrame, we can update the compositor frame freshness. |
| 714 last_begin_frame_sequence_number_compositor_frame_was_fresh_ = | 716 last_begin_frame_sequence_number_compositor_frame_was_fresh_ = |
| 715 last_begin_frame_sequence_number_begin_main_frame_sent_; | 717 last_begin_frame_sequence_number_begin_main_frame_sent_; |
| 716 } | 718 } |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 case COMPOSITOR_FRAME_SINK_ACTIVE: | 1335 case COMPOSITOR_FRAME_SINK_ACTIVE: |
| 1334 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: | 1336 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: |
| 1335 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: | 1337 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: |
| 1336 return true; | 1338 return true; |
| 1337 } | 1339 } |
| 1338 NOTREACHED(); | 1340 NOTREACHED(); |
| 1339 return false; | 1341 return false; |
| 1340 } | 1342 } |
| 1341 | 1343 |
| 1342 } // namespace cc | 1344 } // namespace cc |
| OLD | NEW |