| 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 <vector> | 10 #include <vector> |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 DCHECK(constructor_message_loop_.get()); | 645 DCHECK(constructor_message_loop_.get()); |
| 646 } | 646 } |
| 647 | 647 |
| 648 SequencedWorkerPool::~SequencedWorkerPool() {} | 648 SequencedWorkerPool::~SequencedWorkerPool() {} |
| 649 | 649 |
| 650 void SequencedWorkerPool::OnDestruct() const { | 650 void SequencedWorkerPool::OnDestruct() const { |
| 651 // TODO(akalin): Once we can easily check if we're on a worker | 651 // TODO(akalin): Once we can easily check if we're on a worker |
| 652 // thread or not, use that instead of restricting destruction to | 652 // thread or not, use that instead of restricting destruction to |
| 653 // only the constructor message loop. | 653 // only the constructor message loop. |
| 654 if (constructor_message_loop_->BelongsToCurrentThread()) { | 654 if (constructor_message_loop_->BelongsToCurrentThread()) { |
| 655 LOG(INFO) << "Deleting on this thread"; | |
| 656 delete this; | 655 delete this; |
| 657 } else { | 656 } else { |
| 658 LOG(INFO) << "Deleting soon"; | |
| 659 constructor_message_loop_->DeleteSoon(FROM_HERE, this); | 657 constructor_message_loop_->DeleteSoon(FROM_HERE, this); |
| 660 } | 658 } |
| 661 } | 659 } |
| 662 | 660 |
| 663 SequencedWorkerPool::SequenceToken SequencedWorkerPool::GetSequenceToken() { | 661 SequencedWorkerPool::SequenceToken SequencedWorkerPool::GetSequenceToken() { |
| 664 return inner_->GetSequenceToken(); | 662 return inner_->GetSequenceToken(); |
| 665 } | 663 } |
| 666 | 664 |
| 667 SequencedWorkerPool::SequenceToken SequencedWorkerPool::GetNamedSequenceToken( | 665 SequencedWorkerPool::SequenceToken SequencedWorkerPool::GetNamedSequenceToken( |
| 668 const std::string& name) { | 666 const std::string& name) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 739 |
| 742 void SequencedWorkerPool::Shutdown() { | 740 void SequencedWorkerPool::Shutdown() { |
| 743 inner_->Shutdown(); | 741 inner_->Shutdown(); |
| 744 } | 742 } |
| 745 | 743 |
| 746 void SequencedWorkerPool::SetTestingObserver(TestingObserver* observer) { | 744 void SequencedWorkerPool::SetTestingObserver(TestingObserver* observer) { |
| 747 inner_->SetTestingObserver(observer); | 745 inner_->SetTestingObserver(observer); |
| 748 } | 746 } |
| 749 | 747 |
| 750 } // namespace base | 748 } // namespace base |
| OLD | NEW |