| OLD | NEW |
| 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/browser/renderer_host/p2p/socket_host_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 *recv_address_ = address; | 135 *recv_address_ = address; |
| 136 net::CompletionCallback cb = recv_callback_; | 136 net::CompletionCallback cb = recv_callback_; |
| 137 recv_callback_.Reset(); | 137 recv_callback_.Reset(); |
| 138 recv_buffer_ = nullptr; | 138 recv_buffer_ = nullptr; |
| 139 cb.Run(size); | 139 cb.Run(size); |
| 140 } else { | 140 } else { |
| 141 incoming_packets_.push_back(UDPPacket(address, data)); | 141 incoming_packets_.push_back(UDPPacket(address, data)); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 const net::BoundNetLog& NetLog() const override { return net_log_; } | 145 const net::NetLogWithSource& NetLog() const override { return net_log_; } |
| 146 | 146 |
| 147 void AllowAddressReuse() override { NOTIMPLEMENTED(); } | 147 void AllowAddressReuse() override { NOTIMPLEMENTED(); } |
| 148 | 148 |
| 149 void AllowBroadcast() override { NOTIMPLEMENTED(); } | 149 void AllowBroadcast() override { NOTIMPLEMENTED(); } |
| 150 | 150 |
| 151 int JoinGroup(const net::IPAddress& group_address) const override { | 151 int JoinGroup(const net::IPAddress& group_address) const override { |
| 152 NOTIMPLEMENTED(); | 152 NOTIMPLEMENTED(); |
| 153 return net::ERR_NOT_IMPLEMENTED; | 153 return net::ERR_NOT_IMPLEMENTED; |
| 154 } | 154 } |
| 155 | 155 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 177 NOTIMPLEMENTED(); | 177 NOTIMPLEMENTED(); |
| 178 return net::ERR_NOT_IMPLEMENTED; | 178 return net::ERR_NOT_IMPLEMENTED; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void DetachFromThread() override { NOTIMPLEMENTED(); } | 181 void DetachFromThread() override { NOTIMPLEMENTED(); } |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 net::IPEndPoint address_; | 184 net::IPEndPoint address_; |
| 185 std::deque<UDPPacket>* sent_packets_; | 185 std::deque<UDPPacket>* sent_packets_; |
| 186 std::deque<UDPPacket> incoming_packets_; | 186 std::deque<UDPPacket> incoming_packets_; |
| 187 net::BoundNetLog net_log_; | 187 net::NetLogWithSource net_log_; |
| 188 | 188 |
| 189 scoped_refptr<net::IOBuffer> recv_buffer_; | 189 scoped_refptr<net::IOBuffer> recv_buffer_; |
| 190 net::IPEndPoint* recv_address_; | 190 net::IPEndPoint* recv_address_; |
| 191 int recv_size_; | 191 int recv_size_; |
| 192 net::CompletionCallback recv_callback_; | 192 net::CompletionCallback recv_callback_; |
| 193 std::vector<uint16_t>* used_ports_; | 193 std::vector<uint16_t>* used_ports_; |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 std::unique_ptr<net::DatagramServerSocket> CreateFakeDatagramServerSocket( | 196 std::unique_ptr<net::DatagramServerSocket> CreateFakeDatagramServerSocket( |
| 197 std::deque<FakeDatagramServerSocket::UDPPacket>* sent_packets, | 197 std::deque<FakeDatagramServerSocket::UDPPacket>* sent_packets, |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 std::unique_ptr<P2PSocketHostUdp> socket_host( | 510 std::unique_ptr<P2PSocketHostUdp> socket_host( |
| 511 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); | 511 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); |
| 512 net::IPEndPoint local_address = | 512 net::IPEndPoint local_address = |
| 513 ParseAddress(kTestLocalIpAddress, invalid_port); | 513 ParseAddress(kTestLocalIpAddress, invalid_port); |
| 514 bool rv = socket_host->Init(local_address, min_port, max_port, | 514 bool rv = socket_host->Init(local_address, min_port, max_port, |
| 515 P2PHostAndIPEndPoint()); | 515 P2PHostAndIPEndPoint()); |
| 516 EXPECT_FALSE(rv); | 516 EXPECT_FALSE(rv); |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace content | 519 } // namespace content |
| OLD | NEW |