OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/socket/tcp_socket.h" | 5 #include "net/socket/tcp_socket.h" |
6 #include "net/socket/tcp_socket_win.h" | 6 #include "net/socket/tcp_socket_win.h" |
7 | 7 |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <mstcpip.h> | 9 #include <mstcpip.h> |
10 | 10 |
| 11 #include <utility> |
| 12 |
11 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
12 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/profiler/scoped_tracker.h" | 17 #include "base/profiler/scoped_tracker.h" |
16 #include "net/base/address_list.h" | 18 #include "net/base/address_list.h" |
17 #include "net/base/connection_type_histograms.h" | 19 #include "net/base/connection_type_histograms.h" |
18 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
19 #include "net/base/ip_endpoint.h" | 21 #include "net/base/ip_endpoint.h" |
20 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error); | 699 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error); |
698 return net_error; | 700 return net_error; |
699 } | 701 } |
700 scoped_ptr<TCPSocketWin> tcp_socket(new TCPSocketWin( | 702 scoped_ptr<TCPSocketWin> tcp_socket(new TCPSocketWin( |
701 net_log_.net_log(), net_log_.source())); | 703 net_log_.net_log(), net_log_.source())); |
702 int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point); | 704 int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point); |
703 if (adopt_result != OK) { | 705 if (adopt_result != OK) { |
704 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, adopt_result); | 706 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, adopt_result); |
705 return adopt_result; | 707 return adopt_result; |
706 } | 708 } |
707 *socket = tcp_socket.Pass(); | 709 *socket = std::move(tcp_socket); |
708 *address = ip_end_point; | 710 *address = ip_end_point; |
709 net_log_.EndEvent(NetLog::TYPE_TCP_ACCEPT, | 711 net_log_.EndEvent(NetLog::TYPE_TCP_ACCEPT, |
710 CreateNetLogIPEndPointCallback(&ip_end_point)); | 712 CreateNetLogIPEndPointCallback(&ip_end_point)); |
711 return OK; | 713 return OK; |
712 } | 714 } |
713 | 715 |
714 void TCPSocketWin::OnObjectSignaled(HANDLE object) { | 716 void TCPSocketWin::OnObjectSignaled(HANDLE object) { |
715 WSANETWORKEVENTS ev; | 717 WSANETWORKEVENTS ev; |
716 if (WSAEnumNetworkEvents(socket_, accept_event_, &ev) == SOCKET_ERROR) { | 718 if (WSAEnumNetworkEvents(socket_, accept_event_, &ev) == SOCKET_ERROR) { |
717 PLOG(ERROR) << "WSAEnumNetworkEvents()"; | 719 PLOG(ERROR) << "WSAEnumNetworkEvents()"; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 } | 1006 } |
1005 | 1007 |
1006 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { | 1008 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { |
1007 DCHECK(out_rtt); | 1009 DCHECK(out_rtt); |
1008 // TODO(bmcquade): Consider implementing using | 1010 // TODO(bmcquade): Consider implementing using |
1009 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. | 1011 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. |
1010 return false; | 1012 return false; |
1011 } | 1013 } |
1012 | 1014 |
1013 } // namespace net | 1015 } // namespace net |
OLD | NEW |