| 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/test/sequenced_worker_pool_owner.h" | 5 #include "base/test/sequenced_worker_pool_owner.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 void SequencedWorkerPoolOwner::OnHasWork() { | 38 void SequencedWorkerPoolOwner::OnHasWork() { |
| 39 AutoLock lock(has_work_lock_); | 39 AutoLock lock(has_work_lock_); |
| 40 ++has_work_call_count_; | 40 ++has_work_call_count_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SequencedWorkerPoolOwner::WillWaitForShutdown() { | 43 void SequencedWorkerPoolOwner::WillWaitForShutdown() { |
| 44 if (!will_wait_for_shutdown_callback_.is_null()) { | 44 if (!will_wait_for_shutdown_callback_.is_null()) { |
| 45 will_wait_for_shutdown_callback_.Run(); | 45 will_wait_for_shutdown_callback_.Run(); |
| 46 |
| 47 // Release the reference to the callback to prevent retain cycles. |
| 48 will_wait_for_shutdown_callback_ = Closure(); |
| 46 } | 49 } |
| 47 } | 50 } |
| 48 | 51 |
| 49 void SequencedWorkerPoolOwner::OnDestruct() { | 52 void SequencedWorkerPoolOwner::OnDestruct() { |
| 50 constructor_message_loop_->PostTask( | 53 constructor_message_loop_->PostTask( |
| 51 FROM_HERE, | 54 FROM_HERE, |
| 52 constructor_message_loop_->QuitWhenIdleClosure()); | 55 constructor_message_loop_->QuitWhenIdleClosure()); |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace base | 58 } // namespace base |
| OLD | NEW |