OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <winsock2.h> | 9 #include <winsock2.h> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 virtual bool UsingTCPFastOpen() const; | 56 virtual bool UsingTCPFastOpen() const; |
57 virtual int64 NumBytesRead() const; | 57 virtual int64 NumBytesRead() const; |
58 virtual base::TimeDelta GetConnectTimeMicros() const; | 58 virtual base::TimeDelta GetConnectTimeMicros() const; |
59 | 59 |
60 // Socket implementation. | 60 // Socket implementation. |
61 // Multiple outstanding requests are not supported. | 61 // Multiple outstanding requests are not supported. |
62 // Full duplex mode (reading and writing at the same time) is supported | 62 // Full duplex mode (reading and writing at the same time) is supported |
63 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); | 63 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); |
64 virtual int Read(IOBuffer* buf, int buf_len, | 64 virtual int Read(IOBuffer* buf, int buf_len, |
65 const CompletionCallback& callback); | 65 const CompletionCallback& callback); |
66 virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback)
; | 66 virtual int Write(IOBuffer* buf, int buf_len, |
| 67 OldCompletionCallback* callback); |
| 68 virtual int Write(IOBuffer* buf, int buf_len, |
| 69 const CompletionCallback& callback); |
67 | 70 |
68 virtual bool SetReceiveBufferSize(int32 size); | 71 virtual bool SetReceiveBufferSize(int32 size); |
69 virtual bool SetSendBufferSize(int32 size); | 72 virtual bool SetSendBufferSize(int32 size); |
70 | 73 |
71 private: | 74 private: |
72 // State machine for connecting the socket. | 75 // State machine for connecting the socket. |
73 enum ConnectState { | 76 enum ConnectState { |
74 CONNECT_STATE_CONNECT, | 77 CONNECT_STATE_CONNECT, |
75 CONNECT_STATE_CONNECT_COMPLETE, | 78 CONNECT_STATE_CONNECT_COMPLETE, |
76 CONNECT_STATE_NONE, | 79 CONNECT_STATE_NONE, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // The core of the socket that can live longer than the socket itself. We pass | 126 // The core of the socket that can live longer than the socket itself. We pass |
124 // resources to the Windows async IO functions and we have to make sure that | 127 // resources to the Windows async IO functions and we have to make sure that |
125 // they are not destroyed while the OS still references them. | 128 // they are not destroyed while the OS still references them. |
126 scoped_refptr<Core> core_; | 129 scoped_refptr<Core> core_; |
127 | 130 |
128 // External callback; called when connect or read is complete. | 131 // External callback; called when connect or read is complete. |
129 OldCompletionCallback* old_read_callback_; | 132 OldCompletionCallback* old_read_callback_; |
130 CompletionCallback read_callback_; | 133 CompletionCallback read_callback_; |
131 | 134 |
132 // External callback; called when write is complete. | 135 // External callback; called when write is complete. |
133 OldCompletionCallback* write_callback_; | 136 OldCompletionCallback* old_write_callback_; |
| 137 CompletionCallback write_callback_; |
134 | 138 |
135 // The next state for the Connect() state machine. | 139 // The next state for the Connect() state machine. |
136 ConnectState next_connect_state_; | 140 ConnectState next_connect_state_; |
137 | 141 |
138 // The OS error that CONNECT_STATE_CONNECT last completed with. | 142 // The OS error that CONNECT_STATE_CONNECT last completed with. |
139 int connect_os_error_; | 143 int connect_os_error_; |
140 | 144 |
141 BoundNetLog net_log_; | 145 BoundNetLog net_log_; |
142 | 146 |
143 // This socket was previously disconnected and has not been re-connected. | 147 // This socket was previously disconnected and has not been re-connected. |
144 bool previously_disconnected_; | 148 bool previously_disconnected_; |
145 | 149 |
146 // Record of connectivity and transmissions, for use in speculative connection | 150 // Record of connectivity and transmissions, for use in speculative connection |
147 // histograms. | 151 // histograms. |
148 UseHistory use_history_; | 152 UseHistory use_history_; |
149 | 153 |
150 base::TimeTicks connect_start_time_; | 154 base::TimeTicks connect_start_time_; |
151 base::TimeDelta connect_time_micros_; | 155 base::TimeDelta connect_time_micros_; |
152 int64 num_bytes_read_; | 156 int64 num_bytes_read_; |
153 | 157 |
154 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 158 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
155 }; | 159 }; |
156 | 160 |
157 } // namespace net | 161 } // namespace net |
158 | 162 |
159 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 163 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
OLD | NEW |