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

Side by Side Diff: net/socket/tcp_client_socket_win.h

Issue 10916016: Switch the TCP reads on Windows to use non-blocking/non-async I/O. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
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
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 // Experiment entry point for non-blocking reads
76 static void DisableOverlappedReads();
77
75 private: 78 private:
76 // State machine for connecting the socket. 79 // State machine for connecting the socket.
77 enum ConnectState { 80 enum ConnectState {
78 CONNECT_STATE_CONNECT, 81 CONNECT_STATE_CONNECT,
79 CONNECT_STATE_CONNECT_COMPLETE, 82 CONNECT_STATE_CONNECT_COMPLETE,
80 CONNECT_STATE_NONE, 83 CONNECT_STATE_NONE,
81 }; 84 };
82 85
83 class Core; 86 class Core;
84 87
(...skipping 12 matching lines...) Expand all
97 } 100 }
98 101
99 // Called after Connect() has completed with |net_error|. 102 // Called after Connect() has completed with |net_error|.
100 void LogConnectCompletion(int net_error); 103 void LogConnectCompletion(int net_error);
101 104
102 void DoReadCallback(int rv); 105 void DoReadCallback(int rv);
103 void DoWriteCallback(int rv); 106 void DoWriteCallback(int rv);
104 void DidCompleteConnect(); 107 void DidCompleteConnect();
105 void DidCompleteRead(); 108 void DidCompleteRead();
106 void DidCompleteWrite(); 109 void DidCompleteWrite();
110 void DidSignalRead();
107 111
108 SOCKET socket_; 112 SOCKET socket_;
109 113
110 // Local IP address and port we are bound to. Set to NULL if Bind() 114 // 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). 115 // was't called (in that cases OS chooses address/port).
112 scoped_ptr<IPEndPoint> bind_address_; 116 scoped_ptr<IPEndPoint> bind_address_;
113 117
114 // Stores bound socket between Bind() and Connect() calls. 118 // Stores bound socket between Bind() and Connect() calls.
115 SOCKET bound_socket_; 119 SOCKET bound_socket_;
116 120
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 base::TimeTicks connect_start_time_; 157 base::TimeTicks connect_start_time_;
154 base::TimeDelta connect_time_micros_; 158 base::TimeDelta connect_time_micros_;
155 int64 num_bytes_read_; 159 int64 num_bytes_read_;
156 160
157 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); 161 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin);
158 }; 162 };
159 163
160 } // namespace net 164 } // namespace net
161 165
162 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ 166 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698