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

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

Issue 17587014: cc: Fix infinite BeginFrame that Scheduler causes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | 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.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 settings_.using_synchronous_renderer_compositor; 139 settings_.using_synchronous_renderer_compositor;
140 140
141 if (needs_begin_frame_to_draw) 141 if (needs_begin_frame_to_draw)
142 safe_to_expect_begin_frame_ = true; 142 safe_to_expect_begin_frame_ = true;
143 143
144 // Determine if we need BeginFrame notifications. 144 // Determine if we need BeginFrame notifications.
145 // If we do, always request the BeginFrame immediately. 145 // If we do, always request the BeginFrame immediately.
146 // If not, only disable on the next BeginFrame to avoid unnecessary toggles. 146 // If not, only disable on the next BeginFrame to avoid unnecessary toggles.
147 // The synchronous renderer compositor requires immediate disables though. 147 // The synchronous renderer compositor requires immediate disables though.
148 if ((needs_begin_frame || 148 if ((needs_begin_frame ||
149 state_machine_.inside_begin_frame() || 149 state_machine_.inside_begin_frame() ||
brianderson 2013/06/24 18:04:49 The intent of state_machine_.inside_begin_frame(),
150 immediate_disables_needed) && 150 immediate_disables_needed) &&
151 (needs_begin_frame != last_set_needs_begin_frame_)) { 151 (needs_begin_frame != last_set_needs_begin_frame_)) {
152 has_pending_begin_frame_ = false; 152 has_pending_begin_frame_ = false;
153 client_->SetNeedsBeginFrameOnImplThread(needs_begin_frame); 153 client_->SetNeedsBeginFrameOnImplThread(needs_begin_frame);
154 if (safe_to_expect_begin_frame_) 154 if (safe_to_expect_begin_frame_)
155 last_set_needs_begin_frame_ = needs_begin_frame; 155 last_set_needs_begin_frame_ = needs_begin_frame;
156 } 156 }
157 157
158 // Request another BeginFrame if we haven't drawn for now until we have 158 // Request another BeginFrame if we haven't drawn for now until we have
159 // deadlines implemented. 159 // deadlines implemented.
160 if (state_machine_.inside_begin_frame() && has_pending_begin_frame_) { 160 if (state_machine_.inside_begin_frame() && has_pending_begin_frame_) {
161 has_pending_begin_frame_ = false; 161 has_pending_begin_frame_ = false;
162 client_->SetNeedsBeginFrameOnImplThread(true); 162 client_->SetNeedsBeginFrameOnImplThread(true);
163 return; 163 return;
164 } 164 }
165
166 client_->SetNeedsBeginFrameOnImplThread(needs_begin_frame_to_draw);
brianderson 2013/06/24 18:04:49 We should avoid disabling SetNeedsBeginFrame until
167 if (safe_to_expect_begin_frame_)
168 last_set_needs_begin_frame_ = needs_begin_frame_to_draw;
165 } 169 }
166 170
167 void Scheduler::BeginFrame(const BeginFrameArgs& args) { 171 void Scheduler::BeginFrame(const BeginFrameArgs& args) {
168 TRACE_EVENT0("cc", "Scheduler::BeginFrame"); 172 TRACE_EVENT0("cc", "Scheduler::BeginFrame");
169 DCHECK(!has_pending_begin_frame_); 173 DCHECK(!has_pending_begin_frame_);
170 has_pending_begin_frame_ = true; 174 has_pending_begin_frame_ = true;
171 safe_to_expect_begin_frame_ = true; 175 safe_to_expect_begin_frame_ = true;
172 last_begin_frame_args_ = args; 176 last_begin_frame_args_ = args;
173 state_machine_.DidEnterBeginFrame(args); 177 state_machine_.DidEnterBeginFrame(args);
174 ProcessScheduledActions(); 178 ProcessScheduledActions();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 238
235 SetupNextBeginFrameIfNeeded(); 239 SetupNextBeginFrameIfNeeded();
236 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); 240 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
237 } 241 }
238 242
239 bool Scheduler::WillDrawIfNeeded() const { 243 bool Scheduler::WillDrawIfNeeded() const {
240 return !state_machine_.DrawSuspendedUntilCommit(); 244 return !state_machine_.DrawSuspendedUntilCommit();
241 } 245 }
242 246
243 } // namespace cc 247 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698