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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = | 64 base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool = |
65 LAZY_INSTANCE_INITIALIZER; | 65 LAZY_INSTANCE_INITIALIZER; |
66 | 66 |
67 class WorkerThread : public PlatformThread::Delegate { | 67 class WorkerThread : public PlatformThread::Delegate { |
68 public: | 68 public: |
69 WorkerThread(const std::string& name_prefix, | 69 WorkerThread(const std::string& name_prefix, |
70 base::PosixDynamicThreadPool* pool) | 70 base::PosixDynamicThreadPool* pool) |
71 : name_prefix_(name_prefix), | 71 : name_prefix_(name_prefix), |
72 pool_(pool) {} | 72 pool_(pool) {} |
73 | 73 |
74 virtual void ThreadMain() OVERRIDE; | 74 void ThreadMain() override; |
75 | 75 |
76 private: | 76 private: |
77 const std::string name_prefix_; | 77 const std::string name_prefix_; |
78 scoped_refptr<base::PosixDynamicThreadPool> pool_; | 78 scoped_refptr<base::PosixDynamicThreadPool> pool_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(WorkerThread); | 80 DISALLOW_COPY_AND_ASSIGN(WorkerThread); |
81 }; | 81 }; |
82 | 82 |
83 void WorkerThread::ThreadMain() { | 83 void WorkerThread::ThreadMain() { |
84 g_worker_pool_running_on_this_thread.Get().Set(true); | 84 g_worker_pool_running_on_this_thread.Get().Set(true); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return PendingTask(FROM_HERE, base::Closure()); | 193 return PendingTask(FROM_HERE, base::Closure()); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 PendingTask pending_task = pending_tasks_.front(); | 197 PendingTask pending_task = pending_tasks_.front(); |
198 pending_tasks_.pop(); | 198 pending_tasks_.pop(); |
199 return pending_task; | 199 return pending_task; |
200 } | 200 } |
201 | 201 |
202 } // namespace base | 202 } // namespace base |
OLD | NEW |