| OLD | NEW |
| 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_thread_pool_impl.h" | 5 #include "base/task_scheduler/scheduler_thread_pool_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const Closure& closure, | 139 const Closure& closure, |
| 140 base::TimeDelta delay) override { | 140 base::TimeDelta delay) override { |
| 141 // Tasks are never nested within the task scheduler. | 141 // Tasks are never nested within the task scheduler. |
| 142 return PostDelayedTask(from_here, closure, delay); | 142 return PostDelayedTask(from_here, closure, delay); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool RunsTasksOnCurrentThread() const override { | 145 bool RunsTasksOnCurrentThread() const override { |
| 146 return tls_current_worker_thread.Get().Get() == worker_thread_; | 146 return tls_current_worker_thread.Get().Get() == worker_thread_; |
| 147 } | 147 } |
| 148 | 148 |
| 149 const char* GetThreadName() const override { |
| 150 return worker_thread_->GetThreadName(); |
| 151 } |
| 152 |
| 149 private: | 153 private: |
| 150 ~SchedulerSingleThreadTaskRunner() override = default; | 154 ~SchedulerSingleThreadTaskRunner() override = default; |
| 151 | 155 |
| 152 // Sequence for all Tasks posted through this TaskRunner. | 156 // Sequence for all Tasks posted through this TaskRunner. |
| 153 const scoped_refptr<Sequence> sequence_ = new Sequence; | 157 const scoped_refptr<Sequence> sequence_ = new Sequence; |
| 154 | 158 |
| 155 const TaskTraits traits_; | 159 const TaskTraits traits_; |
| 156 SchedulerThreadPool* const thread_pool_; | 160 SchedulerThreadPool* const thread_pool_; |
| 157 SchedulerWorkerThread* const worker_thread_; | 161 SchedulerWorkerThread* const worker_thread_; |
| 158 | 162 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 536 } |
| 533 | 537 |
| 534 void SchedulerThreadPoolImpl::RemoveFromIdleWorkerThreadsStack( | 538 void SchedulerThreadPoolImpl::RemoveFromIdleWorkerThreadsStack( |
| 535 SchedulerWorkerThread* worker_thread) { | 539 SchedulerWorkerThread* worker_thread) { |
| 536 AutoSchedulerLock auto_lock(idle_worker_threads_stack_lock_); | 540 AutoSchedulerLock auto_lock(idle_worker_threads_stack_lock_); |
| 537 idle_worker_threads_stack_.Remove(worker_thread); | 541 idle_worker_threads_stack_.Remove(worker_thread); |
| 538 } | 542 } |
| 539 | 543 |
| 540 } // namespace internal | 544 } // namespace internal |
| 541 } // namespace base | 545 } // namespace base |
| OLD | NEW |