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

Side by Side Diff: content/renderer/p2p/ipc_socket_factory.cc

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 "content/renderer/p2p/ipc_socket_factory.h" 5 #include "content/renderer/p2p/ipc_socket_factory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // can get the resolved remote address. 576 // can get the resolved remote address.
577 SignalConnect(this); 577 SignalConnect(this);
578 } 578 }
579 } 579 }
580 580
581 void IpcPacketSocket::OnIncomingTcpConnection( 581 void IpcPacketSocket::OnIncomingTcpConnection(
582 const net::IPEndPoint& address, 582 const net::IPEndPoint& address,
583 P2PSocketClient* client) { 583 P2PSocketClient* client) {
584 DCHECK_EQ(base::MessageLoop::current(), message_loop_); 584 DCHECK_EQ(base::MessageLoop::current(), message_loop_);
585 585
586 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); 586 std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket());
587 587
588 rtc::SocketAddress remote_address; 588 rtc::SocketAddress remote_address;
589 if (!jingle_glue::IPEndPointToSocketAddress(address, &remote_address)) { 589 if (!jingle_glue::IPEndPointToSocketAddress(address, &remote_address)) {
590 // Always expect correct IPv4 address to be allocated. 590 // Always expect correct IPv4 address to be allocated.
591 NOTREACHED(); 591 NOTREACHED();
592 } 592 }
593 socket->InitAcceptedTcp(client, local_address_, remote_address); 593 socket->InitAcceptedTcp(client, local_address_, remote_address);
594 SignalNewConnection(this, socket.release()); 594 SignalNewConnection(this, socket.release());
595 } 595 }
596 596
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 IpcPacketSocketFactory::~IpcPacketSocketFactory() { 739 IpcPacketSocketFactory::~IpcPacketSocketFactory() {
740 } 740 }
741 741
742 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateUdpSocket( 742 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateUdpSocket(
743 const rtc::SocketAddress& local_address, 743 const rtc::SocketAddress& local_address,
744 uint16_t min_port, 744 uint16_t min_port,
745 uint16_t max_port) { 745 uint16_t max_port) {
746 rtc::SocketAddress crome_address; 746 rtc::SocketAddress crome_address;
747 P2PSocketClientImpl* socket_client = 747 P2PSocketClientImpl* socket_client =
748 new P2PSocketClientImpl(socket_dispatcher_); 748 new P2PSocketClientImpl(socket_dispatcher_);
749 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); 749 std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket());
750 // TODO(sergeyu): Respect local_address and port limits here (need 750 // TODO(sergeyu): Respect local_address and port limits here (need
751 // to pass them over IPC channel to the browser). 751 // to pass them over IPC channel to the browser).
752 if (!socket->Init(P2P_SOCKET_UDP, socket_client, 752 if (!socket->Init(P2P_SOCKET_UDP, socket_client,
753 local_address, rtc::SocketAddress())) { 753 local_address, rtc::SocketAddress())) {
754 return NULL; 754 return NULL;
755 } 755 }
756 return socket.release(); 756 return socket.release();
757 } 757 }
758 758
759 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateServerTcpSocket( 759 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateServerTcpSocket(
760 const rtc::SocketAddress& local_address, 760 const rtc::SocketAddress& local_address,
761 uint16_t min_port, 761 uint16_t min_port,
762 uint16_t max_port, 762 uint16_t max_port,
763 int opts) { 763 int opts) {
764 // TODO(sergeyu): Implement SSL support. 764 // TODO(sergeyu): Implement SSL support.
765 if (opts & rtc::PacketSocketFactory::OPT_SSLTCP) 765 if (opts & rtc::PacketSocketFactory::OPT_SSLTCP)
766 return NULL; 766 return NULL;
767 767
768 P2PSocketType type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? 768 P2PSocketType type = (opts & rtc::PacketSocketFactory::OPT_STUN) ?
769 P2P_SOCKET_STUN_TCP_SERVER : P2P_SOCKET_TCP_SERVER; 769 P2P_SOCKET_STUN_TCP_SERVER : P2P_SOCKET_TCP_SERVER;
770 P2PSocketClientImpl* socket_client = 770 P2PSocketClientImpl* socket_client =
771 new P2PSocketClientImpl(socket_dispatcher_); 771 new P2PSocketClientImpl(socket_dispatcher_);
772 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); 772 std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket());
773 if (!socket->Init(type, socket_client, local_address, 773 if (!socket->Init(type, socket_client, local_address,
774 rtc::SocketAddress())) { 774 rtc::SocketAddress())) {
775 return NULL; 775 return NULL;
776 } 776 }
777 return socket.release(); 777 return socket.release();
778 } 778 }
779 779
780 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateClientTcpSocket( 780 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateClientTcpSocket(
781 const rtc::SocketAddress& local_address, 781 const rtc::SocketAddress& local_address,
782 const rtc::SocketAddress& remote_address, 782 const rtc::SocketAddress& remote_address,
783 const rtc::ProxyInfo& proxy_info, 783 const rtc::ProxyInfo& proxy_info,
784 const std::string& user_agent, int opts) { 784 const std::string& user_agent, int opts) {
785 P2PSocketType type; 785 P2PSocketType type;
786 if (opts & rtc::PacketSocketFactory::OPT_SSLTCP) { 786 if (opts & rtc::PacketSocketFactory::OPT_SSLTCP) {
787 type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? 787 type = (opts & rtc::PacketSocketFactory::OPT_STUN) ?
788 P2P_SOCKET_STUN_SSLTCP_CLIENT : P2P_SOCKET_SSLTCP_CLIENT; 788 P2P_SOCKET_STUN_SSLTCP_CLIENT : P2P_SOCKET_SSLTCP_CLIENT;
789 } else if (opts & rtc::PacketSocketFactory::OPT_TLS) { 789 } else if (opts & rtc::PacketSocketFactory::OPT_TLS) {
790 type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? 790 type = (opts & rtc::PacketSocketFactory::OPT_STUN) ?
791 P2P_SOCKET_STUN_TLS_CLIENT : P2P_SOCKET_TLS_CLIENT; 791 P2P_SOCKET_STUN_TLS_CLIENT : P2P_SOCKET_TLS_CLIENT;
792 } else { 792 } else {
793 type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? 793 type = (opts & rtc::PacketSocketFactory::OPT_STUN) ?
794 P2P_SOCKET_STUN_TCP_CLIENT : P2P_SOCKET_TCP_CLIENT; 794 P2P_SOCKET_STUN_TCP_CLIENT : P2P_SOCKET_TCP_CLIENT;
795 } 795 }
796 P2PSocketClientImpl* socket_client = 796 P2PSocketClientImpl* socket_client =
797 new P2PSocketClientImpl(socket_dispatcher_); 797 new P2PSocketClientImpl(socket_dispatcher_);
798 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); 798 std::unique_ptr<IpcPacketSocket> socket(new IpcPacketSocket());
799 if (!socket->Init(type, socket_client, local_address, remote_address)) 799 if (!socket->Init(type, socket_client, local_address, remote_address))
800 return NULL; 800 return NULL;
801 return socket.release(); 801 return socket.release();
802 } 802 }
803 803
804 rtc::AsyncResolverInterface* 804 rtc::AsyncResolverInterface*
805 IpcPacketSocketFactory::CreateAsyncResolver() { 805 IpcPacketSocketFactory::CreateAsyncResolver() {
806 scoped_ptr<AsyncAddressResolverImpl> resolver( 806 std::unique_ptr<AsyncAddressResolverImpl> resolver(
807 new AsyncAddressResolverImpl(socket_dispatcher_)); 807 new AsyncAddressResolverImpl(socket_dispatcher_));
808 return resolver.release(); 808 return resolver.release();
809 } 809 }
810 810
811 } // namespace content 811 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/p2p/ipc_network_manager_unittest.cc ('k') | content/renderer/pepper/audio_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698