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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = | 55 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = |
56 LAZY_INSTANCE_INITIALIZER; | 56 LAZY_INSTANCE_INITIALIZER; |
57 | 57 |
58 class WorkerThread : public PlatformThread::Delegate { | 58 class WorkerThread : public PlatformThread::Delegate { |
59 public: | 59 public: |
60 WorkerThread(const std::string& name_prefix, | 60 WorkerThread(const std::string& name_prefix, |
61 base::PosixDynamicThreadPool* pool) | 61 base::PosixDynamicThreadPool* pool) |
62 : name_prefix_(name_prefix), | 62 : name_prefix_(name_prefix), |
63 pool_(pool) {} | 63 pool_(pool) {} |
64 | 64 |
65 virtual void ThreadMain(); | 65 virtual void ThreadMain() OVERRIDE; |
66 | 66 |
67 private: | 67 private: |
68 const std::string name_prefix_; | 68 const std::string name_prefix_; |
69 scoped_refptr<base::PosixDynamicThreadPool> pool_; | 69 scoped_refptr<base::PosixDynamicThreadPool> pool_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(WorkerThread); | 71 DISALLOW_COPY_AND_ASSIGN(WorkerThread); |
72 }; | 72 }; |
73 | 73 |
74 void WorkerThread::ThreadMain() { | 74 void WorkerThread::ThreadMain() { |
75 const std::string name = base::StringPrintf( | 75 const std::string name = base::StringPrintf( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return PendingTask(FROM_HERE, base::Closure()); | 179 return PendingTask(FROM_HERE, base::Closure()); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 PendingTask pending_task = pending_tasks_.front(); | 183 PendingTask pending_task = pending_tasks_.front(); |
184 pending_tasks_.pop(); | 184 pending_tasks_.pop(); |
185 return pending_task; | 185 return pending_task; |
186 } | 186 } |
187 | 187 |
188 } // namespace base | 188 } // namespace base |
OLD | NEW |