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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
670 | 670 |
671 return false; | 671 return false; |
672 } | 672 } |
673 | 673 |
674 bool SchedulerStateMachine::BeginFrameNeeded() const { | 674 bool SchedulerStateMachine::BeginFrameNeeded() const { |
675 // We can't handle BeginFrames when output surface isn't initialized. | 675 // We can't handle BeginFrames when output surface isn't initialized. |
676 // TODO(brianderson): Support output surface creation inside a BeginFrame. | 676 // TODO(brianderson): Support output surface creation inside a BeginFrame. |
677 if (!HasInitializedOutputSurface()) | 677 if (!HasInitializedOutputSurface()) |
678 return false; | 678 return false; |
679 | 679 |
680 // If we are not visible, we don't need BeginFrame messages. | |
681 if (!visible_) { | |
brianderson
2015/04/01 21:58:08
Can you remove the visibility checks in BeginFrame
mithro-old
2015/04/02 01:03:59
I moved the !visible_ check into the BeginFrameNee
| |
682 return false; | |
683 } | |
684 | |
680 if (SupportsProactiveBeginFrame()) { | 685 if (SupportsProactiveBeginFrame()) { |
681 return (BeginFrameNeededToAnimateOrDraw() || | 686 return (BeginFrameNeededToAnimateOrDraw() || |
682 BeginFrameNeededForChildren() || | 687 BeginFrameNeededForChildren() || |
683 ProactiveBeginFrameWanted()); | 688 ProactiveBeginFrameWanted()); |
684 } | 689 } |
685 | 690 |
686 // Proactive BeginFrames are bad for the synchronous compositor because we | 691 // Proactive BeginFrames are bad for the synchronous compositor because we |
687 // have to draw when we get the BeginFrame and could end up drawing many | 692 // have to draw when we get the BeginFrame and could end up drawing many |
688 // duplicate frames if our new frame isn't ready in time. | 693 // duplicate frames if our new frame isn't ready in time. |
689 // To poll for state with the synchronous compositor without having to draw, | 694 // To poll for state with the synchronous compositor without having to draw, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
820 } | 825 } |
821 } | 826 } |
822 | 827 |
823 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately() | 828 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately() |
824 const { | 829 const { |
825 // TODO(brianderson): This should take into account multiple commit sources. | 830 // TODO(brianderson): This should take into account multiple commit sources. |
826 | 831 |
827 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) | 832 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) |
828 return false; | 833 return false; |
829 | 834 |
830 // If we've lost the output surface, end the current BeginImplFrame ASAP | 835 // If things are being aborted, end the current BeginImplFrame ASAP so we can |
831 // so we can start creating the next output surface. | 836 // unblock creating the next output surface. |
832 if (output_surface_state_ == OUTPUT_SURFACE_LOST) | 837 if (PendingDrawsShouldBeAborted()) |
brianderson
2015/04/01 21:58:08
This seems unrelated. Make this a separate patch?
mithro-old
2015/04/02 01:03:59
Done.
| |
833 return true; | 838 return true; |
834 | 839 |
835 // SwapAck throttle the deadline since we wont draw and swap anyway. | 840 // SwapAck throttle the deadline since we wont draw and swap anyway. |
836 if (pending_swaps_ >= max_pending_swaps_) | 841 if (pending_swaps_ >= max_pending_swaps_) |
837 return false; | 842 return false; |
838 | 843 |
839 if (active_tree_needs_first_draw_) | 844 if (active_tree_needs_first_draw_) |
840 return true; | 845 return true; |
841 | 846 |
842 if (!needs_redraw_) | 847 if (!needs_redraw_) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1080 static_cast<int>(begin_impl_frame_state_), | 1085 static_cast<int>(begin_impl_frame_state_), |
1081 static_cast<int>(commit_state_), | 1086 static_cast<int>(commit_state_), |
1082 has_pending_tree_ ? 'T' : 'F', | 1087 has_pending_tree_ ? 'T' : 'F', |
1083 pending_tree_is_ready_for_activation_ ? 'T' : 'F', | 1088 pending_tree_is_ready_for_activation_ ? 'T' : 'F', |
1084 active_tree_needs_first_draw_ ? 'T' : 'F', | 1089 active_tree_needs_first_draw_ ? 'T' : 'F', |
1085 max_pending_swaps_, | 1090 max_pending_swaps_, |
1086 pending_swaps_); | 1091 pending_swaps_); |
1087 } | 1092 } |
1088 | 1093 |
1089 } // namespace cc | 1094 } // namespace cc |
OLD | NEW |