Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: base/threading/worker_pool_posix_unittest.cc

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 class PosixDynamicThreadPoolTest : public testing::Test { 90 class PosixDynamicThreadPoolTest : public testing::Test {
91 protected: 91 protected:
92 PosixDynamicThreadPoolTest() 92 PosixDynamicThreadPoolTest()
93 : pool_(new base::PosixDynamicThreadPool("dynamic_pool", 60*60)), 93 : pool_(new base::PosixDynamicThreadPool("dynamic_pool", 60*60)),
94 peer_(pool_.get()), 94 peer_(pool_.get()),
95 counter_(0), 95 counter_(0),
96 num_waiting_to_start_(0), 96 num_waiting_to_start_(0),
97 num_waiting_to_start_cv_(&num_waiting_to_start_lock_), 97 num_waiting_to_start_cv_(&num_waiting_to_start_lock_),
98 start_(true, false) {} 98 start_(true, false) {}
99 99
100 virtual void SetUp() OVERRIDE { 100 void SetUp() override {
101 peer_.set_num_idle_threads_cv(new ConditionVariable(peer_.lock())); 101 peer_.set_num_idle_threads_cv(new ConditionVariable(peer_.lock()));
102 } 102 }
103 103
104 virtual void TearDown() OVERRIDE { 104 void TearDown() override {
105 // Wake up the idle threads so they can terminate. 105 // Wake up the idle threads so they can terminate.
106 if (pool_.get()) pool_->Terminate(); 106 if (pool_.get()) pool_->Terminate();
107 } 107 }
108 108
109 void WaitForTasksToStart(int num_tasks) { 109 void WaitForTasksToStart(int num_tasks) {
110 base::AutoLock num_waiting_to_start_locked(num_waiting_to_start_lock_); 110 base::AutoLock num_waiting_to_start_locked(num_waiting_to_start_lock_);
111 while (num_waiting_to_start_ < num_tasks) { 111 while (num_waiting_to_start_ < num_tasks) {
112 num_waiting_to_start_cv_.Wait(); 112 num_waiting_to_start_cv_.Wait();
113 } 113 }
114 } 114 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // joined, the next-created thread can get a re-used ID if the allocation of 244 // joined, the next-created thread can get a re-used ID if the allocation of
245 // the pthread_t structure is taken from the free list. Therefore, there can 245 // the pthread_t structure is taken from the free list. Therefore, there can
246 // be either 2 or 3 unique thread IDs in the set at this stage in the test. 246 // be either 2 or 3 unique thread IDs in the set at this stage in the test.
247 EXPECT_TRUE(unique_threads_.size() >= 2 && unique_threads_.size() <= 3) 247 EXPECT_TRUE(unique_threads_.size() >= 2 && unique_threads_.size() <= 3)
248 << "unique_threads_.size() = " << unique_threads_.size(); 248 << "unique_threads_.size() = " << unique_threads_.size();
249 EXPECT_EQ(1, peer_.num_idle_threads()); 249 EXPECT_EQ(1, peer_.num_idle_threads());
250 EXPECT_EQ(4, counter_); 250 EXPECT_EQ(4, counter_);
251 } 251 }
252 252
253 } // namespace base 253 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698