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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 return shutdown_called_; | 978 return shutdown_called_; |
979 } | 979 } |
980 | 980 |
981 void SequencedWorkerPool::Inner::ThreadLoop(Worker* this_worker) { | 981 void SequencedWorkerPool::Inner::ThreadLoop(Worker* this_worker) { |
982 DCHECK_EQ(AllPoolsState::USE_WORKER_POOL, g_all_pools_state); | 982 DCHECK_EQ(AllPoolsState::USE_WORKER_POOL, g_all_pools_state); |
983 { | 983 { |
984 AutoLock lock(lock_); | 984 AutoLock lock(lock_); |
985 DCHECK(thread_being_created_); | 985 DCHECK(thread_being_created_); |
986 thread_being_created_ = false; | 986 thread_being_created_ = false; |
987 auto result = threads_.insert( | 987 auto result = threads_.insert( |
988 std::make_pair(PlatformThread::CurrentId(), WrapUnique(this_worker))); | 988 std::make_pair(this_worker->tid(), WrapUnique(this_worker))); |
989 DCHECK(result.second); | 989 DCHECK(result.second); |
990 | 990 |
991 while (true) { | 991 while (true) { |
992 #if defined(OS_MACOSX) | 992 #if defined(OS_MACOSX) |
993 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 993 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
994 #endif | 994 #endif |
995 | 995 |
996 HandleCleanup(); | 996 HandleCleanup(); |
997 | 997 |
998 // See GetWork for what delete_these_outside_lock is doing. | 998 // See GetWork for what delete_these_outside_lock is doing. |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 bool SequencedWorkerPool::IsShutdownInProgress() { | 1642 bool SequencedWorkerPool::IsShutdownInProgress() { |
1643 return inner_->IsShutdownInProgress(); | 1643 return inner_->IsShutdownInProgress(); |
1644 } | 1644 } |
1645 | 1645 |
1646 bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread( | 1646 bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread( |
1647 SequenceToken sequence_token) const { | 1647 SequenceToken sequence_token) const { |
1648 return inner_->IsRunningSequenceOnCurrentThread(sequence_token); | 1648 return inner_->IsRunningSequenceOnCurrentThread(sequence_token); |
1649 } | 1649 } |
1650 | 1650 |
1651 } // namespace base | 1651 } // namespace base |
OLD | NEW |