Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: base/threading/sequenced_worker_pool.cc

Issue 2685533003: Revert of Do not block in SimpleThread::Start(). (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/threading/simple_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 return shutdown_called_; 970 return shutdown_called_;
971 } 971 }
972 972
973 void SequencedWorkerPool::Inner::ThreadLoop(Worker* this_worker) { 973 void SequencedWorkerPool::Inner::ThreadLoop(Worker* this_worker) {
974 DCHECK_EQ(AllPoolsState::USE_WORKER_POOL, g_all_pools_state); 974 DCHECK_EQ(AllPoolsState::USE_WORKER_POOL, g_all_pools_state);
975 { 975 {
976 AutoLock lock(lock_); 976 AutoLock lock(lock_);
977 DCHECK(thread_being_created_); 977 DCHECK(thread_being_created_);
978 thread_being_created_ = false; 978 thread_being_created_ = false;
979 auto result = threads_.insert( 979 auto result = threads_.insert(
980 std::make_pair(PlatformThread::CurrentId(), WrapUnique(this_worker))); 980 std::make_pair(this_worker->tid(), WrapUnique(this_worker)));
981 DCHECK(result.second); 981 DCHECK(result.second);
982 982
983 while (true) { 983 while (true) {
984 #if defined(OS_MACOSX) 984 #if defined(OS_MACOSX)
985 base::mac::ScopedNSAutoreleasePool autorelease_pool; 985 base::mac::ScopedNSAutoreleasePool autorelease_pool;
986 #endif 986 #endif
987 987
988 HandleCleanup(); 988 HandleCleanup();
989 989
990 // See GetWork for what delete_these_outside_lock is doing. 990 // See GetWork for what delete_these_outside_lock is doing.
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 bool SequencedWorkerPool::IsShutdownInProgress() { 1626 bool SequencedWorkerPool::IsShutdownInProgress() {
1627 return inner_->IsShutdownInProgress(); 1627 return inner_->IsShutdownInProgress();
1628 } 1628 }
1629 1629
1630 bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread( 1630 bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread(
1631 SequenceToken sequence_token) const { 1631 SequenceToken sequence_token) const {
1632 return inner_->IsRunningSequenceOnCurrentThread(sequence_token); 1632 return inner_->IsRunningSequenceOnCurrentThread(sequence_token);
1633 } 1633 }
1634 1634
1635 } // namespace base 1635 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/threading/simple_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698