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/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Create a process-wide unique ID to represent this task in trace events. This | 212 // Create a process-wide unique ID to represent this task in trace events. This |
213 // will be mangled with a Process ID hash to reduce the likelyhood of colliding | 213 // will be mangled with a Process ID hash to reduce the likelyhood of colliding |
214 // with MessageLoop pointers on other processes. | 214 // with MessageLoop pointers on other processes. |
215 uint64 GetTaskTraceID(const SequencedTask& task, | 215 uint64 GetTaskTraceID(const SequencedTask& task, |
216 void* pool) { | 216 void* pool) { |
217 return (static_cast<uint64>(task.trace_id) << 32) | | 217 return (static_cast<uint64>(task.trace_id) << 32) | |
218 static_cast<uint64>(reinterpret_cast<intptr_t>(pool)); | 218 static_cast<uint64>(reinterpret_cast<intptr_t>(pool)); |
219 } | 219 } |
220 | 220 |
221 base::LazyInstance<base::ThreadLocalPointer< | 221 base::LazyInstance<base::ThreadLocalPointer< |
222 SequencedWorkerPool::SequenceToken> > g_lazy_tls_ptr = | 222 SequencedWorkerPool::SequenceToken> >::Leaky g_lazy_tls_ptr = |
223 LAZY_INSTANCE_INITIALIZER; | 223 LAZY_INSTANCE_INITIALIZER; |
224 | 224 |
225 } // namespace | 225 } // namespace |
226 | 226 |
227 // Worker --------------------------------------------------------------------- | 227 // Worker --------------------------------------------------------------------- |
228 | 228 |
229 class SequencedWorkerPool::Worker : public SimpleThread { | 229 class SequencedWorkerPool::Worker : public SimpleThread { |
230 public: | 230 public: |
231 // Hold a (cyclic) ref to |worker_pool|, since we want to keep it | 231 // Hold a (cyclic) ref to |worker_pool|, since we want to keep it |
232 // around as long as we are running. | 232 // around as long as we are running. |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { | 1278 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { |
1279 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); | 1279 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); |
1280 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); | 1280 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); |
1281 } | 1281 } |
1282 | 1282 |
1283 bool SequencedWorkerPool::IsShutdownInProgress() { | 1283 bool SequencedWorkerPool::IsShutdownInProgress() { |
1284 return inner_->IsShutdownInProgress(); | 1284 return inner_->IsShutdownInProgress(); |
1285 } | 1285 } |
1286 | 1286 |
1287 } // namespace base | 1287 } // namespace base |
OLD | NEW |