Chromium Code Reviews| Index: webrtc/base/criticalsection_unittest.cc |
| diff --git a/webrtc/base/criticalsection_unittest.cc b/webrtc/base/criticalsection_unittest.cc |
| index 42679d987f4a6cfec4daa5007e1ee5d43c922374..a16f4f2d4f5809ab5133ecd7fe2ec42dde27e029 100644 |
| --- a/webrtc/base/criticalsection_unittest.cc |
| +++ b/webrtc/base/criticalsection_unittest.cc |
| @@ -18,7 +18,6 @@ |
| #include "webrtc/base/event.h" |
| #include "webrtc/base/gunit.h" |
| #include "webrtc/base/platform_thread.h" |
| -#include "webrtc/base/scopedptrcollection.h" |
| #include "webrtc/base/thread.h" |
| namespace rtc { |
| @@ -199,13 +198,13 @@ |
| static int AtomicOp(int* i) { return AtomicOps::CompareAndSwap(i, 0, 1); } |
| }; |
| -void StartThreads(ScopedPtrCollection<Thread>* threads, |
| +void StartThreads(std::vector<std::unique_ptr<Thread>>* threads, |
| MessageHandler* handler) { |
| for (int i = 0; i < kNumThreads; ++i) { |
| - Thread* thread = new Thread(); |
| + std::unique_ptr<Thread> thread(new Thread()); |
|
kwiberg-webrtc
2017/04/20 08:43:30
Nit: You could use MakeUnique. Maybe not worth bot
|
| thread->Start(); |
| thread->Post(RTC_FROM_HERE, handler); |
| - threads->PushBack(thread); |
| + threads->push_back(std::move(thread)); |
| } |
| } |
| @@ -248,7 +247,7 @@ |
| TEST(AtomicOpsTest, Increment) { |
| // Create and start lots of threads. |
| AtomicOpRunner<IncrementOp, UniqueValueVerifier> runner(0); |
| - ScopedPtrCollection<Thread> threads; |
| + std::vector<std::unique_ptr<Thread>> threads; |
| StartThreads(&threads, &runner); |
| runner.SetExpectedThreadCount(kNumThreads); |
| @@ -261,7 +260,7 @@ |
| // Create and start lots of threads. |
| AtomicOpRunner<DecrementOp, UniqueValueVerifier> runner( |
| kOperationsToRun * kNumThreads); |
| - ScopedPtrCollection<Thread> threads; |
| + std::vector<std::unique_ptr<Thread>> threads; |
| StartThreads(&threads, &runner); |
| runner.SetExpectedThreadCount(kNumThreads); |
| @@ -273,7 +272,7 @@ |
| TEST(AtomicOpsTest, CompareAndSwap) { |
| // Create and start lots of threads. |
| AtomicOpRunner<CompareAndSwapOp, CompareAndSwapVerifier> runner(0); |
| - ScopedPtrCollection<Thread> threads; |
| + std::vector<std::unique_ptr<Thread>> threads; |
| StartThreads(&threads, &runner); |
| runner.SetExpectedThreadCount(kNumThreads); |
| @@ -285,7 +284,7 @@ |
| TEST(GlobalLockTest, Basic) { |
| // Create and start lots of threads. |
| LockRunner<GlobalLock> runner; |
| - ScopedPtrCollection<Thread> threads; |
| + std::vector<std::unique_ptr<Thread>> threads; |
| StartThreads(&threads, &runner); |
| runner.SetExpectedThreadCount(kNumThreads); |
| @@ -297,7 +296,7 @@ |
| TEST(CriticalSectionTest, Basic) { |
| // Create and start lots of threads. |
| LockRunner<CriticalSectionLock> runner; |
| - ScopedPtrCollection<Thread> threads; |
| + std::vector<std::unique_ptr<Thread>> threads; |
| StartThreads(&threads, &runner); |
| runner.SetExpectedThreadCount(kNumThreads); |