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

Side by Side Diff: trunk/src/net/spdy/spdy_proxy_client_socket.h

Issue 13996009: Revert 194560 "[SPDY] Replace SpdyIOBuffer with new SpdyBuffer c..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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
« no previous file with comments | « trunk/src/net/spdy/spdy_io_buffer.cc ('k') | trunk/src/net/spdy/spdy_proxy_client_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
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_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ 5 #ifndef NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_
6 #define NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ 6 #define NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_
7 7
8 #include <string>
8 #include <list> 9 #include <list>
9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/host_port_pair.h" 15 #include "net/base/host_port_pair.h"
16 #include "net/base/net_log.h" 16 #include "net/base/net_log.h"
17 #include "net/http/http_auth_controller.h" 17 #include "net/http/http_auth_controller.h"
18 #include "net/http/http_request_headers.h" 18 #include "net/http/http_request_headers.h"
19 #include "net/http/http_request_info.h" 19 #include "net/http/http_request_info.h"
20 #include "net/http/http_response_info.h" 20 #include "net/http/http_response_info.h"
21 #include "net/http/proxy_client_socket.h" 21 #include "net/http/proxy_client_socket.h"
22 #include "net/spdy/spdy_http_stream.h" 22 #include "net/spdy/spdy_http_stream.h"
23 #include "net/spdy/spdy_protocol.h" 23 #include "net/spdy/spdy_protocol.h"
24 #include "net/spdy/spdy_read_queue.h"
25 #include "net/spdy/spdy_session.h" 24 #include "net/spdy/spdy_session.h"
26 #include "net/spdy/spdy_stream.h" 25 #include "net/spdy/spdy_stream.h"
27 26
28 27
29 class GURL; 28 class GURL;
30 29
31 namespace net { 30 namespace net {
32 31
33 class AddressList; 32 class AddressList;
34 class HttpStream; 33 class HttpStream;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; 90 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
92 91
93 // SpdyStream::Delegate implementation. 92 // SpdyStream::Delegate implementation.
94 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; 93 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE;
95 virtual int OnSendBody() OVERRIDE; 94 virtual int OnSendBody() OVERRIDE;
96 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; 95 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE;
97 virtual int OnResponseReceived(const SpdyHeaderBlock& response, 96 virtual int OnResponseReceived(const SpdyHeaderBlock& response,
98 base::Time response_time, 97 base::Time response_time,
99 int status) OVERRIDE; 98 int status) OVERRIDE;
100 virtual void OnHeadersSent() OVERRIDE; 99 virtual void OnHeadersSent() OVERRIDE;
101 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; 100 virtual int OnDataReceived(const char* data, int length) OVERRIDE;
102 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; 101 virtual void OnDataSent(size_t bytes_sent) OVERRIDE;
103 virtual void OnClose(int status) OVERRIDE; 102 virtual void OnClose(int status) OVERRIDE;
104 103
105 private: 104 private:
106 enum State { 105 enum State {
107 STATE_DISCONNECTED, 106 STATE_DISCONNECTED,
108 STATE_GENERATE_AUTH_TOKEN, 107 STATE_GENERATE_AUTH_TOKEN,
109 STATE_GENERATE_AUTH_TOKEN_COMPLETE, 108 STATE_GENERATE_AUTH_TOKEN_COMPLETE,
110 STATE_SEND_REQUEST, 109 STATE_SEND_REQUEST,
111 STATE_SEND_REQUEST_COMPLETE, 110 STATE_SEND_REQUEST_COMPLETE,
112 STATE_READ_REPLY_COMPLETE, 111 STATE_READ_REPLY_COMPLETE,
113 STATE_OPEN, 112 STATE_OPEN,
114 STATE_CLOSED 113 STATE_CLOSED
115 }; 114 };
116 115
117 void LogBlockedTunnelResponse() const; 116 void LogBlockedTunnelResponse() const;
118 117
119 void OnIOComplete(int result); 118 void OnIOComplete(int result);
120 119
121 int DoLoop(int last_io_result); 120 int DoLoop(int last_io_result);
122 int DoGenerateAuthToken(); 121 int DoGenerateAuthToken();
123 int DoGenerateAuthTokenComplete(int result); 122 int DoGenerateAuthTokenComplete(int result);
124 int DoSendRequest(); 123 int DoSendRequest();
125 int DoSendRequestComplete(int result); 124 int DoSendRequestComplete(int result);
126 int DoReadReplyComplete(int result); 125 int DoReadReplyComplete(int result);
127 126
128 // Populates |user_buffer_| with as much read data as possible 127 // Populates |user_buffer_| with as much read data as possible
129 // and returns the number of bytes read. 128 // and returns the number of bytes read.
130 size_t PopulateUserReadBuffer(char* out, size_t len); 129 int PopulateUserReadBuffer();
131 130
132 State next_state_; 131 State next_state_;
133 132
134 // Pointer to the SPDY Stream that this sits on top of. 133 // Pointer to the SPDY Stream that this sits on top of.
135 scoped_refptr<SpdyStream> spdy_stream_; 134 scoped_refptr<SpdyStream> spdy_stream_;
136 135
137 // Stores the callback to the layer above, called on completing Read() or 136 // Stores the callback to the layer above, called on completing Read() or
138 // Connect(). 137 // Connect().
139 CompletionCallback read_callback_; 138 CompletionCallback read_callback_;
140 // Stores the callback to the layer above, called on completing Write(). 139 // Stores the callback to the layer above, called on completing Write().
141 CompletionCallback write_callback_; 140 CompletionCallback write_callback_;
142 141
143 // CONNECT request and response. 142 // CONNECT request and response.
144 HttpRequestInfo request_; 143 HttpRequestInfo request_;
145 HttpResponseInfo response_; 144 HttpResponseInfo response_;
146 145
147 // The hostname and port of the endpoint. This is not necessarily the one 146 // The hostname and port of the endpoint. This is not necessarily the one
148 // specified by the URL, due to Alternate-Protocol or fixed testing ports. 147 // specified by the URL, due to Alternate-Protocol or fixed testing ports.
149 const HostPortPair endpoint_; 148 const HostPortPair endpoint_;
150 scoped_refptr<HttpAuthController> auth_; 149 scoped_refptr<HttpAuthController> auth_;
151 150
152 // We buffer the response body as it arrives asynchronously from the stream. 151 // We buffer the response body as it arrives asynchronously from the stream.
153 SpdyReadQueue read_buffer_queue_; 152 std::list<scoped_refptr<DrainableIOBuffer> > read_buffer_;
154 153
155 // User provided buffer for the Read() response. 154 // User provided buffer for the Read() response.
156 scoped_refptr<IOBuffer> user_buffer_; 155 scoped_refptr<DrainableIOBuffer> user_buffer_;
157 size_t user_buffer_len_;
158 156
159 // User specified number of bytes to be written. 157 // User specified number of bytes to be written.
160 int write_buffer_len_; 158 int write_buffer_len_;
161 // Number of bytes written which have not been confirmed 159 // Number of bytes written which have not been confirmed
162 int write_bytes_outstanding_; 160 int write_bytes_outstanding_;
163 161
164 // True if the transport socket has ever sent data. 162 // True if the transport socket has ever sent data.
165 bool was_ever_used_; 163 bool was_ever_used_;
166 164
167 scoped_ptr<SpdyHttpStream> response_stream_; 165 scoped_ptr<SpdyHttpStream> response_stream_;
168 166
169 base::WeakPtrFactory<SpdyProxyClientSocket> weak_factory_; 167 base::WeakPtrFactory<SpdyProxyClientSocket> weak_factory_;
170 168
171 const BoundNetLog net_log_; 169 const BoundNetLog net_log_;
172 170
173 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket); 171 DISALLOW_COPY_AND_ASSIGN(SpdyProxyClientSocket);
174 }; 172 };
175 173
176 } // namespace net 174 } // namespace net
177 175
178 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_ 176 #endif // NET_SPDY_SPDY_PROXY_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « trunk/src/net/spdy/spdy_io_buffer.cc ('k') | trunk/src/net/spdy/spdy_proxy_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698