OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, | 50 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, |
51 Task* task, bool task_is_slow) { | 51 Task* task, bool task_is_slow) { |
52 pool_->PostTask(from_here, task); | 52 pool_->PostTask(from_here, task); |
53 } | 53 } |
54 | 54 |
55 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, | 55 void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here, |
56 const base::Closure& task, bool task_is_slow) { | 56 const base::Closure& task, 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(base::LINKER_INITIALIZED); | 60 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = |
| 61 LAZY_INSTANCE_INITIALIZER; |
61 | 62 |
62 class WorkerThread : public PlatformThread::Delegate { | 63 class WorkerThread : public PlatformThread::Delegate { |
63 public: | 64 public: |
64 WorkerThread(const std::string& name_prefix, | 65 WorkerThread(const std::string& name_prefix, |
65 base::PosixDynamicThreadPool* pool) | 66 base::PosixDynamicThreadPool* pool) |
66 : name_prefix_(name_prefix), | 67 : name_prefix_(name_prefix), |
67 pool_(pool) {} | 68 pool_(pool) {} |
68 | 69 |
69 virtual void ThreadMain(); | 70 virtual void ThreadMain(); |
70 | 71 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return PendingTask(FROM_HERE, base::Closure()); | 219 return PendingTask(FROM_HERE, base::Closure()); |
219 } | 220 } |
220 } | 221 } |
221 | 222 |
222 PendingTask pending_task = pending_tasks_.front(); | 223 PendingTask pending_task = pending_tasks_.front(); |
223 pending_tasks_.pop(); | 224 pending_tasks_.pop(); |
224 return pending_task; | 225 return pending_task; |
225 } | 226 } |
226 | 227 |
227 } // namespace base | 228 } // namespace base |
OLD | NEW |