OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 OrderedSimpleTaskRunner(base::SimpleTestTickClock* now_src, bool advance_now); | 63 OrderedSimpleTaskRunner(base::SimpleTestTickClock* now_src, bool advance_now); |
64 | 64 |
65 // base::TestSimpleTaskRunner implementation: | 65 // base::TestSimpleTaskRunner implementation: |
66 bool PostDelayedTask(const tracked_objects::Location& from_here, | 66 bool PostDelayedTask(const tracked_objects::Location& from_here, |
67 base::OnceClosure task, | 67 base::OnceClosure task, |
68 base::TimeDelta delay) override; | 68 base::TimeDelta delay) override; |
69 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 69 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
70 base::OnceClosure task, | 70 base::OnceClosure task, |
71 base::TimeDelta delay) override; | 71 base::TimeDelta delay) override; |
72 | 72 |
73 bool RunsTasksOnCurrentThread() const override; | 73 bool RunsTasksInCurrentSequence() const override; |
74 | 74 |
75 static base::TimeTicks AbsoluteMaxNow(); | 75 static base::TimeTicks AbsoluteMaxNow(); |
76 | 76 |
77 // Set a maximum number of tasks to run at once. Useful as a timeout to | 77 // Set a maximum number of tasks to run at once. Useful as a timeout to |
78 // prevent infinite task loops. | 78 // prevent infinite task loops. |
79 static const size_t kAbsoluteMaxTasks; | 79 static const size_t kAbsoluteMaxTasks; |
80 void SetRunTaskLimit(size_t max_tasks) { max_tasks_ = max_tasks; } | 80 void SetRunTaskLimit(size_t max_tasks) { max_tasks_ = max_tasks; } |
81 void ClearRunTaskLimit() { max_tasks_ = kAbsoluteMaxTasks; } | 81 void ClearRunTaskLimit() { max_tasks_ = kAbsoluteMaxTasks; } |
82 | 82 |
83 // Allow task runner to advance now when running tasks. | 83 // Allow task runner to advance now when running tasks. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 bool inside_run_tasks_until_; | 160 bool inside_run_tasks_until_; |
161 std::set<TestOrderablePendingTask> pending_tasks_; | 161 std::set<TestOrderablePendingTask> pending_tasks_; |
162 | 162 |
163 private: | 163 private: |
164 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); | 164 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); |
165 }; | 165 }; |
166 | 166 |
167 } // namespace cc | 167 } // namespace cc |
168 | 168 |
169 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ | 169 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ |
OLD | NEW |