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

Unified Diff: base/memory/weak_ptr_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 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 | « base/memory/shared_memory_win_unittest.cc ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/weak_ptr_unittest.cc
diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc
index 5f9b6b623bb6ecba41913bb7ff16eba807ca5b07..df398d9350aeac4e6d68710434440620119461ef 100644
--- a/base/memory/weak_ptr_unittest.cc
+++ b/base/memory/weak_ptr_unittest.cc
@@ -4,12 +4,12 @@
#include "base/memory/weak_ptr.h"
+#include <memory>
#include <string>
#include "base/bind.h"
#include "base/debug/leak_annotations.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
@@ -327,7 +327,7 @@ TEST(WeakPtrTest, ObjectAndWeakPtrOnDifferentThreads) {
// Test that it is OK to create an object that supports WeakPtr on one thread,
// but use it on another. This tests that we do not trip runtime checks that
// ensure that a WeakPtr is not used by multiple threads.
- scoped_ptr<Target> target(OffThreadObjectCreator<Target>::NewObject());
+ std::unique_ptr<Target> target(OffThreadObjectCreator<Target>::NewObject());
WeakPtr<Target> weak_ptr = target->AsWeakPtr();
EXPECT_EQ(target.get(), weak_ptr.get());
}
@@ -336,7 +336,7 @@ TEST(WeakPtrTest, WeakPtrInitiateAndUseOnDifferentThreads) {
// Test that it is OK to create an object that has a WeakPtr member on one
// thread, but use it on another. This tests that we do not trip runtime
// checks that ensure that a WeakPtr is not used by multiple threads.
- scoped_ptr<Arrow> arrow(OffThreadObjectCreator<Arrow>::NewObject());
+ std::unique_ptr<Arrow> arrow(OffThreadObjectCreator<Arrow>::NewObject());
Target target;
arrow->target = target.AsWeakPtr();
EXPECT_EQ(&target, arrow->target.get());
@@ -409,7 +409,7 @@ TEST(WeakPtrTest, MoveOwnershipAfterInvalidate) {
background.Start();
Arrow arrow;
- scoped_ptr<TargetWithFactory> target(new TargetWithFactory);
+ std::unique_ptr<TargetWithFactory> target(new TargetWithFactory);
// Bind to main thread.
arrow.target = target->factory.GetWeakPtr();
@@ -579,7 +579,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadDeletesWeakPtrAfterReference) {
// (introduces deadlock on Linux).
::testing::FLAGS_gtest_death_test_style = "threadsafe";
- scoped_ptr<Target> target(new Target());
+ std::unique_ptr<Target> target(new Target());
// Main thread creates an arrow referencing the Target.
Arrow arrow;
@@ -603,7 +603,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadDeletesObjectAfterReference) {
// (introduces deadlock on Linux).
::testing::FLAGS_gtest_death_test_style = "threadsafe";
- scoped_ptr<Target> target(new Target());
+ std::unique_ptr<Target> target(new Target());
// Main thread creates an arrow referencing the Target, and references it, so
// that it becomes bound to the thread.
@@ -622,7 +622,7 @@ TEST(WeakPtrDeathTest, NonOwnerThreadReferencesObjectAfterDeletion) {
// (introduces deadlock on Linux).
::testing::FLAGS_gtest_death_test_style = "threadsafe";
- scoped_ptr<Target> target(new Target());
+ std::unique_ptr<Target> target(new Target());
// Main thread creates an arrow referencing the Target.
Arrow arrow;
« no previous file with comments | « base/memory/shared_memory_win_unittest.cc ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698