OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/lock.h" | 9 #include "base/lock.h" |
10 #include "base/synchronization/condition_variable.h" | 10 #include "base/synchronization/condition_variable.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
13 #include "base/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 | 17 |
18 // Peer class to provide passthrough access to PosixDynamicThreadPool internals. | 18 // Peer class to provide passthrough access to PosixDynamicThreadPool internals. |
19 class PosixDynamicThreadPool::PosixDynamicThreadPoolPeer { | 19 class PosixDynamicThreadPool::PosixDynamicThreadPoolPeer { |
20 public: | 20 public: |
21 explicit PosixDynamicThreadPoolPeer(PosixDynamicThreadPool* pool) | 21 explicit PosixDynamicThreadPoolPeer(PosixDynamicThreadPool* pool) |
22 : pool_(pool) {} | 22 : pool_(pool) {} |
23 | 23 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Add another non blocking task. There are no threads to reuse. | 259 // Add another non blocking task. There are no threads to reuse. |
260 pool_->PostTask(CreateNewIncrementingTask()); | 260 pool_->PostTask(CreateNewIncrementingTask()); |
261 WaitForIdleThreads(1); | 261 WaitForIdleThreads(1); |
262 | 262 |
263 EXPECT_EQ(3U, unique_threads_.size()); | 263 EXPECT_EQ(3U, unique_threads_.size()); |
264 EXPECT_EQ(1, peer_.num_idle_threads()); | 264 EXPECT_EQ(1, peer_.num_idle_threads()); |
265 EXPECT_EQ(4, counter_); | 265 EXPECT_EQ(4, counter_); |
266 } | 266 } |
267 | 267 |
268 } // namespace base | 268 } // namespace base |
OLD | NEW |