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

Side by Side Diff: base/task_scheduler/scheduler_worker_pool_impl.h

Issue 2834063002: Separate the create and start phases in TaskSchedulerImpl. (Closed)
Patch Set: self-review Created 3 years, 8 months 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_SCHEDULER_WORKER_POOL_IMPL_H_ 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 20 matching lines...) Expand all
31 31
32 class HistogramBase; 32 class HistogramBase;
33 class SchedulerWorkerPoolParams; 33 class SchedulerWorkerPoolParams;
34 class TaskTraits; 34 class TaskTraits;
35 35
36 namespace internal { 36 namespace internal {
37 37
38 class DelayedTaskManager; 38 class DelayedTaskManager;
39 class TaskTracker; 39 class TaskTracker;
40 40
41 // A pool of workers that run Tasks. This class is thread-safe. 41 // A pool of workers that run Tasks.
42 //
43 // The pool doesn't create threads before Start() is called. Tasks can be posted
robliao 2017/04/24 22:32:19 Nit: before -> until Apply to the other comments
fdoray 2017/04/25 18:43:34 Done.
44 // before Start() is called, but they don't run until Start() is called.
robliao 2017/04/24 22:32:18 Tasks can be posted at any time but will not run u
fdoray 2017/04/25 18:43:34 Done.
45 //
46 // This class is thread-safe.
42 class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool { 47 class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool {
43 public: 48 public:
44 // Callback invoked when a Sequence isn't empty after a worker pops a Task 49 // Callback invoked when a Sequence isn't empty after a worker pops a Task
45 // from it. 50 // from it.
46 using ReEnqueueSequenceCallback = Callback<void(scoped_refptr<Sequence>)>; 51 using ReEnqueueSequenceCallback = Callback<void(scoped_refptr<Sequence>)>;
47 52
48 // Constructs a pool without workers. Tasks can be posted to the pool, but 53 // Constructs a pool without workers.
49 // they won't run until workers are created. To create workers and start
50 // running tasks, call Start().
51 // 54 //
52 // |name| is used to label the pool's threads ("TaskScheduler" + |name| + 55 // |name| is used to label the pool's threads ("TaskScheduler" + |name| +
53 // index) and histograms ("TaskScheduler." + histogram name + "." + |name| + 56 // index) and histograms ("TaskScheduler." + histogram name + "." + |name| +
54 // extra suffixes). |priority_hint| is the preferred thread priority; the 57 // extra suffixes). |priority_hint| is the preferred thread priority; the
55 // actual thread priority depends on shutdown state and platform capabilities. 58 // actual thread priority depends on shutdown state and platform capabilities.
56 // |re_enqueue_sequence_callback| is invoked when a Sequence isn't empty after 59 // |re_enqueue_sequence_callback| is invoked when a Sequence isn't empty after
57 // a worker pops a Task from it. |task_tracker| keeps track of tasks. 60 // a worker pops a Task from it. |task_tracker| keeps track of tasks.
58 // |delayed_task_manager| handles tasks posted with a delay. 61 // |delayed_task_manager| handles tasks posted with a delay.
59 SchedulerWorkerPoolImpl( 62 SchedulerWorkerPoolImpl(
60 const std::string& name, 63 const std::string& name,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 TaskTracker* const task_tracker_; 207 TaskTracker* const task_tracker_;
205 DelayedTaskManager* const delayed_task_manager_; 208 DelayedTaskManager* const delayed_task_manager_;
206 209
207 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); 210 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl);
208 }; 211 };
209 212
210 } // namespace internal 213 } // namespace internal
211 } // namespace base 214 } // namespace base
212 215
213 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ 216 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | base/task_scheduler/task_scheduler.h » ('j') | base/task_scheduler/task_scheduler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698