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

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

Issue 2692863012: SchedulerWorker Refcounting for Destruction in Production (Closed)
Patch Set: Remove Last Vestiges of std::unique_ptr SchedulerWorker 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_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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void RemoveFromIdleWorkersStack(SchedulerWorker* worker); 138 void RemoveFromIdleWorkersStack(SchedulerWorker* worker);
139 139
140 // Returns true if worker thread detachment is permitted. 140 // Returns true if worker thread detachment is permitted.
141 bool CanWorkerDetachForTesting(); 141 bool CanWorkerDetachForTesting();
142 142
143 // The name of this worker pool, used to label its worker threads. 143 // The name of this worker pool, used to label its worker threads.
144 const std::string name_; 144 const std::string name_;
145 145
146 // All worker owned by this worker pool. Only modified during initialization 146 // All worker owned by this worker pool. Only modified during initialization
147 // of the worker pool. 147 // of the worker pool.
148 std::vector<std::unique_ptr<SchedulerWorker>> workers_; 148 std::vector<scoped_refptr<SchedulerWorker>> workers_;
149 149
150 // Synchronizes access to |next_worker_index_|. 150 // Synchronizes access to |next_worker_index_|.
151 SchedulerLock next_worker_index_lock_; 151 SchedulerLock next_worker_index_lock_;
152 152
153 // Index of the worker that will be assigned to the next single-threaded 153 // Index of the worker that will be assigned to the next single-threaded
154 // TaskRunner returned by this pool. 154 // TaskRunner returned by this pool.
155 size_t next_worker_index_ = 0; 155 size_t next_worker_index_ = 0;
156 156
157 // PriorityQueue from which all threads of this worker pool get work. 157 // PriorityQueue from which all threads of this worker pool get work.
158 PriorityQueue shared_priority_queue_; 158 PriorityQueue shared_priority_queue_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 TaskTracker* const task_tracker_; 204 TaskTracker* const task_tracker_;
205 DelayedTaskManager* const delayed_task_manager_; 205 DelayedTaskManager* const delayed_task_manager_;
206 206
207 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl); 207 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerPoolImpl);
208 }; 208 };
209 209
210 } // namespace internal 210 } // namespace internal
211 } // namespace base 211 } // namespace base
212 212
213 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_ 213 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_IMPL_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker.cc ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698