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

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

Issue 2546423002: [Try # 3] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Rebased Created 4 years 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
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 modifiable_conditions.push_back(TaskRunCountBelow(max_tasks_)); 191 modifiable_conditions.push_back(TaskRunCountBelow(max_tasks_));
192 192
193 // If to advance now or not 193 // If to advance now or not
194 if (!advance_now_) { 194 if (!advance_now_) {
195 modifiable_conditions.push_back(NowBefore(now_src_->NowTicks())); 195 modifiable_conditions.push_back(NowBefore(now_src_->NowTicks()));
196 } else { 196 } else {
197 modifiable_conditions.push_back(AdvanceNow()); 197 modifiable_conditions.push_back(AdvanceNow());
198 } 198 }
199 199
200 while (pending_tasks_.size() > 0) { 200 while (pending_tasks_.size() > 0) {
201 // Skip canceled tasks.
202 if (pending_tasks_.begin()->task.IsCancelled()) {
203 pending_tasks_.erase(pending_tasks_.begin());
204 continue;
205 }
201 // Check if we should continue to run pending tasks. 206 // Check if we should continue to run pending tasks.
202 bool condition_success = true; 207 bool condition_success = true;
203 for (std::vector<base::Callback<bool(void)>>::iterator it = 208 for (std::vector<base::Callback<bool(void)>>::iterator it =
204 modifiable_conditions.begin(); 209 modifiable_conditions.begin();
205 it != modifiable_conditions.end(); 210 it != modifiable_conditions.end();
206 it++) { 211 it++) {
207 condition_success = it->Run(); 212 condition_success = it->Run();
208 if (!condition_success) 213 if (!condition_success)
209 break; 214 break;
210 } 215 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 343
339 bool OrderedSimpleTaskRunner::AdvanceNowCallback() { 344 bool OrderedSimpleTaskRunner::AdvanceNowCallback() {
340 base::TimeTicks next_task_time = NextTaskTime(); 345 base::TimeTicks next_task_time = NextTaskTime();
341 if (now_src_->NowTicks() < next_task_time) { 346 if (now_src_->NowTicks() < next_task_time) {
342 now_src_->Advance(next_task_time - now_src_->NowTicks()); 347 now_src_->Advance(next_task_time - now_src_->NowTicks());
343 } 348 }
344 return true; 349 return true;
345 } 350 }
346 351
347 } // namespace cc 352 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698