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

Unified Diff: base/memory/shared_memory_mac_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/scoped_vector_unittest.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_mac_unittest.cc
diff --git a/base/memory/shared_memory_mac_unittest.cc b/base/memory/shared_memory_mac_unittest.cc
index af120bfa6c3a32dd54a0dd0301c26262b5292485..c7d20ec049358c92880d9237d6958f0959e9d17c 100644
--- a/base/memory/shared_memory_mac_unittest.cc
+++ b/base/memory/shared_memory_mac_unittest.cc
@@ -54,13 +54,13 @@ bool GetProtections(void* address, size_t size, int* current, int* max) {
}
// Creates a new SharedMemory with the given |size|, filled with 'a'.
-scoped_ptr<SharedMemory> CreateSharedMemory(int size) {
+std::unique_ptr<SharedMemory> CreateSharedMemory(int size) {
SharedMemoryHandle shm(size);
if (!shm.IsValid()) {
LOG(ERROR) << "Failed to make SharedMemoryHandle";
return nullptr;
}
- scoped_ptr<SharedMemory> shared_memory(new SharedMemory(shm, false));
+ std::unique_ptr<SharedMemory> shared_memory(new SharedMemory(shm, false));
shared_memory->Map(size);
memset(shared_memory->memory(), 'a', size);
return shared_memory;
@@ -230,7 +230,8 @@ class SharedMemoryMacMultiProcessTest : public MultiProcessTest {
TEST_F(SharedMemoryMacMultiProcessTest, MachBasedSharedMemory) {
SetUpChild("MachBasedSharedMemoryClient");
- scoped_ptr<SharedMemory> shared_memory(CreateSharedMemory(s_memory_size));
+ std::unique_ptr<SharedMemory> shared_memory(
+ CreateSharedMemory(s_memory_size));
// Send the underlying memory object to the client process.
SendMachPort(client_port_.get(), shared_memory->handle().GetMemoryObject(),
@@ -331,7 +332,8 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachDuplicateAndClose) {
TEST_F(SharedMemoryMacMultiProcessTest, MachUnmapMap) {
mach_msg_type_number_t active_name_count = GetActiveNameCount();
- scoped_ptr<SharedMemory> shared_memory = CreateSharedMemory(s_memory_size);
+ std::unique_ptr<SharedMemory> shared_memory =
+ CreateSharedMemory(s_memory_size);
ASSERT_TRUE(shared_memory->Unmap());
ASSERT_TRUE(shared_memory->Map(s_memory_size));
shared_memory.reset();
@@ -350,7 +352,7 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachSharedMemoryTakesOwnership) {
EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
// Name count doesn't change when mapping the memory.
- scoped_ptr<SharedMemory> shared_memory(new SharedMemory(shm, false));
+ std::unique_ptr<SharedMemory> shared_memory(new SharedMemory(shm, false));
shared_memory->Map(s_memory_size);
EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
@@ -361,7 +363,8 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachSharedMemoryTakesOwnership) {
// Tests that the read-only flag works.
TEST_F(SharedMemoryMacMultiProcessTest, MachReadOnly) {
- scoped_ptr<SharedMemory> shared_memory(CreateSharedMemory(s_memory_size));
+ std::unique_ptr<SharedMemory> shared_memory(
+ CreateSharedMemory(s_memory_size));
SharedMemoryHandle shm2 = shared_memory->handle().Duplicate();
ASSERT_TRUE(shm2.IsValid());
@@ -375,7 +378,8 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcess) {
mach_msg_type_number_t active_name_count = GetActiveNameCount();
{
- scoped_ptr<SharedMemory> shared_memory(CreateSharedMemory(s_memory_size));
+ std::unique_ptr<SharedMemory> shared_memory(
+ CreateSharedMemory(s_memory_size));
SharedMemoryHandle shm2;
ASSERT_TRUE(shared_memory->ShareToProcess(GetCurrentProcId(), &shm2));
@@ -393,7 +397,8 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcess) {
// Tests that the method ShareReadOnlyToProcess() creates a memory object that
// is read only.
TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonly) {
- scoped_ptr<SharedMemory> shared_memory(CreateSharedMemory(s_memory_size));
+ std::unique_ptr<SharedMemory> shared_memory(
+ CreateSharedMemory(s_memory_size));
// Check the protection levels.
int current_prot, max_prot;
@@ -435,7 +440,8 @@ TEST_F(SharedMemoryMacMultiProcessTest, MachShareToProcessReadonlyLeak) {
mach_msg_type_number_t active_name_count = GetActiveNameCount();
{
- scoped_ptr<SharedMemory> shared_memory(CreateSharedMemory(s_memory_size));
+ std::unique_ptr<SharedMemory> shared_memory(
+ CreateSharedMemory(s_memory_size));
SharedMemoryHandle shm2;
ASSERT_TRUE(
« no previous file with comments | « base/memory/scoped_vector_unittest.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698