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

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

Issue 707713006: Update Chromium for webrtc r7656. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 class UdpPacketSocket : public rtc::AsyncPacketSocket { 86 class UdpPacketSocket : public rtc::AsyncPacketSocket {
87 public: 87 public:
88 explicit UdpPacketSocket(const pp::InstanceHandle& instance); 88 explicit UdpPacketSocket(const pp::InstanceHandle& instance);
89 ~UdpPacketSocket() override; 89 ~UdpPacketSocket() override;
90 90
91 // |min_port| and |max_port| are set to zero if the port number 91 // |min_port| and |max_port| are set to zero if the port number
92 // should be assigned by the OS. 92 // should be assigned by the OS.
93 bool Init(const rtc::SocketAddress& local_address, 93 bool Init(const rtc::SocketAddress& local_address,
94 int min_port, 94 uint16 min_port,
95 int max_port); 95 uint16 max_port);
96 96
97 // rtc::AsyncPacketSocket interface. 97 // rtc::AsyncPacketSocket interface.
98 rtc::SocketAddress GetLocalAddress() const override; 98 rtc::SocketAddress GetLocalAddress() const override;
99 rtc::SocketAddress GetRemoteAddress() const override; 99 rtc::SocketAddress GetRemoteAddress() const override;
100 int Send(const void* data, 100 int Send(const void* data,
101 size_t data_size, 101 size_t data_size,
102 const rtc::PacketOptions& options) override; 102 const rtc::PacketOptions& options) override;
103 int SendTo(const void* data, 103 int SendTo(const void* data,
104 size_t data_size, 104 size_t data_size,
105 const rtc::SocketAddress& address, 105 const rtc::SocketAddress& address,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 send_pending_(false), 176 send_pending_(false),
177 send_queue_size_(0), 177 send_queue_size_(0),
178 callback_factory_(this) { 178 callback_factory_(this) {
179 } 179 }
180 180
181 UdpPacketSocket::~UdpPacketSocket() { 181 UdpPacketSocket::~UdpPacketSocket() {
182 Close(); 182 Close();
183 } 183 }
184 184
185 bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address, 185 bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address,
186 int min_port, 186 uint16 min_port,
187 int max_port) { 187 uint16 max_port) {
188 if (socket_.is_null()) { 188 if (socket_.is_null()) {
189 return false; 189 return false;
190 } 190 }
191 191
192 local_address_ = local_address; 192 local_address_ = local_address;
193 max_port_ = max_port; 193 max_port_ = max_port;
194 min_port_ = min_port; 194 min_port_ = min_port;
195 195
196 pp::NetAddress pp_local_address; 196 pp::NetAddress pp_local_address;
197 if (!SocketAddressToPpNetAddressWithPort( 197 if (!SocketAddressToPpNetAddressWithPort(
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 PepperPacketSocketFactory::PepperPacketSocketFactory( 402 PepperPacketSocketFactory::PepperPacketSocketFactory(
403 const pp::InstanceHandle& instance) 403 const pp::InstanceHandle& instance)
404 : pp_instance_(instance) { 404 : pp_instance_(instance) {
405 } 405 }
406 406
407 PepperPacketSocketFactory::~PepperPacketSocketFactory() { 407 PepperPacketSocketFactory::~PepperPacketSocketFactory() {
408 } 408 }
409 409
410 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateUdpSocket( 410 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateUdpSocket(
411 const rtc::SocketAddress& local_address, 411 const rtc::SocketAddress& local_address,
412 int min_port, 412 uint16 min_port,
413 int max_port) { 413 uint16 max_port) {
414 scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket(pp_instance_)); 414 scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket(pp_instance_));
415 if (!result->Init(local_address, min_port, max_port)) 415 if (!result->Init(local_address, min_port, max_port))
416 return NULL; 416 return NULL;
417 return result.release(); 417 return result.release();
418 } 418 }
419 419
420 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateServerTcpSocket( 420 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateServerTcpSocket(
421 const rtc::SocketAddress& local_address, 421 const rtc::SocketAddress& local_address,
422 int min_port, 422 uint16 min_port,
423 int max_port, 423 uint16 max_port,
424 int opts) { 424 int opts) {
425 // We don't use TCP sockets for remoting connections. 425 // We don't use TCP sockets for remoting connections.
426 NOTREACHED(); 426 NOTREACHED();
427 return NULL; 427 return NULL;
428 } 428 }
429 429
430 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateClientTcpSocket( 430 rtc::AsyncPacketSocket* PepperPacketSocketFactory::CreateClientTcpSocket(
431 const rtc::SocketAddress& local_address, 431 const rtc::SocketAddress& local_address,
432 const rtc::SocketAddress& remote_address, 432 const rtc::SocketAddress& remote_address,
433 const rtc::ProxyInfo& proxy_info, 433 const rtc::ProxyInfo& proxy_info,
434 const std::string& user_agent, 434 const std::string& user_agent,
435 int opts) { 435 int opts) {
436 // We don't use TCP sockets for remoting connections. 436 // We don't use TCP sockets for remoting connections.
437 NOTREACHED(); 437 NOTREACHED();
438 return NULL; 438 return NULL;
439 } 439 }
440 440
441 rtc::AsyncResolverInterface* 441 rtc::AsyncResolverInterface*
442 PepperPacketSocketFactory::CreateAsyncResolver() { 442 PepperPacketSocketFactory::CreateAsyncResolver() {
443 return new PepperAddressResolver(pp_instance_); 443 return new PepperAddressResolver(pp_instance_);
444 } 444 }
445 445
446 } // namespace remoting 446 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_packet_socket_factory.h ('k') | remoting/protocol/chromium_socket_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698