Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: cc/scheduler/scheduler_state_machine.cc

Issue 987563002: cc: Simplify SetNeedsBeginFrames code in scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_retro_frame
Patch Set: Remove dependency on retro frame removal. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // Proactive BeginFrames are bad for the synchronous compositor because we 713 // Proactive BeginFrames are bad for the synchronous compositor because we
714 // have to draw when we get the BeginFrame and could end up drawing many 714 // have to draw when we get the BeginFrame and could end up drawing many
715 // duplicate frames if our new frame isn't ready in time. 715 // duplicate frames if our new frame isn't ready in time.
716 // To poll for state with the synchronous compositor without having to draw, 716 // To poll for state with the synchronous compositor without having to draw,
717 // we rely on ShouldPollForAnticipatedDrawTriggers instead. 717 // we rely on ShouldPollForAnticipatedDrawTriggers instead.
718 // Synchronous compositor doesn't have a browser. 718 // Synchronous compositor doesn't have a browser.
719 DCHECK(!children_need_begin_frames_); 719 DCHECK(!children_need_begin_frames_);
720 return BeginFrameNeededToAnimateOrDraw(); 720 return BeginFrameNeededToAnimateOrDraw();
721 } 721 }
722 722
723 bool SchedulerStateMachine::ShouldSetNeedsBeginFrames(
724 bool frame_source_needs_begin_frames) const {
725 bool needs_begin_frame = BeginFrameNeeded();
726
727 // Never call SetNeedsBeginFrames if the frame source has the right value.
728 if (needs_begin_frame == frame_source_needs_begin_frames)
729 return false;
730
731 // Always request the BeginFrame immediately if it's needed.
732 if (needs_begin_frame)
733 return true;
734
735 // Stop requesting BeginFrames after a deadline.
736 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
737 return true;
738
739 // Stop requesting BeginFrames immediately when output surface is lost.
740 if (!HasInitializedOutputSurface())
brianderson 2015/03/19 01:25:54 This condition isn't taken into account in the cod
sunnyps 2015/03/19 01:31:53 Yes, the new way of calling SetNeedsBeginFrames(fa
741 return true;
742
743 return false;
744 }
745
746 bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { 723 bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const {
747 // ShouldPollForAnticipatedDrawTriggers is what we use in place of 724 // ShouldPollForAnticipatedDrawTriggers is what we use in place of
748 // ProactiveBeginFrameWanted when we are using the synchronous 725 // ProactiveBeginFrameWanted when we are using the synchronous
749 // compositor. 726 // compositor.
750 if (!SupportsProactiveBeginFrame()) { 727 if (!SupportsProactiveBeginFrame()) {
751 return !BeginFrameNeededToAnimateOrDraw() && ProactiveBeginFrameWanted(); 728 return !BeginFrameNeededToAnimateOrDraw() && ProactiveBeginFrameWanted();
752 } 729 }
753 730
754 // Non synchronous compositors should rely on 731 // Non synchronous compositors should rely on
755 // ProactiveBeginFrameWanted to poll for state instead. 732 // ProactiveBeginFrameWanted to poll for state instead.
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 static_cast<int>(begin_impl_frame_state_), 1100 static_cast<int>(begin_impl_frame_state_),
1124 static_cast<int>(commit_state_), 1101 static_cast<int>(commit_state_),
1125 has_pending_tree_ ? 'T' : 'F', 1102 has_pending_tree_ ? 'T' : 'F',
1126 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1103 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1127 active_tree_needs_first_draw_ ? 'T' : 'F', 1104 active_tree_needs_first_draw_ ? 'T' : 'F',
1128 max_pending_swaps_, 1105 max_pending_swaps_,
1129 pending_swaps_); 1106 pending_swaps_);
1130 } 1107 }
1131 1108
1132 } // namespace cc 1109 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698