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

Side by Side Diff: webrtc/base/virtualsocketserver.cc

Issue 1920043002: Replace scoped_ptr with unique_ptr in webrtc/base/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased 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 | « webrtc/base/virtualsocket_unittest.cc ('k') | webrtc/base/win32filesystem.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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/base/virtualsocketserver.h" 11 #include "webrtc/base/virtualsocketserver.h"
12 12
13 #include <errno.h> 13 #include <errno.h>
14 #include <math.h> 14 #include <math.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <map> 17 #include <map>
18 #include <memory>
18 #include <vector> 19 #include <vector>
19 20
20 #include "webrtc/base/checks.h" 21 #include "webrtc/base/checks.h"
21 #include "webrtc/base/common.h" 22 #include "webrtc/base/common.h"
22 #include "webrtc/base/logging.h" 23 #include "webrtc/base/logging.h"
23 #include "webrtc/base/physicalsocketserver.h" 24 #include "webrtc/base/physicalsocketserver.h"
24 #include "webrtc/base/socketaddresspair.h" 25 #include "webrtc/base/socketaddresspair.h"
25 #include "webrtc/base/thread.h" 26 #include "webrtc/base/thread.h"
26 #include "webrtc/base/timeutils.h" 27 #include "webrtc/base/timeutils.h"
27 28
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 const SocketAddress& remote_addr) { 765 const SocketAddress& remote_addr) {
765 // See if we want to drop this packet. 766 // See if we want to drop this packet.
766 if (Random() < drop_prob_) { 767 if (Random() < drop_prob_) {
767 LOG(LS_VERBOSE) << "Dropping packet: bad luck"; 768 LOG(LS_VERBOSE) << "Dropping packet: bad luck";
768 return static_cast<int>(data_size); 769 return static_cast<int>(data_size);
769 } 770 }
770 771
771 VirtualSocket* recipient = LookupBinding(remote_addr); 772 VirtualSocket* recipient = LookupBinding(remote_addr);
772 if (!recipient) { 773 if (!recipient) {
773 // Make a fake recipient for address family checking. 774 // Make a fake recipient for address family checking.
774 scoped_ptr<VirtualSocket> dummy_socket( 775 std::unique_ptr<VirtualSocket> dummy_socket(
775 CreateSocketInternal(AF_INET, SOCK_DGRAM)); 776 CreateSocketInternal(AF_INET, SOCK_DGRAM));
776 dummy_socket->SetLocalAddress(remote_addr); 777 dummy_socket->SetLocalAddress(remote_addr);
777 if (!CanInteractWith(socket, dummy_socket.get())) { 778 if (!CanInteractWith(socket, dummy_socket.get())) {
778 LOG(LS_VERBOSE) << "Incompatible address families: " 779 LOG(LS_VERBOSE) << "Incompatible address families: "
779 << socket->GetLocalAddress() << " and " << remote_addr; 780 << socket->GetLocalAddress() << " and " << remote_addr;
780 return -1; 781 return -1;
781 } 782 }
782 LOG(LS_VERBOSE) << "No one listening at " << remote_addr; 783 LOG(LS_VERBOSE) << "No one listening at " << remote_addr;
783 return static_cast<int>(data_size); 784 return static_cast<int>(data_size);
784 } 785 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) { 1123 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) {
1123 RTC_DCHECK(!IPIsAny(from_addr)); 1124 RTC_DCHECK(!IPIsAny(from_addr));
1124 if (from_addr.family() == AF_INET) { 1125 if (from_addr.family() == AF_INET) {
1125 default_route_v4_ = from_addr; 1126 default_route_v4_ = from_addr;
1126 } else if (from_addr.family() == AF_INET6) { 1127 } else if (from_addr.family() == AF_INET6) {
1127 default_route_v6_ = from_addr; 1128 default_route_v6_ = from_addr;
1128 } 1129 }
1129 } 1130 }
1130 1131
1131 } // namespace rtc 1132 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/virtualsocket_unittest.cc ('k') | webrtc/base/win32filesystem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698