Chromium Code Reviews| Index: base/test/scoped_task_scheduler.h |
| diff --git a/base/test/scoped_task_scheduler.h b/base/test/scoped_task_scheduler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3f4a1828d80d6bfd39c1615a9676ec38cc79db88 |
| --- /dev/null |
| +++ b/base/test/scoped_task_scheduler.h |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_TEST_SCOPED_TASK_SCHEDULER_H_ |
| +#define BASE_TEST_SCOPED_TASK_SCHEDULER_H_ |
| + |
| +#include "base/macros.h" |
| + |
| +namespace base { |
| +namespace test { |
| + |
| +// Initializes a TaskScheduler and allows usage of the |
| +// base/task_scheduler/post_task.h API within a scope. |
|
gab
2016/11/16 21:29:19
s/a/its/
fdoray
2016/11/16 22:04:45
Done.
|
| +class ScopedTaskScheduler { |
| + public: |
| + // Initializes a TaskScheduler with default arguments. |
| + ScopedTaskScheduler(); |
| + |
| + // Waits until all TaskScheduler tasks blocking shutdown complete their |
| + // execution (see TaskShutdownBehavior). Then, joins all TaskScheduler threads |
| + // and deletes the TaskScheduler. |
| + // |
| + // Note that joining TaskScheduler threads may involve waiting for |
| + // CONTINUE_ON_SHUTDOWN tasks to complete their execution. Normally, in |
| + // production, the process exits without joining TaskScheduler threads. |
| + ~ScopedTaskScheduler(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ScopedTaskScheduler); |
| +}; |
| + |
| +} // namespace test |
| +} // namespace base |
| + |
| +#endif // BASE_TEST_SCOPED_TASK_SCHEDULER_H_ |