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 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 | 12 |
13 SequencedWorkerPoolOwner::SequencedWorkerPoolOwner( | 13 SequencedWorkerPoolOwner::SequencedWorkerPoolOwner( |
14 size_t max_threads, | 14 size_t max_threads, |
15 const std::string& thread_name_prefix) | 15 const std::string& thread_name_prefix) |
16 : constructor_message_loop_(MessageLoop::current()), | 16 : constructor_message_loop_(MessageLoop::current()), |
17 pool_(new SequencedWorkerPool(max_threads, thread_name_prefix, this)), | 17 pool_(new SequencedWorkerPool(max_threads, |
| 18 thread_name_prefix, |
| 19 TaskPriority::USER_VISIBLE, |
| 20 this)), |
18 has_work_call_count_(0) {} | 21 has_work_call_count_(0) {} |
19 | 22 |
20 SequencedWorkerPoolOwner::~SequencedWorkerPoolOwner() { | 23 SequencedWorkerPoolOwner::~SequencedWorkerPoolOwner() { |
21 pool_->Shutdown(); | 24 pool_->Shutdown(); |
22 pool_ = NULL; | 25 pool_ = NULL; |
23 | 26 |
24 // Spin the current message loop until SWP destruction verified in OnDestruct. | 27 // Spin the current message loop until SWP destruction verified in OnDestruct. |
25 exit_loop_.Run(); | 28 exit_loop_.Run(); |
26 } | 29 } |
27 | 30 |
(...skipping 24 matching lines...) Expand all Loading... |
52 will_wait_for_shutdown_callback_ = Closure(); | 55 will_wait_for_shutdown_callback_ = Closure(); |
53 } | 56 } |
54 } | 57 } |
55 | 58 |
56 void SequencedWorkerPoolOwner::OnDestruct() { | 59 void SequencedWorkerPoolOwner::OnDestruct() { |
57 constructor_message_loop_->task_runner()->PostTask(FROM_HERE, | 60 constructor_message_loop_->task_runner()->PostTask(FROM_HERE, |
58 exit_loop_.QuitClosure()); | 61 exit_loop_.QuitClosure()); |
59 } | 62 } |
60 | 63 |
61 } // namespace base | 64 } // namespace base |
OLD | NEW |