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

Unified Diff: base/mac/dispatch_source_mach_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/linux_util.cc ('k') | base/mac/mach_port_broker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/dispatch_source_mach_unittest.cc
diff --git a/base/mac/dispatch_source_mach_unittest.cc b/base/mac/dispatch_source_mach_unittest.cc
index 82dc13643c4ad7e00eeeb5b29c5e0b0e6ed89c16..738a1372081f3f2837e430f494e1e32792261d7e 100644
--- a/base/mac/dispatch_source_mach_unittest.cc
+++ b/base/mac/dispatch_source_mach_unittest.cc
@@ -6,9 +6,10 @@
#include <mach/mach.h>
+#include <memory>
+
#include "base/logging.h"
#include "base/mac/scoped_mach_port.h"
-#include "base/memory/scoped_ptr.h"
#include "base/test/test_timeouts.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -75,18 +76,17 @@ TEST_F(DispatchSourceMachTest, ReceiveAfterResume) {
TEST_F(DispatchSourceMachTest, NoMessagesAfterDestruction) {
mach_port_t port = GetPort();
- scoped_ptr<int> count(new int(0));
+ std::unique_ptr<int> count(new int(0));
int* __block count_ptr = count.get();
- scoped_ptr<DispatchSourceMach> source(new DispatchSourceMach(
- "org.chromium.base.test.NoMessagesAfterDestruction",
- port, ^{
- mach_msg_empty_rcv_t msg = {{0}};
- msg.header.msgh_size = sizeof(msg);
- msg.header.msgh_local_port = port;
- mach_msg_receive(&msg.header);
- LOG(INFO) << "Receieve " << *count_ptr;
- ++(*count_ptr);
+ std::unique_ptr<DispatchSourceMach> source(new DispatchSourceMach(
+ "org.chromium.base.test.NoMessagesAfterDestruction", port, ^{
+ mach_msg_empty_rcv_t msg = {{0}};
+ msg.header.msgh_size = sizeof(msg);
+ msg.header.msgh_local_port = port;
+ mach_msg_receive(&msg.header);
+ LOG(INFO) << "Receieve " << *count_ptr;
+ ++(*count_ptr);
}));
source->Resume();
@@ -107,7 +107,7 @@ TEST_F(DispatchSourceMachTest, NoMessagesAfterDestruction) {
// pointer the handler dereferences. The test will crash if |count_ptr|
// is being used after "free".
if (i == 5) {
- scoped_ptr<DispatchSourceMach>* source_ptr = &source;
+ std::unique_ptr<DispatchSourceMach>* source_ptr = &source;
dispatch_async(queue, ^{
source_ptr->reset();
count_ptr = reinterpret_cast<int*>(0xdeaddead);
« no previous file with comments | « base/linux_util.cc ('k') | base/mac/mach_port_broker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698