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

Side by Side Diff: remoting/client/plugin/pepper_packet_socket_factory.cc

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/client/plugin/pepper_packet_socket_factory.h" 5 #include "remoting/client/plugin/pepper_packet_socket_factory.h"
6 6
7 #include <stddef.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h"
9 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
11 #include "ppapi/cpp/net_address.h" 14 #include "ppapi/cpp/net_address.h"
12 #include "ppapi/cpp/udp_socket.h" 15 #include "ppapi/cpp/udp_socket.h"
13 #include "ppapi/utility/completion_callback_factory.h" 16 #include "ppapi/utility/completion_callback_factory.h"
14 #include "remoting/client/plugin/pepper_address_resolver.h" 17 #include "remoting/client/plugin/pepper_address_resolver.h"
15 #include "remoting/client/plugin/pepper_util.h" 18 #include "remoting/client/plugin/pepper_util.h"
16 #include "remoting/protocol/socket_util.h" 19 #include "remoting/protocol/socket_util.h"
17 #include "third_party/webrtc/base/asyncpacketsocket.h" 20 #include "third_party/webrtc/base/asyncpacketsocket.h"
18 #include "third_party/webrtc/base/nethelpers.h" 21 #include "third_party/webrtc/base/nethelpers.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 87 }
85 88
86 class UdpPacketSocket : public rtc::AsyncPacketSocket { 89 class UdpPacketSocket : public rtc::AsyncPacketSocket {
87 public: 90 public:
88 explicit UdpPacketSocket(const pp::InstanceHandle& instance); 91 explicit UdpPacketSocket(const pp::InstanceHandle& instance);
89 ~UdpPacketSocket() override; 92 ~UdpPacketSocket() override;
90 93
91 // |min_port| and |max_port| are set to zero if the port number 94 // |min_port| and |max_port| are set to zero if the port number
92 // should be assigned by the OS. 95 // should be assigned by the OS.
93 bool Init(const rtc::SocketAddress& local_address, 96 bool Init(const rtc::SocketAddress& local_address,
94 uint16 min_port, 97 uint16_t min_port,
95 uint16 max_port); 98 uint16_t max_port);
96 99
97 // rtc::AsyncPacketSocket interface. 100 // rtc::AsyncPacketSocket interface.
98 rtc::SocketAddress GetLocalAddress() const override; 101 rtc::SocketAddress GetLocalAddress() const override;
99 rtc::SocketAddress GetRemoteAddress() const override; 102 rtc::SocketAddress GetRemoteAddress() const override;
100 int Send(const void* data, 103 int Send(const void* data,
101 size_t data_size, 104 size_t data_size,
102 const rtc::PacketOptions& options) override; 105 const rtc::PacketOptions& options) override;
103 int SendTo(const void* data, 106 int SendTo(const void* data,
104 size_t data_size, 107 size_t data_size,
105 const rtc::SocketAddress& address, 108 const rtc::SocketAddress& address,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 send_pending_(false), 179 send_pending_(false),
177 send_queue_size_(0), 180 send_queue_size_(0),
178 callback_factory_(this) { 181 callback_factory_(this) {
179 } 182 }
180 183
181 UdpPacketSocket::~UdpPacketSocket() { 184 UdpPacketSocket::~UdpPacketSocket() {
182 Close(); 185 Close();
183 } 186 }
184 187
185 bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address, 188 bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address,
186 uint16 min_port, 189 uint16_t min_port,
187 uint16 max_port) { 190 uint16_t max_port) {
188 if (socket_.is_null()) { 191 if (socket_.is_null()) {
189 return false; 192 return false;
190 } 193 }
191 194
192 local_address_ = local_address; 195 local_address_ = local_address;
193 max_port_ = max_port; 196 max_port_ = max_port;
194 min_port_ = min_port; 197 min_port_ = min_port;
195 198
196 pp::NetAddress pp_local_address; 199 pp::NetAddress pp_local_address;
197 if (!SocketAddressToPpNetAddressWithPort( 200 if (!SocketAddressToPpNetAddressWithPort(
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 404
402 PepperPacketSocketFactory::PepperPacketSocketFactory( 405 PepperPacketSocketFactory::PepperPacketSocketFactory(
403 const pp::InstanceHandle& instance) 406 const pp::InstanceHandle& instance)
404 : pp_instance_(instance) { 407 : pp_instance_(instance) {
405 } 408 }
406 409
407 PepperPacketSocketFactory::~PepperPacketSocketFactory() { 410 PepperPacketSocketFactory::~PepperPacketSocketFactory() {
408 } 411 }
409 412
410 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateUdpSocket( 413 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateUdpSocket(
411 const rtc::SocketAddress& local_address, 414 const rtc::SocketAddress& local_address,
412 uint16 min_port, 415 uint16_t min_port,
413 uint16 max_port) { 416 uint16_t max_port) {
414 scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket(pp_instance_)); 417 scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket(pp_instance_));
415 if (!result->Init(local_address, min_port, max_port)) 418 if (!result->Init(local_address, min_port, max_port))
416 return nullptr; 419 return nullptr;
417 return result.release(); 420 return result.release();
418 } 421 }
419 422
420 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateServerTcpSocket( 423 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateServerTcpSocket(
421 const rtc::SocketAddress& local_address, 424 const rtc::SocketAddress& local_address,
422 uint16 min_port, 425 uint16_t min_port,
423 uint16 max_port, 426 uint16_t max_port,
424 int opts) { 427 int opts) {
425 // We don't use TCP sockets for remoting connections. 428 // We don't use TCP sockets for remoting connections.
426 NOTREACHED(); 429 NOTREACHED();
427 return nullptr; 430 return nullptr;
428 } 431 }
429 432
430 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateClientTcpSocket( 433 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateClientTcpSocket(
431 const rtc::SocketAddress& local_address, 434 const rtc::SocketAddress& local_address,
432 const rtc::SocketAddress& remote_address, 435 const rtc::SocketAddress& remote_address,
433 const rtc::ProxyInfo& proxy_info, 436 const rtc::ProxyInfo& proxy_info,
434 const std::string& user_agent, 437 const std::string& user_agent,
435 int opts) { 438 int opts) {
436 // We don't use TCP sockets for remoting connections. 439 // We don't use TCP sockets for remoting connections.
437 NOTREACHED(); 440 NOTREACHED();
438 return nullptr; 441 return nullptr;
439 } 442 }
440 443
441 rtc::AsyncResolverInterface* 444 rtc::AsyncResolverInterface*
442 PepperPacketSocketFactory::CreateAsyncResolver() { 445 PepperPacketSocketFactory::CreateAsyncResolver() {
443 return new PepperAddressResolver(pp_instance_); 446 return new PepperAddressResolver(pp_instance_);
444 } 447 }
445 448
446 } // namespace remoting 449 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_packet_socket_factory.h ('k') | remoting/client/plugin/pepper_port_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698