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

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

Issue 2698843006: Introduce SchedulerSingleThreadTaskRunnerManager (Closed)
Patch Set: Merge in https://codereview.chromium.org/2726073002/ Created 3 years, 9 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 #include "base/task_scheduler/scheduler_worker_pool_impl.h" 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const SchedulerWorker* worker) { 134 const SchedulerWorker* worker) {
135 auto it = std::find_if(workers.begin(), workers.end(), 135 auto it = std::find_if(workers.begin(), workers.end(),
136 [worker](const scoped_refptr<SchedulerWorker>& i) { 136 [worker](const scoped_refptr<SchedulerWorker>& i) {
137 return i.get() == worker; 137 return i.get() == worker;
138 }); 138 });
139 return it != workers.end(); 139 return it != workers.end();
140 } 140 }
141 141
142 } // namespace 142 } // namespace
143 143
144 // TODO(http://crbug.com/694823): Remove this and supporting framework.
144 // A task runner that runs tasks with the SINGLE_THREADED ExecutionMode. 145 // A task runner that runs tasks with the SINGLE_THREADED ExecutionMode.
145 class SchedulerWorkerPoolImpl::SchedulerSingleThreadTaskRunner : 146 class SchedulerWorkerPoolImpl::SchedulerSingleThreadTaskRunner :
146 public SingleThreadTaskRunner { 147 public SingleThreadTaskRunner {
147 public: 148 public:
148 // Constructs a SchedulerSingleThreadTaskRunner which can be used to post 149 // Constructs a SchedulerSingleThreadTaskRunner which can be used to post
149 // tasks so long as |worker_pool| and |worker| are alive. 150 // tasks so long as |worker_pool| and |worker| are alive.
150 // TODO(robliao): Find a concrete way to manage the memory of |worker_pool| 151 // TODO(robliao): Find a concrete way to manage the memory of |worker_pool|
151 // and |worker|. 152 // and |worker|.
152 SchedulerSingleThreadTaskRunner(const TaskTraits& traits, 153 SchedulerSingleThreadTaskRunner(const TaskTraits& traits,
153 SchedulerWorkerPool* worker_pool, 154 SchedulerWorkerPool* worker_pool,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); 759 AutoSchedulerLock auto_lock(idle_workers_stack_lock_);
759 idle_workers_stack_.Remove(worker); 760 idle_workers_stack_.Remove(worker);
760 } 761 }
761 762
762 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { 763 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() {
763 return !worker_detachment_disallowed_.IsSet(); 764 return !worker_detachment_disallowed_.IsSet();
764 } 765 }
765 766
766 } // namespace internal 767 } // namespace internal
767 } // namespace base 768 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker.cc ('k') | base/task_scheduler/scheduler_worker_pool_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698