| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() { | 328 void SchedulerStateMachine::SetMainThreadNeedsLayerTextures() { |
| 329 DCHECK(!main_thread_needs_layer_textures_); | 329 DCHECK(!main_thread_needs_layer_textures_); |
| 330 DCHECK_NE(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); | 330 DCHECK_NE(texture_state_, LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); |
| 331 main_thread_needs_layer_textures_ = true; | 331 main_thread_needs_layer_textures_ = true; |
| 332 } | 332 } |
| 333 | 333 |
| 334 bool SchedulerStateMachine::BeginFrameNeededByImplThread() const { | 334 bool SchedulerStateMachine::BeginFrameNeededByImplThread() const { |
| 335 // We should proactively request a BeginFrame if a commit is pending. |
| 336 if (needs_commit_ || needs_forced_commit_ || |
| 337 commit_state_ != COMMIT_STATE_IDLE) |
| 338 return true; |
| 339 |
| 335 // If we have a pending tree, need to keep getting notifications until | 340 // If we have a pending tree, need to keep getting notifications until |
| 336 // the tree is ready to be swapped. | 341 // the tree is ready to be swapped. |
| 337 if (has_pending_tree_) | 342 if (has_pending_tree_) |
| 338 return true; | 343 return true; |
| 339 | 344 |
| 340 // If we can't draw, don't tick until we are notified that we can draw again. | 345 // If we can't draw, don't tick until we are notified that we can draw again. |
| 341 if (!can_draw_) | 346 if (!can_draw_) |
| 342 return false; | 347 return false; |
| 343 | 348 |
| 344 if (needs_forced_redraw_) | 349 if (needs_forced_redraw_) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 bool SchedulerStateMachine::HasInitializedOutputSurface() const { | 453 bool SchedulerStateMachine::HasInitializedOutputSurface() const { |
| 449 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 454 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
| 450 } | 455 } |
| 451 | 456 |
| 452 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( | 457 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( |
| 453 int num_draws) { | 458 int num_draws) { |
| 454 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; | 459 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; |
| 455 } | 460 } |
| 456 | 461 |
| 457 } // namespace cc | 462 } // namespace cc |
| OLD | NEW |