Chromium Code Reviews| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/debug/trace_event_argument.h" | 8 #include "base/debug/trace_event_argument.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 // activation of the pending tree is blocked by drawing of the active tree and | 279 // activation of the pending tree is blocked by drawing of the active tree and |
| 280 // the main thread might be blocked on activation of the most recent commit. | 280 // the main thread might be blocked on activation of the most recent commit. |
| 281 if (PendingActivationsShouldBeForced()) | 281 if (PendingActivationsShouldBeForced()) |
| 282 return true; | 282 return true; |
| 283 | 283 |
| 284 // Additional states where we should abort draws. | 284 // Additional states where we should abort draws. |
| 285 // Note: We don't force activation in these cases because doing so would | 285 // Note: We don't force activation in these cases because doing so would |
| 286 // result in checkerboarding on resize, becoming visible, etc. | 286 // result in checkerboarding on resize, becoming visible, etc. |
| 287 if (!can_draw_) | 287 if (!can_draw_) |
| 288 return true; | 288 return true; |
| 289 if (!visible_) | 289 if (!visible_) |
|
brianderson
2014/09/25 18:47:29
This can be deleted and the comment above should b
vmpstr
2014/09/25 19:42:12
Done.
| |
| 290 return true; | 290 return true; |
| 291 return false; | 291 return false; |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const { | 294 bool SchedulerStateMachine::PendingActivationsShouldBeForced() const { |
| 295 // These are all the cases where, if we do not force activations to make | 295 // These are all the cases where, if we do not force activations to make |
| 296 // forward progress, we might deadlock with the main thread. | 296 // forward progress, we might deadlock with the main thread. |
| 297 | 297 |
| 298 // There is no output surface to trigger our activations. | 298 // There is no output surface to trigger our activations. |
| 299 if (output_surface_state_ == OUTPUT_SURFACE_LOST) | 299 if (output_surface_state_ == OUTPUT_SURFACE_LOST) |
| 300 return true; | 300 return true; |
| 301 | 301 |
| 302 // If we're not visible, we should force activation. | |
|
brianderson
2014/09/25 18:47:29
Can you explain the whole checkerboarding issue?
vmpstr
2014/09/25 19:42:12
Done.
| |
| 303 if (!visible_) | |
| 304 return true; | |
| 305 | |
| 302 return false; | 306 return false; |
| 303 } | 307 } |
| 304 | 308 |
| 305 bool SchedulerStateMachine::ShouldBeginOutputSurfaceCreation() const { | 309 bool SchedulerStateMachine::ShouldBeginOutputSurfaceCreation() const { |
| 306 // Don't try to initialize too early. | 310 // Don't try to initialize too early. |
| 307 if (!can_start_) | 311 if (!can_start_) |
| 308 return false; | 312 return false; |
| 309 | 313 |
| 310 // We only want to start output surface initialization after the | 314 // We only want to start output surface initialization after the |
| 311 // previous commit is complete. | 315 // previous commit is complete. |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1094 static_cast<int>(begin_impl_frame_state_), | 1098 static_cast<int>(begin_impl_frame_state_), |
| 1095 static_cast<int>(commit_state_), | 1099 static_cast<int>(commit_state_), |
| 1096 has_pending_tree_ ? 'T' : 'F', | 1100 has_pending_tree_ ? 'T' : 'F', |
| 1097 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1101 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
| 1098 active_tree_needs_first_draw_ ? 'T' : 'F', | 1102 active_tree_needs_first_draw_ ? 'T' : 'F', |
| 1099 max_pending_swaps_, | 1103 max_pending_swaps_, |
| 1100 pending_swaps_); | 1104 pending_swaps_); |
| 1101 } | 1105 } |
| 1102 | 1106 |
| 1103 } // namespace cc | 1107 } // namespace cc |
| OLD | NEW |