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

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

Issue 2427963002: Support FileDescriptorWatcher in TaskScheduler. (Closed)
Patch Set: fix build error (add BASE_EXPORT) 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
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/base_export.h" 13 #include "base/base_export.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/synchronization/atomic_flag.h" 18 #include "base/synchronization/atomic_flag.h"
19 #include "base/task_runner.h" 19 #include "base/task_runner.h"
20 #include "base/task_scheduler/delayed_task_manager.h"
21 #include "base/task_scheduler/scheduler_worker_pool_impl.h" 20 #include "base/task_scheduler/scheduler_worker_pool_impl.h"
22 #include "base/task_scheduler/sequence.h" 21 #include "base/task_scheduler/sequence.h"
23 #include "base/task_scheduler/task_scheduler.h" 22 #include "base/task_scheduler/task_scheduler.h"
24 #include "base/task_scheduler/task_tracker.h"
25 #include "base/task_scheduler/task_traits.h" 23 #include "base/task_scheduler/task_traits.h"
26 #include "base/threading/thread.h" 24 #include "base/threading/thread.h"
27 25
28 namespace base { 26 namespace base {
29 27
30 class HistogramBase; 28 class HistogramBase;
31 class SchedulerWorkerPoolParams; 29 class SchedulerWorkerPoolParams;
32 30
33 namespace internal { 31 namespace internal {
34 32
33 class DelayedTaskManager;
35 class SchedulerServiceThread; 34 class SchedulerServiceThread;
35 class TaskTracker;
36 36
37 // Default TaskScheduler implementation. This class is thread-safe. 37 // Default TaskScheduler implementation. This class is thread-safe.
38 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler { 38 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler {
39 public: 39 public:
40 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. 40 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure.
41 // |worker_pool_params_vector| describes the worker pools to create. 41 // |worker_pool_params_vector| describes the worker pools to create.
42 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| 42 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools|
43 // of the worker pool in which a task with given traits should run. 43 // of the worker pool in which a task with given traits should run.
44 static std::unique_ptr<TaskSchedulerImpl> Create( 44 static std::unique_ptr<TaskSchedulerImpl> Create(
45 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector, 45 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector,
(...skipping 27 matching lines...) Expand all
73 void Initialize( 73 void Initialize(
74 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector); 74 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector);
75 75
76 // Returns the worker pool that runs Tasks with |traits|. 76 // Returns the worker pool that runs Tasks with |traits|.
77 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); 77 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits);
78 78
79 // Callback invoked when a non-single-thread |sequence| isn't empty after a 79 // Callback invoked when a non-single-thread |sequence| isn't empty after a
80 // worker pops a Task from it. 80 // worker pops a Task from it.
81 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); 81 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence);
82 82
83 TaskTracker task_tracker_;
84 Thread service_thread_; 83 Thread service_thread_;
84 std::unique_ptr<TaskTracker> task_tracker_;
85 std::unique_ptr<DelayedTaskManager> delayed_task_manager_; 85 std::unique_ptr<DelayedTaskManager> delayed_task_manager_;
86 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; 86 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_;
87 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_; 87 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_;
88 88
89 #if DCHECK_IS_ON() 89 #if DCHECK_IS_ON()
90 // Set once JoinForTesting() has returned. 90 // Set once JoinForTesting() has returned.
91 AtomicFlag join_for_testing_returned_; 91 AtomicFlag join_for_testing_returned_;
92 #endif 92 #endif
93 93
94 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); 94 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl);
95 }; 95 };
96 96
97 } // namespace internal 97 } // namespace internal
98 } // namespace base 98 } // namespace base
99 99
100 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ 100 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698