| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/threading/worker_pool_posix.h" | 5 #include "base/threading/worker_pool_posix.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 WorkerPoolImpl::~WorkerPoolImpl() { | 50 WorkerPoolImpl::~WorkerPoolImpl() { |
| 51 pool_->Terminate(); | 51 pool_->Terminate(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, | 54 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, |
| 55 const base::Closure& task, | 55 const base::Closure& task, |
| 56 bool task_is_slow) { | 56 bool task_is_slow) { |
| 57 pool_->PostTask(from_here, task); | 57 pool_->PostTask(from_here, task); |
| 58 } | 58 } |
| 59 | 59 |
| 60 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = | 60 base::LazyInstance<WorkerPoolImpl>::Leaky g_lazy_worker_pool = |
| 61 LAZY_INSTANCE_INITIALIZER; | 61 LAZY_INSTANCE_INITIALIZER; |
| 62 | 62 |
| 63 class WorkerThread : public PlatformThread::Delegate { | 63 class WorkerThread : public PlatformThread::Delegate { |
| 64 public: | 64 public: |
| 65 WorkerThread(const std::string& name_prefix, | 65 WorkerThread(const std::string& name_prefix, |
| 66 base::PosixDynamicThreadPool* pool) | 66 base::PosixDynamicThreadPool* pool) |
| 67 : name_prefix_(name_prefix), pool_(pool) {} | 67 : name_prefix_(name_prefix), pool_(pool) {} |
| 68 | 68 |
| 69 void ThreadMain() override; | 69 void ThreadMain() override; |
| 70 | 70 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return PendingTask(FROM_HERE, base::Closure()); | 184 return PendingTask(FROM_HERE, base::Closure()); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 PendingTask pending_task = std::move(pending_tasks_.front()); | 188 PendingTask pending_task = std::move(pending_tasks_.front()); |
| 189 pending_tasks_.pop(); | 189 pending_tasks_.pop(); |
| 190 return pending_task; | 190 return pending_task; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace base | 193 } // namespace base |
| OLD | NEW |