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/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 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 // Proactive BeginFrames are bad for the synchronous compositor because we | 716 // Proactive BeginFrames are bad for the synchronous compositor because we |
| 717 // have to draw when we get the BeginFrame and could end up drawing many | 717 // have to draw when we get the BeginFrame and could end up drawing many |
| 718 // duplicate frames if our new frame isn't ready in time. | 718 // duplicate frames if our new frame isn't ready in time. |
| 719 // To poll for state with the synchronous compositor without having to draw, | 719 // To poll for state with the synchronous compositor without having to draw, |
| 720 // we rely on ShouldPollForAnticipatedDrawTriggers instead. | 720 // we rely on ShouldPollForAnticipatedDrawTriggers instead. |
| 721 // Synchronous compositor doesn't have a browser. | 721 // Synchronous compositor doesn't have a browser. |
| 722 DCHECK(!children_need_begin_frames_); | 722 DCHECK(!children_need_begin_frames_); |
| 723 return BeginFrameNeededToAnimateOrDraw(); | 723 return BeginFrameNeededToAnimateOrDraw(); |
| 724 } | 724 } |
| 725 | 725 |
| 726 bool SchedulerStateMachine::ShouldSetNeedsBeginFrames( | 726 bool SchedulerStateMachine::ShouldSetNeedsBeginFrames( |
|
brianderson
2015/03/05 22:51:23
Looks like you can delete this and frame_source_ne
sunnyps
2015/03/06 00:49:04
Done. frame_source_needs_begin_frames is a local v
| |
| 727 bool frame_source_needs_begin_frames) const { | 727 bool frame_source_needs_begin_frames) const { |
| 728 bool needs_begin_frame = BeginFrameNeeded(); | 728 bool needs_begin_frame = BeginFrameNeeded(); |
| 729 | 729 |
| 730 // Never call SetNeedsBeginFrames if the frame source has the right value. | 730 // Never call SetNeedsBeginFrames if the frame source has the right value. |
| 731 if (needs_begin_frame == frame_source_needs_begin_frames) | 731 if (needs_begin_frame == frame_source_needs_begin_frames) |
| 732 return false; | 732 return false; |
| 733 | 733 |
| 734 // Always request the BeginFrame immediately if it's needed. | 734 // Always request the BeginFrame immediately if it's needed. |
| 735 if (needs_begin_frame) | 735 if (needs_begin_frame) |
| 736 return true; | 736 return true; |
| 737 | 737 |
| 738 // Stop requesting BeginFrames after a deadline. | 738 // Stop requesting BeginFrames after a deadline or if we are idle |
| 739 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) | 739 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE || |
| 740 return true; | 740 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE) |
| 741 | |
| 742 // Stop requesting BeginFrames immediately when output surface is lost. | |
| 743 if (!HasInitializedOutputSurface()) | |
| 744 return true; | 741 return true; |
| 745 | 742 |
| 746 return false; | 743 return false; |
| 747 } | 744 } |
| 748 | 745 |
| 749 bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { | 746 bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
| 750 // ShouldPollForAnticipatedDrawTriggers is what we use in place of | 747 // ShouldPollForAnticipatedDrawTriggers is what we use in place of |
| 751 // ProactiveBeginFrameWanted when we are using the synchronous | 748 // ProactiveBeginFrameWanted when we are using the synchronous |
| 752 // compositor. | 749 // compositor. |
| 753 if (!SupportsProactiveBeginFrame()) { | 750 if (!SupportsProactiveBeginFrame()) { |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1132 static_cast<int>(begin_impl_frame_state_), | 1129 static_cast<int>(begin_impl_frame_state_), |
| 1133 static_cast<int>(commit_state_), | 1130 static_cast<int>(commit_state_), |
| 1134 has_pending_tree_ ? 'T' : 'F', | 1131 has_pending_tree_ ? 'T' : 'F', |
| 1135 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1132 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
| 1136 active_tree_needs_first_draw_ ? 'T' : 'F', | 1133 active_tree_needs_first_draw_ ? 'T' : 'F', |
| 1137 max_pending_swaps_, | 1134 max_pending_swaps_, |
| 1138 pending_swaps_); | 1135 pending_swaps_); |
| 1139 } | 1136 } |
| 1140 | 1137 |
| 1141 } // namespace cc | 1138 } // namespace cc |
| OLD | NEW |