| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 WorkerPoolImpl::WorkerPoolImpl() | 46 WorkerPoolImpl::WorkerPoolImpl() |
| 47 : pool_(new base::PosixDynamicThreadPool("WorkerPool", | 47 : pool_(new base::PosixDynamicThreadPool("WorkerPool", |
| 48 kIdleSecondsBeforeExit)) {} | 48 kIdleSecondsBeforeExit)) {} |
| 49 | 49 |
| 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> 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) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 return PendingTask(FROM_HERE, base::Closure()); | 185 return PendingTask(FROM_HERE, base::Closure()); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 PendingTask pending_task = pending_tasks_.front(); | 189 PendingTask pending_task = pending_tasks_.front(); |
| 190 pending_tasks_.pop(); | 190 pending_tasks_.pop(); |
| 191 return pending_task; | 191 return pending_task; |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace base | 194 } // namespace base |
| OLD | NEW |