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

Side by Side Diff: remoting/test/fake_socket_factory.cc

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « remoting/signaling/xmpp_signal_strategy.cc ('k') | remoting/test/protocol_perftest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "remoting/test/fake_socket_factory.h" 8 #include "remoting/test/fake_socket_factory.h"
9 9
10 #include <math.h> 10 #include <math.h>
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 int port = -1; 206 int port = -1;
207 if (min_port > 0 && max_port > 0) { 207 if (min_port > 0 && max_port > 0) {
208 for (uint16 i = min_port; i <= max_port; ++i) { 208 for (uint16 i = min_port; i <= max_port; ++i) {
209 if (udp_sockets_.find(i) == udp_sockets_.end()) { 209 if (udp_sockets_.find(i) == udp_sockets_.end()) {
210 port = i; 210 port = i;
211 break; 211 break;
212 } 212 }
213 } 213 }
214 if (port < 0) 214 if (port < 0)
215 return NULL; 215 return nullptr;
216 } else { 216 } else {
217 do { 217 do {
218 port = next_port_; 218 port = next_port_;
219 next_port_ = 219 next_port_ =
220 (next_port_ >= kPortRangeEnd) ? kPortRangeStart : (next_port_ + 1); 220 (next_port_ >= kPortRangeEnd) ? kPortRangeStart : (next_port_ + 1);
221 } while (udp_sockets_.find(port) != udp_sockets_.end()); 221 } while (udp_sockets_.find(port) != udp_sockets_.end());
222 } 222 }
223 223
224 CHECK(local_address.ipaddr() == address_); 224 CHECK(local_address.ipaddr() == address_);
225 225
226 FakeUdpSocket* result = 226 FakeUdpSocket* result =
227 new FakeUdpSocket(this, dispatcher_, 227 new FakeUdpSocket(this, dispatcher_,
228 rtc::SocketAddress(local_address.ipaddr(), port)); 228 rtc::SocketAddress(local_address.ipaddr(), port));
229 229
230 udp_sockets_[port] = 230 udp_sockets_[port] =
231 base::Bind(&FakeUdpSocket::ReceivePacket, base::Unretained(result)); 231 base::Bind(&FakeUdpSocket::ReceivePacket, base::Unretained(result));
232 232
233 return result; 233 return result;
234 } 234 }
235 235
236 rtc::AsyncPacketSocket* FakePacketSocketFactory::CreateServerTcpSocket( 236 rtc::AsyncPacketSocket* FakePacketSocketFactory::CreateServerTcpSocket(
237 const rtc::SocketAddress& local_address, 237 const rtc::SocketAddress& local_address,
238 uint16 min_port, uint16 max_port, 238 uint16 min_port, uint16 max_port,
239 int opts) { 239 int opts) {
240 return NULL; 240 return nullptr;
241 } 241 }
242 242
243 rtc::AsyncPacketSocket* FakePacketSocketFactory::CreateClientTcpSocket( 243 rtc::AsyncPacketSocket* FakePacketSocketFactory::CreateClientTcpSocket(
244 const rtc::SocketAddress& local_address, 244 const rtc::SocketAddress& local_address,
245 const rtc::SocketAddress& remote_address, 245 const rtc::SocketAddress& remote_address,
246 const rtc::ProxyInfo& proxy_info, 246 const rtc::ProxyInfo& proxy_info,
247 const std::string& user_agent, 247 const std::string& user_agent,
248 int opts) { 248 int opts) {
249 return NULL; 249 return nullptr;
250 } 250 }
251 251
252 rtc::AsyncResolverInterface* 252 rtc::AsyncResolverInterface*
253 FakePacketSocketFactory::CreateAsyncResolver() { 253 FakePacketSocketFactory::CreateAsyncResolver() {
254 return NULL; 254 return nullptr;
255 } 255 }
256 256
257 const scoped_refptr<base::SingleThreadTaskRunner>& 257 const scoped_refptr<base::SingleThreadTaskRunner>&
258 FakePacketSocketFactory::GetThread() const { 258 FakePacketSocketFactory::GetThread() const {
259 return task_runner_; 259 return task_runner_;
260 } 260 }
261 261
262 const rtc::IPAddress& FakePacketSocketFactory::GetAddress() const { 262 const rtc::IPAddress& FakePacketSocketFactory::GetAddress() const {
263 return address_; 263 return address_;
264 } 264 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 UdpSocketsMap::iterator iter = udp_sockets_.find(packet.to.port()); 321 UdpSocketsMap::iterator iter = udp_sockets_.find(packet.to.port());
322 if (iter == udp_sockets_.end()) { 322 if (iter == udp_sockets_.end()) {
323 // Invalid port number. 323 // Invalid port number.
324 return; 324 return;
325 } 325 }
326 326
327 iter->second.Run(packet.from, packet.to, packet.data, packet.data_size); 327 iter->second.Run(packet.from, packet.to, packet.data, packet.data_size);
328 } 328 }
329 329
330 } // namespace remoting 330 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/signaling/xmpp_signal_strategy.cc ('k') | remoting/test/protocol_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698