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

Unified Diff: webrtc/base/criticalsection_unittest.cc

Issue 2812553002: Revert of Delete class ScopedPtrCollection. Replaced with vector of unique_ptr. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/scopedptrcollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/criticalsection_unittest.cc
diff --git a/webrtc/base/criticalsection_unittest.cc b/webrtc/base/criticalsection_unittest.cc
index a16f4f2d4f5809ab5133ecd7fe2ec42dde27e029..42679d987f4a6cfec4daa5007e1ee5d43c922374 100644
--- a/webrtc/base/criticalsection_unittest.cc
+++ b/webrtc/base/criticalsection_unittest.cc
@@ -18,6 +18,7 @@
#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 {
@@ -198,13 +199,13 @@
static int AtomicOp(int* i) { return AtomicOps::CompareAndSwap(i, 0, 1); }
};
-void StartThreads(std::vector<std::unique_ptr<Thread>>* threads,
+void StartThreads(ScopedPtrCollection<Thread>* threads,
MessageHandler* handler) {
for (int i = 0; i < kNumThreads; ++i) {
- std::unique_ptr<Thread> thread(new Thread());
+ Thread* thread = new Thread();
thread->Start();
thread->Post(RTC_FROM_HERE, handler);
- threads->push_back(std::move(thread));
+ threads->PushBack(thread);
}
}
@@ -247,7 +248,7 @@
TEST(AtomicOpsTest, Increment) {
// Create and start lots of threads.
AtomicOpRunner<IncrementOp, UniqueValueVerifier> runner(0);
- std::vector<std::unique_ptr<Thread>> threads;
+ ScopedPtrCollection<Thread> threads;
StartThreads(&threads, &runner);
runner.SetExpectedThreadCount(kNumThreads);
@@ -260,7 +261,7 @@
// Create and start lots of threads.
AtomicOpRunner<DecrementOp, UniqueValueVerifier> runner(
kOperationsToRun * kNumThreads);
- std::vector<std::unique_ptr<Thread>> threads;
+ ScopedPtrCollection<Thread> threads;
StartThreads(&threads, &runner);
runner.SetExpectedThreadCount(kNumThreads);
@@ -272,7 +273,7 @@
TEST(AtomicOpsTest, CompareAndSwap) {
// Create and start lots of threads.
AtomicOpRunner<CompareAndSwapOp, CompareAndSwapVerifier> runner(0);
- std::vector<std::unique_ptr<Thread>> threads;
+ ScopedPtrCollection<Thread> threads;
StartThreads(&threads, &runner);
runner.SetExpectedThreadCount(kNumThreads);
@@ -284,7 +285,7 @@
TEST(GlobalLockTest, Basic) {
// Create and start lots of threads.
LockRunner<GlobalLock> runner;
- std::vector<std::unique_ptr<Thread>> threads;
+ ScopedPtrCollection<Thread> threads;
StartThreads(&threads, &runner);
runner.SetExpectedThreadCount(kNumThreads);
@@ -296,7 +297,7 @@
TEST(CriticalSectionTest, Basic) {
// Create and start lots of threads.
LockRunner<CriticalSectionLock> runner;
- std::vector<std::unique_ptr<Thread>> threads;
+ ScopedPtrCollection<Thread> threads;
StartThreads(&threads, &runner);
runner.SetExpectedThreadCount(kNumThreads);
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/scopedptrcollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698