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

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

Issue 2686593003: DESIGN DISCUSSION ONLY Task Scheduler Single Thread Task Runner Manager for Dedicated Threads per S… (Closed)
Patch Set: Wait for Detached Thread to Complete Created 3 years, 10 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_TASK_SCHEDULER_IMPL_H_ 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
22 22
23 namespace base { 23 namespace base {
24 24
25 class HistogramBase; 25 class HistogramBase;
26 class SchedulerWorkerPoolParams; 26 class SchedulerWorkerPoolParams;
27 27
28 namespace internal { 28 namespace internal {
29 29
30 class DelayedTaskManager; 30 class DelayedTaskManager;
31 class SchedulerSingleThreadTaskRunnerManager;
31 class TaskTracker; 32 class TaskTracker;
32 33
33 // Default TaskScheduler implementation. This class is thread-safe. 34 // Default TaskScheduler implementation. This class is thread-safe.
34 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler { 35 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler {
35 public: 36 public:
36 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. 37 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure.
37 // |worker_pool_params_vector| describes the worker pools to create. 38 // |worker_pool_params_vector| describes the worker pools to create.
38 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| 39 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools|
39 // of the worker pool in which a task with given traits should run. 40 // of the worker pool in which a task with given traits should run.
40 static std::unique_ptr<TaskSchedulerImpl> Create( 41 static std::unique_ptr<TaskSchedulerImpl> Create(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 SchedulerWorkerPoolImpl* GetWorkerPoolForTraits( 74 SchedulerWorkerPoolImpl* GetWorkerPoolForTraits(
74 const TaskTraits& traits) const; 75 const TaskTraits& traits) const;
75 76
76 // Callback invoked when a non-single-thread |sequence| isn't empty after a 77 // Callback invoked when a non-single-thread |sequence| isn't empty after a
77 // worker pops a Task from it. 78 // worker pops a Task from it.
78 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); 79 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence);
79 80
80 Thread service_thread_; 81 Thread service_thread_;
81 std::unique_ptr<TaskTracker> task_tracker_; 82 std::unique_ptr<TaskTracker> task_tracker_;
82 std::unique_ptr<DelayedTaskManager> delayed_task_manager_; 83 std::unique_ptr<DelayedTaskManager> delayed_task_manager_;
84 std::unique_ptr<SchedulerSingleThreadTaskRunnerManager>
85 single_thread_task_runner_manager_;
83 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; 86 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_;
84 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_; 87 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_;
85 88
86 #if DCHECK_IS_ON() 89 #if DCHECK_IS_ON()
87 // Set once JoinForTesting() has returned. 90 // Set once JoinForTesting() has returned.
88 AtomicFlag join_for_testing_returned_; 91 AtomicFlag join_for_testing_returned_;
89 #endif 92 #endif
90 93
91 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); 94 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl);
92 }; 95 };
93 96
94 } // namespace internal 97 } // namespace internal
95 } // namespace base 98 } // namespace base
96 99
97 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ 100 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698