| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 return false; | 303 return false; |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool SchedulerStateMachine::ShouldBeginCompositorFrameSinkCreation() const { | 306 bool SchedulerStateMachine::ShouldBeginCompositorFrameSinkCreation() const { |
| 307 if (!visible_) | 307 if (!visible_) |
| 308 return false; | 308 return false; |
| 309 | 309 |
| 310 // We only want to start output surface initialization after the | 310 // We only want to start output surface initialization after the |
| 311 // previous commit is complete. | 311 // previous commit is complete. |
| 312 // We make an exception if the embedder explicitly allows beginning output | 312 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE) { |
| 313 // surface creation while the previous commit has not been aborted. This | |
| 314 // assumes that any state passed from the client during the commit will not be | |
| 315 // tied to the output surface. | |
| 316 if (begin_main_frame_state_ != BEGIN_MAIN_FRAME_STATE_IDLE && | |
| 317 settings_.abort_commit_before_compositor_frame_sink_creation) { | |
| 318 return false; | 313 return false; |
| 319 } | 314 } |
| 320 | 315 |
| 321 // Make sure the BeginImplFrame from any previous CompositorFrameSinks | 316 // Make sure the BeginImplFrame from any previous CompositorFrameSinks |
| 322 // are complete before creating the new CompositorFrameSink. | 317 // are complete before creating the new CompositorFrameSink. |
| 323 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE) | 318 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE) |
| 324 return false; | 319 return false; |
| 325 | 320 |
| 326 // We want to clear the pipeline of any pending draws and activations | 321 // We want to clear the pipeline of any pending draws and activations |
| 327 // before starting output surface initialization. This allows us to avoid | 322 // before starting output surface initialization. This allows us to avoid |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 needs_prepare_tiles_ = false; | 701 needs_prepare_tiles_ = false; |
| 707 } | 702 } |
| 708 | 703 |
| 709 void SchedulerStateMachine::WillBeginCompositorFrameSinkCreation() { | 704 void SchedulerStateMachine::WillBeginCompositorFrameSinkCreation() { |
| 710 DCHECK_EQ(compositor_frame_sink_state_, COMPOSITOR_FRAME_SINK_NONE); | 705 DCHECK_EQ(compositor_frame_sink_state_, COMPOSITOR_FRAME_SINK_NONE); |
| 711 compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_CREATING; | 706 compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_CREATING; |
| 712 | 707 |
| 713 // The following DCHECKs make sure we are in the proper quiescent state. | 708 // The following DCHECKs make sure we are in the proper quiescent state. |
| 714 // The pipeline should be flushed entirely before we start output | 709 // The pipeline should be flushed entirely before we start output |
| 715 // surface creation to avoid complicated corner cases. | 710 // surface creation to avoid complicated corner cases. |
| 716 | 711 DCHECK(begin_main_frame_state_ == BEGIN_MAIN_FRAME_STATE_IDLE); |
| 717 // We allow output surface creation while the previous commit has not been | |
| 718 // aborted if the embedder explicitly allows it. | |
| 719 DCHECK(!settings_.abort_commit_before_compositor_frame_sink_creation || | |
| 720 begin_main_frame_state_ == BEGIN_MAIN_FRAME_STATE_IDLE); | |
| 721 DCHECK(!has_pending_tree_); | 712 DCHECK(!has_pending_tree_); |
| 722 DCHECK(!active_tree_needs_first_draw_); | 713 DCHECK(!active_tree_needs_first_draw_); |
| 723 } | 714 } |
| 724 | 715 |
| 725 void SchedulerStateMachine::WillInvalidateCompositorFrameSink() { | 716 void SchedulerStateMachine::WillInvalidateCompositorFrameSink() { |
| 726 DCHECK(!invalidate_compositor_frame_sink_funnel_); | 717 DCHECK(!invalidate_compositor_frame_sink_funnel_); |
| 727 invalidate_compositor_frame_sink_funnel_ = true; | 718 invalidate_compositor_frame_sink_funnel_ = true; |
| 728 last_frame_number_invalidate_compositor_frame_sink_performed_ = | 719 last_frame_number_invalidate_compositor_frame_sink_performed_ = |
| 729 current_frame_number_; | 720 current_frame_number_; |
| 730 | 721 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 case COMPOSITOR_FRAME_SINK_ACTIVE: | 1103 case COMPOSITOR_FRAME_SINK_ACTIVE: |
| 1113 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: | 1104 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: |
| 1114 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: | 1105 case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: |
| 1115 return true; | 1106 return true; |
| 1116 } | 1107 } |
| 1117 NOTREACHED(); | 1108 NOTREACHED(); |
| 1118 return false; | 1109 return false; |
| 1119 } | 1110 } |
| 1120 | 1111 |
| 1121 } // namespace cc | 1112 } // namespace cc |
| OLD | NEW |