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/worker_pool_posix.h" | 5 #include "base/threading/worker_pool_posix.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
11 #include "base/synchronization/condition_variable.h" | 12 #include "base/synchronization/condition_variable.h" |
12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
13 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 | 19 |
19 // Peer class to provide passthrough access to PosixDynamicThreadPool internals. | 20 // Peer class to provide passthrough access to PosixDynamicThreadPool internals. |
20 class PosixDynamicThreadPool::PosixDynamicThreadPoolPeer { | 21 class PosixDynamicThreadPool::PosixDynamicThreadPoolPeer { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // joined, the next-created thread can get a re-used ID if the allocation of | 246 // joined, the next-created thread can get a re-used ID if the allocation of |
246 // the pthread_t structure is taken from the free list. Therefore, there can | 247 // the pthread_t structure is taken from the free list. Therefore, there can |
247 // be either 2 or 3 unique thread IDs in the set at this stage in the test. | 248 // be either 2 or 3 unique thread IDs in the set at this stage in the test. |
248 EXPECT_TRUE(unique_threads_.size() >= 2 && unique_threads_.size() <= 3) | 249 EXPECT_TRUE(unique_threads_.size() >= 2 && unique_threads_.size() <= 3) |
249 << "unique_threads_.size() = " << unique_threads_.size(); | 250 << "unique_threads_.size() = " << unique_threads_.size(); |
250 EXPECT_EQ(1, peer_.num_idle_threads()); | 251 EXPECT_EQ(1, peer_.num_idle_threads()); |
251 EXPECT_EQ(4, counter_); | 252 EXPECT_EQ(4, counter_); |
252 } | 253 } |
253 | 254 |
254 } // namespace base | 255 } // namespace base |
OLD | NEW |