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

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

Issue 2546423002: [Try # 3] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Rebased Created 3 years, 10 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 | cc/test/ordered_simple_task_runner.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 #ifndef CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 5 #ifndef CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
6 #define CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 6 #define CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Keep running until a task which didn't exist initially would run. 124 // Keep running until a task which didn't exist initially would run.
125 base::Callback<bool(void)> TaskExistedInitially(); 125 base::Callback<bool(void)> TaskExistedInitially();
126 126
127 // Stop running tasks when NextTaskTime() >= stop_at 127 // Stop running tasks when NextTaskTime() >= stop_at
128 base::Callback<bool(void)> NowBefore(base::TimeTicks stop_at); 128 base::Callback<bool(void)> NowBefore(base::TimeTicks stop_at);
129 129
130 // Advance Now() to the next task to run. 130 // Advance Now() to the next task to run.
131 base::Callback<bool(void)> AdvanceNow(); 131 base::Callback<bool(void)> AdvanceNow();
132 132
133 // Removes all tasks whose weak pointer has been revoked.
134 void RemoveCancelledTasks();
135
133 protected: 136 protected:
134 static bool TaskRunCountBelowCallback(size_t max_tasks, size_t* task_run); 137 static bool TaskRunCountBelowCallback(size_t max_tasks, size_t* task_run);
135 bool TaskExistedInitiallyCallback( 138 bool TaskExistedInitiallyCallback(
136 const std::set<TestOrderablePendingTask>& existing_tasks); 139 const std::set<TestOrderablePendingTask>& existing_tasks);
137 bool NowBeforeCallback(base::TimeTicks stop_at); 140 bool NowBeforeCallback(base::TimeTicks stop_at);
138 bool AdvanceNowCallback(); 141 bool AdvanceNowCallback();
139 142
140 ~OrderedSimpleTaskRunner() override; 143 ~OrderedSimpleTaskRunner() override;
141 144
142 base::ThreadChecker thread_checker_; 145 base::ThreadChecker thread_checker_;
143 146
144 bool advance_now_; 147 bool advance_now_;
145 // Not owned. 148 // Not owned.
146 base::SimpleTestTickClock* now_src_; 149 base::SimpleTestTickClock* now_src_;
147 150
148 size_t max_tasks_; 151 size_t max_tasks_;
149 152
150 bool inside_run_tasks_until_; 153 bool inside_run_tasks_until_;
151 std::set<TestOrderablePendingTask> pending_tasks_; 154 std::set<TestOrderablePendingTask> pending_tasks_;
152 155
153 private: 156 private:
154 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); 157 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner);
155 }; 158 };
156 159
157 } // namespace cc 160 } // namespace cc
158 161
159 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ 162 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/test/ordered_simple_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698