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/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 469 |
470 // We do not need commits if we are not visible, unless there's a | 470 // We do not need commits if we are not visible, unless there's a |
471 // request for a readback. | 471 // request for a readback. |
472 if (!visible_) | 472 if (!visible_) |
473 return false; | 473 return false; |
474 | 474 |
475 // We want to start the first commit after we get a new output surface ASAP. | 475 // We want to start the first commit after we get a new output surface ASAP. |
476 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) | 476 if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT) |
477 return true; | 477 return true; |
478 | 478 |
479 // With deadline scheduling enabled, we should not send BeginMainFrame while | 479 // We should not send BeginMainFrame while we are in |
480 // we are in BEGIN_IMPL_FRAME_STATE_IDLE, since we might have new user input | 480 // BEGIN_IMPL_FRAME_STATE_IDLE since we might have new |
481 // coming in soon. | 481 // user input arriving soon. |
482 // However, if we are not expecting a BeginImplFrame to take us out of idle, | |
483 // we should not early out here to avoid blocking commits forever. | |
484 // This only works well when deadline scheduling is enabled because there is | |
485 // an interval over which to accept the commit and draw. Without deadline | |
486 // scheduling, delaying the commit could prevent us from having something | |
487 // to draw on the next BeginImplFrame. | |
488 // TODO(brianderson): Allow sending BeginMainFrame while idle when the main | 482 // TODO(brianderson): Allow sending BeginMainFrame while idle when the main |
489 // thread isn't consuming user input. | 483 // thread isn't consuming user input. |
490 if (settings_.deadline_scheduling_enabled && | 484 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE && |
491 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE && | |
492 BeginImplFrameNeeded()) | 485 BeginImplFrameNeeded()) |
493 return false; | 486 return false; |
494 | 487 |
495 // We need a new commit for the forced redraw. This honors the | 488 // We need a new commit for the forced redraw. This honors the |
496 // single commit per interval because the result will be swapped to screen. | 489 // single commit per interval because the result will be swapped to screen. |
497 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) | 490 if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) |
498 return true; | 491 return true; |
499 | 492 |
500 // After this point, we only start a commit once per frame. | 493 // After this point, we only start a commit once per frame. |
501 if (HasSentBeginMainFrameThisFrame()) | 494 if (HasSentBeginMainFrameThisFrame()) |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 case OUTPUT_SURFACE_ACTIVE: | 1150 case OUTPUT_SURFACE_ACTIVE: |
1158 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1151 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
1159 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1152 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
1160 return true; | 1153 return true; |
1161 } | 1154 } |
1162 NOTREACHED(); | 1155 NOTREACHED(); |
1163 return false; | 1156 return false; |
1164 } | 1157 } |
1165 | 1158 |
1166 } // namespace cc | 1159 } // namespace cc |
OLD | NEW |