| 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 | 10 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return true; | 357 return true; |
| 358 | 358 |
| 359 if (visible_ && swap_used_incomplete_tile_) | 359 if (visible_ && swap_used_incomplete_tile_) |
| 360 return true; | 360 return true; |
| 361 | 361 |
| 362 return needs_redraw_ && visible_ && | 362 return needs_redraw_ && visible_ && |
| 363 output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 363 output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
| 364 } | 364 } |
| 365 | 365 |
| 366 bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const { | 366 bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const { |
| 367 // Do not be proactive when invisible. |
| 368 if (!visible_ || output_surface_state_ != OUTPUT_SURFACE_ACTIVE) |
| 369 return false; |
| 370 |
| 367 // We should proactively request a BeginFrame if a commit is pending. | 371 // We should proactively request a BeginFrame if a commit is pending. |
| 368 if (needs_commit_ || needs_forced_commit_ || | 372 return (needs_commit_ || needs_forced_commit_ || |
| 369 commit_state_ != COMMIT_STATE_IDLE) | 373 commit_state_ != COMMIT_STATE_IDLE); |
| 370 return true; | |
| 371 | |
| 372 return false; | |
| 373 } | 374 } |
| 374 | 375 |
| 375 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) { | 376 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) { |
| 376 inside_begin_frame_ = true; | 377 inside_begin_frame_ = true; |
| 377 last_begin_frame_args_ = args; | 378 last_begin_frame_args_ = args; |
| 378 } | 379 } |
| 379 | 380 |
| 380 void SchedulerStateMachine::DidLeaveBeginFrame() { | 381 void SchedulerStateMachine::DidLeaveBeginFrame() { |
| 381 current_frame_number_++; | 382 current_frame_number_++; |
| 382 inside_begin_frame_ = false; | 383 inside_begin_frame_ = false; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 bool SchedulerStateMachine::HasInitializedOutputSurface() const { | 471 bool SchedulerStateMachine::HasInitializedOutputSurface() const { |
| 471 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 472 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
| 472 } | 473 } |
| 473 | 474 |
| 474 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( | 475 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( |
| 475 int num_draws) { | 476 int num_draws) { |
| 476 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; | 477 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; |
| 477 } | 478 } |
| 478 | 479 |
| 479 } // namespace cc | 480 } // namespace cc |
| OLD | NEW |