| 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 <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // Run tasks while the callback returns true or too many tasks have been run. | 81 // Run tasks while the callback returns true or too many tasks have been run. |
| 82 // Returns true if there are still pending tasks left. | 82 // Returns true if there are still pending tasks left. |
| 83 bool RunTasksWhile(base::Callback<bool(void)> condition); | 83 bool RunTasksWhile(base::Callback<bool(void)> condition); |
| 84 | 84 |
| 85 // Run tasks while *all* of the callbacks return true or too many tasks have | 85 // Run tasks while *all* of the callbacks return true or too many tasks have |
| 86 // been run. Exits on the *first* condition which returns false, skipping | 86 // been run. Exits on the *first* condition which returns false, skipping |
| 87 // calling all remaining conditions. Conditions can have side effects, | 87 // calling all remaining conditions. Conditions can have side effects, |
| 88 // including modifying the task queue. | 88 // including modifying the task queue. |
| 89 // Returns true if there are still pending tasks left. | 89 // Returns true if there are still pending tasks left. |
| 90 bool RunTasksWhile( | 90 bool RunTasksWhile(const std::vector<base::Callback<bool(void)>>& conditions); |
| 91 const std::vector<base::Callback<bool(void)> >& conditions); | |
| 92 | 91 |
| 93 // Convenience functions to run tasks with common conditions. | 92 // Convenience functions to run tasks with common conditions. |
| 94 | 93 |
| 95 // Run tasks which existed at the start of this call. | 94 // Run tasks which existed at the start of this call. |
| 96 // Return code indicates tasks still exist to run. | 95 // Return code indicates tasks still exist to run. |
| 97 bool RunPendingTasks(); | 96 bool RunPendingTasks(); |
| 98 // Keep running tasks until no tasks are left. | 97 // Keep running tasks until no tasks are left. |
| 99 // Return code indicates tasks still exist to run which also indicates if | 98 // Return code indicates tasks still exist to run which also indicates if |
| 100 // runner reached idle. | 99 // runner reached idle. |
| 101 bool RunUntilIdle(); | 100 bool RunUntilIdle(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 bool inside_run_tasks_until_; | 145 bool inside_run_tasks_until_; |
| 147 std::set<TestOrderablePendingTask> pending_tasks_; | 146 std::set<TestOrderablePendingTask> pending_tasks_; |
| 148 | 147 |
| 149 private: | 148 private: |
| 150 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); | 149 DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner); |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 } // namespace cc | 152 } // namespace cc |
| 154 | 153 |
| 155 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ | 154 #endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_ |
| OLD | NEW |