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

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

Issue 2722113006: Revert of Introduce SchedulerSingleThreadTaskRunnerManager (Closed)
Patch Set: 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.
145 // A task runner that runs tasks with the SINGLE_THREADED ExecutionMode. 144 // A task runner that runs tasks with the SINGLE_THREADED ExecutionMode.
146 class SchedulerWorkerPoolImpl::SchedulerSingleThreadTaskRunner : 145 class SchedulerWorkerPoolImpl::SchedulerSingleThreadTaskRunner :
147 public SingleThreadTaskRunner { 146 public SingleThreadTaskRunner {
148 public: 147 public:
149 // Constructs a SchedulerSingleThreadTaskRunner which can be used to post 148 // Constructs a SchedulerSingleThreadTaskRunner which can be used to post
150 // tasks so long as |worker_pool| and |worker| are alive. 149 // tasks so long as |worker_pool| and |worker| are alive.
151 // TODO(robliao): Find a concrete way to manage the memory of |worker_pool| 150 // TODO(robliao): Find a concrete way to manage the memory of |worker_pool|
152 // and |worker|. 151 // and |worker|.
153 SchedulerSingleThreadTaskRunner(const TaskTraits& traits, 152 SchedulerSingleThreadTaskRunner(const TaskTraits& traits,
154 SchedulerWorkerPool* worker_pool, 153 SchedulerWorkerPool* worker_pool,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); 758 AutoSchedulerLock auto_lock(idle_workers_stack_lock_);
760 idle_workers_stack_.Remove(worker); 759 idle_workers_stack_.Remove(worker);
761 } 760 }
762 761
763 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { 762 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() {
764 return !worker_detachment_disallowed_.IsSet(); 763 return !worker_detachment_disallowed_.IsSet();
765 } 764 }
766 765
767 } // namespace internal 766 } // namespace internal
768 } // namespace base 767 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698