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

Side by Side Diff: net/udp/udp_socket_perftest.cc

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu 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 unified diff | Download patch
« no previous file with comments | « net/udp/udp_net_log_parameters.cc ('k') | net/udp/udp_socket_posix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/perf_time_logger.h" 9 #include "base/test/perf_time_logger.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 } 82 }
83 83
84 void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) { 84 void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) {
85 base::MessageLoopForIO message_loop; 85 base::MessageLoopForIO message_loop;
86 const uint16_t kPort = 9999; 86 const uint16_t kPort = 9999;
87 87
88 // Setup the server to listen. 88 // Setup the server to listen.
89 IPEndPoint bind_address; 89 IPEndPoint bind_address;
90 CreateUDPAddress("127.0.0.1", kPort, &bind_address); 90 CreateUDPAddress("127.0.0.1", kPort, &bind_address);
91 scoped_ptr<UDPServerSocket> server( 91 std::unique_ptr<UDPServerSocket> server(
92 new UDPServerSocket(nullptr, NetLog::Source())); 92 new UDPServerSocket(nullptr, NetLog::Source()));
93 #if defined(OS_WIN) 93 #if defined(OS_WIN)
94 if (use_nonblocking_io) 94 if (use_nonblocking_io)
95 server->UseNonBlockingIO(); 95 server->UseNonBlockingIO();
96 #endif 96 #endif
97 int rv = server->Listen(bind_address); 97 int rv = server->Listen(bind_address);
98 ASSERT_EQ(OK, rv); 98 ASSERT_EQ(OK, rv);
99 99
100 // Setup the client. 100 // Setup the client.
101 IPEndPoint server_address; 101 IPEndPoint server_address;
102 CreateUDPAddress("127.0.0.1", kPort, &server_address); 102 CreateUDPAddress("127.0.0.1", kPort, &server_address);
103 scoped_ptr<UDPClientSocket> client( 103 std::unique_ptr<UDPClientSocket> client(
104 new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(), 104 new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
105 nullptr, NetLog::Source())); 105 nullptr, NetLog::Source()));
106 #if defined(OS_WIN) 106 #if defined(OS_WIN)
107 if (use_nonblocking_io) 107 if (use_nonblocking_io)
108 client->UseNonBlockingIO(); 108 client->UseNonBlockingIO();
109 #endif 109 #endif
110 rv = client->Connect(server_address); 110 rv = client->Connect(server_address);
111 EXPECT_EQ(OK, rv); 111 EXPECT_EQ(OK, rv);
112 112
113 base::RunLoop run_loop; 113 base::RunLoop run_loop;
(...skipping 15 matching lines...) Expand all
129 #if defined(OS_WIN) 129 #if defined(OS_WIN)
130 TEST_F(UDPSocketPerfTest, WriteNonBlocking) { 130 TEST_F(UDPSocketPerfTest, WriteNonBlocking) {
131 base::PerfTimeLogger timer("UDP_socket_write_nonblocking"); 131 base::PerfTimeLogger timer("UDP_socket_write_nonblocking");
132 WriteBenchmark(true); 132 WriteBenchmark(true);
133 } 133 }
134 #endif 134 #endif
135 135
136 } // namespace 136 } // namespace
137 137
138 } // namespace net 138 } // namespace net
OLDNEW
« no previous file with comments | « net/udp/udp_net_log_parameters.cc ('k') | net/udp/udp_socket_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698