OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BASE_TEST_SCOPED_TASK_SCHEDULER_H_ | 5 #ifndef BASE_TEST_SCOPED_TASK_SCHEDULER_H_ |
6 #define BASE_TEST_SCOPED_TASK_SCHEDULER_H_ | 6 #define BASE_TEST_SCOPED_TASK_SCHEDULER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 | 12 |
13 class MessageLoop; | 13 class MessageLoop; |
14 class TaskScheduler; | 14 class TaskScheduler; |
15 | 15 |
16 namespace test { | 16 namespace test { |
17 | 17 |
| 18 // DEPRECATED. Use ScopedTaskEnvironment instead. |
| 19 // |
| 20 // TODO(fdoray): Replace ScopedTaskScheduler instances by ScopedTaskEnvironment. |
| 21 // https://crbug.com/708584 |
| 22 // |
18 // Allows usage of the base/task_scheduler/post_task.h API within its scope. | 23 // Allows usage of the base/task_scheduler/post_task.h API within its scope. |
19 // | 24 // |
20 // To run pending tasks synchronously, call RunLoop::Run/RunUntilIdle() on the | 25 // To run pending tasks synchronously, call RunLoop::Run/RunUntilIdle() on the |
21 // thread where the ScopedTaskScheduler lives. The destructor runs remaining | 26 // thread where the ScopedTaskScheduler lives. The destructor runs remaining |
22 // BLOCK_SHUTDOWN tasks synchronously. | 27 // BLOCK_SHUTDOWN tasks synchronously. |
23 // | 28 // |
24 // Note: ScopedTaskScheduler intentionally breaks the TaskScheduler contract of | 29 // Note: ScopedTaskScheduler intentionally breaks the TaskScheduler contract of |
25 // always running its tasks on threads it owns, instead opting to run its tasks | 30 // always running its tasks on threads it owns, instead opting to run its tasks |
26 // on the main thread for determinism in tests. Components that depend on | 31 // on the main thread for determinism in tests. Components that depend on |
27 // TaskScheduler using independent threads should use ScopedAsyncTaskScheduler | 32 // TaskScheduler using independent threads should use ScopedAsyncTaskScheduler |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 const TaskScheduler* task_scheduler_ = nullptr; | 98 const TaskScheduler* task_scheduler_ = nullptr; |
94 ThreadChecker thread_checker_; | 99 ThreadChecker thread_checker_; |
95 | 100 |
96 DISALLOW_COPY_AND_ASSIGN(ScopedTaskScheduler); | 101 DISALLOW_COPY_AND_ASSIGN(ScopedTaskScheduler); |
97 }; | 102 }; |
98 | 103 |
99 } // namespace test | 104 } // namespace test |
100 } // namespace base | 105 } // namespace base |
101 | 106 |
102 #endif // BASE_TEST_SCOPED_TASK_SCHEDULER_H_ | 107 #endif // BASE_TEST_SCOPED_TASK_SCHEDULER_H_ |
OLD | NEW |