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

Side by Side Diff: base/task_scheduler/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
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_TASK_SCHEDULER_TASK_SCHEDULER_H_ 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // called once. 76 // called once.
77 virtual void Shutdown() = 0; 77 virtual void Shutdown() = 0;
78 78
79 // Waits until there are no pending undelayed tasks. May be called in tests 79 // Waits until there are no pending undelayed tasks. May be called in tests
80 // to validate that a condition is met after all undelayed tasks have run. 80 // to validate that a condition is met after all undelayed tasks have run.
81 // 81 //
82 // Does not wait for delayed tasks. Waits for undelayed tasks posted from 82 // Does not wait for delayed tasks. Waits for undelayed tasks posted from
83 // other threads during the call. Returns immediately when shutdown completes. 83 // other threads during the call. Returns immediately when shutdown completes.
84 virtual void FlushForTesting() = 0; 84 virtual void FlushForTesting() = 0;
85 85
86 // Joins all threads of this scheduler. Tasks that are already running are
87 // allowed to complete their execution. This can only be called once.
88 virtual void JoinForTesting() = 0;
89
86 // CreateAndSetSimpleTaskScheduler(), CreateAndSetDefaultTaskScheduler() and 90 // CreateAndSetSimpleTaskScheduler(), CreateAndSetDefaultTaskScheduler() and
87 // SetInstance() register a TaskScheduler to handle tasks posted through the 91 // SetInstance() register a TaskScheduler to handle tasks posted through the
88 // post_task.h API for this process. The registered TaskScheduler will only be 92 // post_task.h API for this process. The registered TaskScheduler will only be
89 // deleted when a new TaskScheduler is registered and is leaked on shutdown. 93 // deleted when a new TaskScheduler is registered and is leaked on shutdown.
90 // The methods must not be called when TaskRunners created by the previous 94 // The methods must not be called when TaskRunners created by the previous
91 // TaskScheduler are still alive. The methods are not thread-safe; proper 95 // TaskScheduler are still alive. The methods are not thread-safe; proper
92 // synchronization is required to use the post_task.h API after registering a 96 // synchronization is required to use the post_task.h API after registering a
93 // new TaskScheduler. 97 // new TaskScheduler.
94 98
95 // Creates and sets a task scheduler with one worker pool named |name| that 99 // Creates and sets a task scheduler with one worker pool named |name| that
(...skipping 17 matching lines...) Expand all
113 117
114 // Retrieve the TaskScheduler set via CreateAndSetDefaultTaskScheduler() or 118 // Retrieve the TaskScheduler set via CreateAndSetDefaultTaskScheduler() or
115 // SetInstance(). This should be used very rarely; most users of TaskScheduler 119 // SetInstance(). This should be used very rarely; most users of TaskScheduler
116 // should use the post_task.h API. 120 // should use the post_task.h API.
117 static TaskScheduler* GetInstance(); 121 static TaskScheduler* GetInstance();
118 }; 122 };
119 123
120 } // namespace base 124 } // namespace base
121 125
122 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 126 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | base/task_scheduler/task_scheduler_impl.h » ('j') | base/test/scoped_task_scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698