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_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 <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 int buf_len, | 86 int buf_len, |
87 const CompletionCallback& callback) OVERRIDE; | 87 const CompletionCallback& callback) OVERRIDE; |
88 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 88 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
89 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 89 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
90 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; | 90 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; |
91 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | 91 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
92 | 92 |
93 // SpdyStream::Delegate implementation. | 93 // SpdyStream::Delegate implementation. |
94 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; | 94 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; |
95 virtual void OnSendBody() OVERRIDE; | 95 virtual void OnSendBody() OVERRIDE; |
96 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; | 96 virtual SpdySendStatus OnSendBodyComplete() OVERRIDE; |
97 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 97 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
98 base::Time response_time, | 98 base::Time response_time, |
99 int status) OVERRIDE; | 99 int status) OVERRIDE; |
100 virtual void OnHeadersSent() OVERRIDE; | 100 virtual void OnHeadersSent() OVERRIDE; |
101 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; | 101 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; |
102 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; | 102 virtual void OnDataSent() OVERRIDE; |
103 virtual void OnClose(int status) OVERRIDE; | 103 virtual void OnClose(int status) OVERRIDE; |
104 | 104 |
105 private: | 105 private: |
106 enum State { | 106 enum State { |
107 STATE_DISCONNECTED, | 107 STATE_DISCONNECTED, |
108 STATE_GENERATE_AUTH_TOKEN, | 108 STATE_GENERATE_AUTH_TOKEN, |
109 STATE_GENERATE_AUTH_TOKEN_COMPLETE, | 109 STATE_GENERATE_AUTH_TOKEN_COMPLETE, |
110 STATE_SEND_REQUEST, | 110 STATE_SEND_REQUEST, |
111 STATE_SEND_REQUEST_COMPLETE, | 111 STATE_SEND_REQUEST_COMPLETE, |
112 STATE_READ_REPLY_COMPLETE, | 112 STATE_READ_REPLY_COMPLETE, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 // We buffer the response body as it arrives asynchronously from the stream. | 152 // We buffer the response body as it arrives asynchronously from the stream. |
153 SpdyReadQueue read_buffer_queue_; | 153 SpdyReadQueue read_buffer_queue_; |
154 | 154 |
155 // User provided buffer for the Read() response. | 155 // User provided buffer for the Read() response. |
156 scoped_refptr<IOBuffer> user_buffer_; | 156 scoped_refptr<IOBuffer> user_buffer_; |
157 size_t user_buffer_len_; | 157 size_t user_buffer_len_; |
158 | 158 |
159 // User specified number of bytes to be written. | 159 // User specified number of bytes to be written. |
160 int write_buffer_len_; | 160 int write_buffer_len_; |
161 // Number of bytes written which have not been confirmed | |
162 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_ |
OLD | NEW |