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

Side by Side Diff: cc/test/ordered_simple_task_runner.cc

Issue 2483843002: Revert of [scheduler] Teach scheduler about audio state (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | content/browser/media/audio_stream_monitor.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/ordered_simple_task_runner.h" 5 #include "cc/test/ordered_simple_task_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 241
242 bool OrderedSimpleTaskRunner::RunUntilTime(base::TimeTicks time) { 242 bool OrderedSimpleTaskRunner::RunUntilTime(base::TimeTicks time) {
243 // If we are not auto advancing, force now forward to the time. 243 // If we are not auto advancing, force now forward to the time.
244 if (!advance_now_ && now_src_->NowTicks() < time) 244 if (!advance_now_ && now_src_->NowTicks() < time)
245 now_src_->Advance(time - now_src_->NowTicks()); 245 now_src_->Advance(time - now_src_->NowTicks());
246 246
247 // Run tasks 247 // Run tasks
248 bool result = RunTasksWhile(NowBefore(time)); 248 bool result = RunTasksWhile(NowBefore(time));
249 249
250 bool has_reached_task_limit = HasPendingTasks() && NextTaskTime() <= time;
251
252 // If the next task is after the stopping time and auto-advancing now, then 250 // If the next task is after the stopping time and auto-advancing now, then
253 // force time to be the stopping time. 251 // force time to be the stopping time.
254 if (!has_reached_task_limit && advance_now_ && now_src_->NowTicks() < time) { 252 if (!result && advance_now_ && now_src_->NowTicks() < time) {
255 now_src_->Advance(time - now_src_->NowTicks()); 253 now_src_->Advance(time - now_src_->NowTicks());
256 } 254 }
257 255
258 return result; 256 return result;
259 } 257 }
260 258
261 bool OrderedSimpleTaskRunner::RunForPeriod(base::TimeDelta period) { 259 bool OrderedSimpleTaskRunner::RunForPeriod(base::TimeDelta period) {
262 return RunUntilTime(now_src_->NowTicks() + period); 260 return RunUntilTime(now_src_->NowTicks() + period);
263 } 261 }
264 262
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 336
339 bool OrderedSimpleTaskRunner::AdvanceNowCallback() { 337 bool OrderedSimpleTaskRunner::AdvanceNowCallback() {
340 base::TimeTicks next_task_time = NextTaskTime(); 338 base::TimeTicks next_task_time = NextTaskTime();
341 if (now_src_->NowTicks() < next_task_time) { 339 if (now_src_->NowTicks() < next_task_time) {
342 now_src_->Advance(next_task_time - now_src_->NowTicks()); 340 now_src_->Advance(next_task_time - now_src_->NowTicks());
343 } 341 }
344 return true; 342 return true;
345 } 343 }
346 344
347 } // namespace cc 345 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/audio_stream_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698