| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 public: | 53 public: |
| 54 OrderedSimpleTaskRunner(base::SimpleTestTickClock* now_src, bool advance_now); | 54 OrderedSimpleTaskRunner(base::SimpleTestTickClock* now_src, bool advance_now); |
| 55 | 55 |
| 56 // base::TestSimpleTaskRunner implementation: | 56 // base::TestSimpleTaskRunner implementation: |
| 57 bool PostDelayedTask(const tracked_objects::Location& from_here, | 57 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 58 const base::Closure& task, | 58 const base::Closure& task, |
| 59 base::TimeDelta delay) override; | 59 base::TimeDelta delay) override; |
| 60 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 60 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
| 61 const base::Closure& task, | 61 const base::Closure& task, |
| 62 base::TimeDelta delay) override; | 62 base::TimeDelta delay) override; |
| 63 | |
| 64 bool RunsTasksOnCurrentThread() const override; | 63 bool RunsTasksOnCurrentThread() const override; |
| 64 std::string GetThreadName() const override; |
| 65 | 65 |
| 66 static base::TimeTicks AbsoluteMaxNow(); | 66 static base::TimeTicks AbsoluteMaxNow(); |
| 67 | 67 |
| 68 // Set a maximum number of tasks to run at once. Useful as a timeout to | 68 // Set a maximum number of tasks to run at once. Useful as a timeout to |
| 69 // prevent infinite task loops. | 69 // prevent infinite task loops. |
| 70 static const size_t kAbsoluteMaxTasks; | 70 static const size_t kAbsoluteMaxTasks; |
| 71 void SetRunTaskLimit(size_t max_tasks) { max_tasks_ = max_tasks; } | 71 void SetRunTaskLimit(size_t max_tasks) { max_tasks_ = max_tasks; } |
| 72 void ClearRunTaskLimit() { max_tasks_ = kAbsoluteMaxTasks; } | 72 void ClearRunTaskLimit() { max_tasks_ = kAbsoluteMaxTasks; } |
| 73 | 73 |
| 74 // Allow task runner to advance now when running tasks. | 74 // Allow task runner to advance now when running tasks. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 bool inside_run_tasks_until_; | 149 bool inside_run_tasks_until_; |
| 150 std::set<TestOrderablePendingTask> pending_tasks_; | 150 std::set<TestOrderablePendingTask> pending_tasks_; |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); | 153 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace cc | 156 } // namespace cc |
| 157 | 157 |
| 158 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ | 158 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ |
| OLD | NEW |