| 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 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
| 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
| 7 | 7 |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const CompletionCallback& callback); | 65 const CompletionCallback& callback); |
| 66 virtual int Write(IOBuffer* buf, int buf_len, | 66 virtual int Write(IOBuffer* buf, int buf_len, |
| 67 const CompletionCallback& callback); | 67 const CompletionCallback& callback); |
| 68 | 68 |
| 69 virtual bool SetReceiveBufferSize(int32 size); | 69 virtual bool SetReceiveBufferSize(int32 size); |
| 70 virtual bool SetSendBufferSize(int32 size); | 70 virtual bool SetSendBufferSize(int32 size); |
| 71 | 71 |
| 72 virtual bool SetKeepAlive(bool enable, int delay); | 72 virtual bool SetKeepAlive(bool enable, int delay); |
| 73 virtual bool SetNoDelay(bool no_delay); | 73 virtual bool SetNoDelay(bool no_delay); |
| 74 | 74 |
| 75 // Perform reads in non-blocking mode instead of overlapped mode. |
| 76 // Used for experiments. |
| 77 static void DisableOverlappedReads(); |
| 78 |
| 75 private: | 79 private: |
| 76 // State machine for connecting the socket. | 80 // State machine for connecting the socket. |
| 77 enum ConnectState { | 81 enum ConnectState { |
| 78 CONNECT_STATE_CONNECT, | 82 CONNECT_STATE_CONNECT, |
| 79 CONNECT_STATE_CONNECT_COMPLETE, | 83 CONNECT_STATE_CONNECT_COMPLETE, |
| 80 CONNECT_STATE_NONE, | 84 CONNECT_STATE_NONE, |
| 81 }; | 85 }; |
| 82 | 86 |
| 83 class Core; | 87 class Core; |
| 84 | 88 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 97 } | 101 } |
| 98 | 102 |
| 99 // Called after Connect() has completed with |net_error|. | 103 // Called after Connect() has completed with |net_error|. |
| 100 void LogConnectCompletion(int net_error); | 104 void LogConnectCompletion(int net_error); |
| 101 | 105 |
| 102 void DoReadCallback(int rv); | 106 void DoReadCallback(int rv); |
| 103 void DoWriteCallback(int rv); | 107 void DoWriteCallback(int rv); |
| 104 void DidCompleteConnect(); | 108 void DidCompleteConnect(); |
| 105 void DidCompleteRead(); | 109 void DidCompleteRead(); |
| 106 void DidCompleteWrite(); | 110 void DidCompleteWrite(); |
| 111 void DidSignalRead(); |
| 107 | 112 |
| 108 SOCKET socket_; | 113 SOCKET socket_; |
| 109 | 114 |
| 110 // Local IP address and port we are bound to. Set to NULL if Bind() | 115 // Local IP address and port we are bound to. Set to NULL if Bind() |
| 111 // was't called (in that cases OS chooses address/port). | 116 // was't called (in that cases OS chooses address/port). |
| 112 scoped_ptr<IPEndPoint> bind_address_; | 117 scoped_ptr<IPEndPoint> bind_address_; |
| 113 | 118 |
| 114 // Stores bound socket between Bind() and Connect() calls. | 119 // Stores bound socket between Bind() and Connect() calls. |
| 115 SOCKET bound_socket_; | 120 SOCKET bound_socket_; |
| 116 | 121 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 base::TimeTicks connect_start_time_; | 158 base::TimeTicks connect_start_time_; |
| 154 base::TimeDelta connect_time_micros_; | 159 base::TimeDelta connect_time_micros_; |
| 155 int64 num_bytes_read_; | 160 int64 num_bytes_read_; |
| 156 | 161 |
| 157 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 162 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
| 158 }; | 163 }; |
| 159 | 164 |
| 160 } // namespace net | 165 } // namespace net |
| 161 | 166 |
| 162 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 167 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
| OLD | NEW |