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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 output_surface_state_ = OUTPUT_SURFACE_LOST; | 423 output_surface_state_ = OUTPUT_SURFACE_LOST; |
424 } | 424 } |
425 | 425 |
426 void SchedulerStateMachine::SetHasPendingTree(bool has_pending_tree) { | 426 void SchedulerStateMachine::SetHasPendingTree(bool has_pending_tree) { |
427 has_pending_tree_ = has_pending_tree; | 427 has_pending_tree_ = has_pending_tree; |
428 } | 428 } |
429 | 429 |
430 void SchedulerStateMachine::SetCanDraw(bool can) { can_draw_ = can; } | 430 void SchedulerStateMachine::SetCanDraw(bool can) { can_draw_ = can; } |
431 | 431 |
432 void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() { | 432 void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() { |
433 DCHECK_EQ(output_surface_state_, OUTPUT_SURFACE_CREATING); | 433 DCHECK(output_surface_state_ == OUTPUT_SURFACE_CREATING || |
434 output_surface_state_ == OUTPUT_SURFACE_ACTIVE); | |
435 | |
436 // This can be called from LayerTreeHost::DeferredInitialize while an output | |
danakj
2013/06/05 21:53:32
Pretty sure LTH isn't calling the scheduler :)
| |
437 // surface is already active. | |
danakj
2013/06/05 21:53:32
nit: double space
| |
438 if (output_surface_state_ == OUTPUT_SURFACE_ACTIVE) | |
439 return; | |
440 | |
434 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; | 441 output_surface_state_ = OUTPUT_SURFACE_ACTIVE; |
435 | 442 |
436 if (did_create_and_initialize_first_output_surface_) { | 443 if (did_create_and_initialize_first_output_surface_) { |
437 // TODO(boliu): See if we can remove this when impl-side painting is always | 444 // TODO(boliu): See if we can remove this when impl-side painting is always |
438 // on. Does anything on the main thread need to update after recreate? | 445 // on. Does anything on the main thread need to update after recreate? |
439 needs_commit_ = true; | 446 needs_commit_ = true; |
440 // If anything has requested a redraw, we don't want to actually draw | 447 // If anything has requested a redraw, we don't want to actually draw |
441 // when the output surface is restored until things have a chance to | 448 // when the output surface is restored until things have a chance to |
442 // sort themselves out with a commit. | 449 // sort themselves out with a commit. |
443 needs_redraw_ = false; | 450 needs_redraw_ = false; |
444 } | 451 } |
445 did_create_and_initialize_first_output_surface_ = true; | 452 did_create_and_initialize_first_output_surface_ = true; |
446 } | 453 } |
447 | 454 |
448 bool SchedulerStateMachine::HasInitializedOutputSurface() const { | 455 bool SchedulerStateMachine::HasInitializedOutputSurface() const { |
449 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 456 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
450 } | 457 } |
451 | 458 |
452 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( | 459 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( |
453 int num_draws) { | 460 int num_draws) { |
454 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; | 461 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; |
455 } | 462 } |
456 | 463 |
457 } // namespace cc | 464 } // namespace cc |
OLD | NEW |