Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: base/test/scoped_task_scheduler.h

Issue 2511473004: Create base::test::ScopedTaskScheduler. (Closed)
Patch Set: Use CreateAndSetSimpleTaskScheduler add const Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_SCOPED_TASK_SCHEDULER_H_
6 #define BASE_TEST_SCOPED_TASK_SCHEDULER_H_
7
8 #include "base/macros.h"
9
10 namespace base {
11
12 class TaskScheduler;
13
14 namespace test {
15
16 // Initializes a TaskScheduler and allows usage of the
17 // base/task_scheduler/post_task.h API within its scope.
18 class ScopedTaskScheduler {
19 public:
20 // Initializes a TaskScheduler with default arguments.
21 ScopedTaskScheduler();
22
23 // Waits until all TaskScheduler tasks blocking shutdown complete their
24 // execution (see TaskShutdownBehavior). Then, joins all TaskScheduler threads
25 // and deletes the TaskScheduler.
26 //
27 // Note that joining TaskScheduler threads may involve waiting for
28 // CONTINUE_ON_SHUTDOWN tasks to complete their execution. Normally, in
29 // production, the process exits without joining TaskScheduler threads.
30 ~ScopedTaskScheduler();
31
32 private:
33 const TaskScheduler* task_scheduler_ = nullptr;
34
35 DISALLOW_COPY_AND_ASSIGN(ScopedTaskScheduler);
36 };
37
38 } // namespace test
39 } // namespace base
40
41 #endif // BASE_TEST_SCOPED_TASK_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698