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

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

Issue 22188002: Cleanup the Win overlapped reads vs. non-blocking reads by removing the overlapped read code path (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « chrome/renderer/page_load_histograms.cc ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const CompletionCallback& callback); 63 const CompletionCallback& callback);
64 virtual int Write(IOBuffer* buf, int buf_len, 64 virtual int Write(IOBuffer* buf, int buf_len,
65 const CompletionCallback& callback); 65 const CompletionCallback& callback);
66 66
67 virtual bool SetReceiveBufferSize(int32 size); 67 virtual bool SetReceiveBufferSize(int32 size);
68 virtual bool SetSendBufferSize(int32 size); 68 virtual bool SetSendBufferSize(int32 size);
69 69
70 virtual bool SetKeepAlive(bool enable, int delay); 70 virtual bool SetKeepAlive(bool enable, int delay);
71 virtual bool SetNoDelay(bool no_delay); 71 virtual bool SetNoDelay(bool no_delay);
72 72
73 // Perform reads in non-blocking mode instead of overlapped mode.
74 // Used for experiments.
75 static void DisableOverlappedReads();
76
77 private: 73 private:
78 // State machine for connecting the socket. 74 // State machine for connecting the socket.
79 enum ConnectState { 75 enum ConnectState {
80 CONNECT_STATE_CONNECT, 76 CONNECT_STATE_CONNECT,
81 CONNECT_STATE_CONNECT_COMPLETE, 77 CONNECT_STATE_CONNECT_COMPLETE,
82 CONNECT_STATE_NONE, 78 CONNECT_STATE_NONE,
83 }; 79 };
84 80
85 class Core; 81 class Core;
86 82
(...skipping 11 matching lines...) Expand all
98 return next_connect_state_ != CONNECT_STATE_NONE; 94 return next_connect_state_ != CONNECT_STATE_NONE;
99 } 95 }
100 96
101 // Called after Connect() has completed with |net_error|. 97 // Called after Connect() has completed with |net_error|.
102 void LogConnectCompletion(int net_error); 98 void LogConnectCompletion(int net_error);
103 99
104 int DoRead(IOBuffer* buf, int buf_len, const CompletionCallback& callback); 100 int DoRead(IOBuffer* buf, int buf_len, const CompletionCallback& callback);
105 void DoReadCallback(int rv); 101 void DoReadCallback(int rv);
106 void DoWriteCallback(int rv); 102 void DoWriteCallback(int rv);
107 void DidCompleteConnect(); 103 void DidCompleteConnect();
108 void DidCompleteRead();
109 void DidCompleteWrite(); 104 void DidCompleteWrite();
110 void DidSignalRead(); 105 void DidSignalRead();
111 106
112 SOCKET socket_; 107 SOCKET socket_;
113 108
114 // Local IP address and port we are bound to. Set to NULL if Bind() 109 // Local IP address and port we are bound to. Set to NULL if Bind()
115 // was't called (in that cases OS chooses address/port). 110 // was't called (in that cases OS chooses address/port).
116 scoped_ptr<IPEndPoint> bind_address_; 111 scoped_ptr<IPEndPoint> bind_address_;
117 112
118 // Stores bound socket between Bind() and Connect() calls. 113 // Stores bound socket between Bind() and Connect() calls.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Record of connectivity and transmissions, for use in speculative connection 148 // Record of connectivity and transmissions, for use in speculative connection
154 // histograms. 149 // histograms.
155 UseHistory use_history_; 150 UseHistory use_history_;
156 151
157 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); 152 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin);
158 }; 153 };
159 154
160 } // namespace net 155 } // namespace net
161 156
162 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ 157 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_
OLDNEW
« no previous file with comments | « chrome/renderer/page_load_histograms.cc ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698