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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // We only want to start output surface initialization after the | 298 // We only want to start output surface initialization after the |
299 // previous commit is complete. | 299 // previous commit is complete. |
300 if (commit_state_ != COMMIT_STATE_IDLE) | 300 if (commit_state_ != COMMIT_STATE_IDLE) |
301 return false; | 301 return false; |
302 | 302 |
303 // Make sure the BeginImplFrame from any previous OutputSurfaces | 303 // Make sure the BeginImplFrame from any previous OutputSurfaces |
304 // are complete before creating the new OutputSurface. | 304 // are complete before creating the new OutputSurface. |
305 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE) | 305 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE) |
306 return false; | 306 return false; |
307 | 307 |
308 // We want to clear the pipline of any pending draws and activations | 308 // We want to clear the pipeline of any pending draws and activations |
309 // before starting output surface initialization. This allows us to avoid | 309 // before starting output surface initialization. This allows us to avoid |
310 // weird corner cases where we abort draws or force activation while we | 310 // weird corner cases where we abort draws or force activation while we |
311 // are initializing the output surface. | 311 // are initializing the output surface. |
312 if (active_tree_needs_first_draw_ || has_pending_tree_) | 312 if (active_tree_needs_first_draw_ || has_pending_tree_) |
313 return false; | 313 return false; |
314 | 314 |
315 // We need to create the output surface if we don't have one and we haven't | 315 // We need to create the output surface if we don't have one and we haven't |
316 // started creating one yet. | 316 // started creating one yet. |
317 return output_surface_state_ == OUTPUT_SURFACE_LOST; | 317 return output_surface_state_ == OUTPUT_SURFACE_LOST; |
318 } | 318 } |
319 | 319 |
320 bool SchedulerStateMachine::ShouldDraw() const { | 320 bool SchedulerStateMachine::ShouldDraw() const { |
321 // If we need to abort draws, we should do so ASAP since the draw could | 321 // If we need to abort draws, we should do so ASAP since the draw could |
322 // be blocking other important actions (like output surface initialization), | 322 // be blocking other important actions (like output surface initialization), |
323 // from occuring. If we are waiting for the first draw, then perfom the | 323 // from occurring. If we are waiting for the first draw, then perform the |
324 // aborted draw to keep things moving. If we are not waiting for the first | 324 // aborted draw to keep things moving. If we are not waiting for the first |
325 // draw however, we don't want to abort for no reason. | 325 // draw however, we don't want to abort for no reason. |
326 if (PendingDrawsShouldBeAborted()) | 326 if (PendingDrawsShouldBeAborted()) |
327 return active_tree_needs_first_draw_; | 327 return active_tree_needs_first_draw_; |
328 | 328 |
329 // Do not draw too many times in a single frame. It's okay that we don't check | 329 // Do not draw too many times in a single frame. It's okay that we don't check |
330 // this before checking for aborted draws because aborted draws do not request | 330 // this before checking for aborted draws because aborted draws do not request |
331 // a swap. | 331 // a swap. |
332 if (request_swap_funnel_) | 332 if (request_swap_funnel_) |
333 return false; | 333 return false; |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 static_cast<int>(begin_impl_frame_state_), | 1139 static_cast<int>(begin_impl_frame_state_), |
1140 static_cast<int>(commit_state_), | 1140 static_cast<int>(commit_state_), |
1141 has_pending_tree_ ? 'T' : 'F', | 1141 has_pending_tree_ ? 'T' : 'F', |
1142 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1142 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
1143 active_tree_needs_first_draw_ ? 'T' : 'F', | 1143 active_tree_needs_first_draw_ ? 'T' : 'F', |
1144 max_pending_swaps_, | 1144 max_pending_swaps_, |
1145 pending_swaps_); | 1145 pending_swaps_); |
1146 } | 1146 } |
1147 | 1147 |
1148 } // namespace cc | 1148 } // namespace cc |
OLD | NEW |