| 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_SPDY_SPDY_HTTP_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_HTTP_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_HTTP_STREAM_H_ | 6 #define NET_SPDY_SPDY_HTTP_STREAM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 virtual ~SpdyHttpStream(); | 36 virtual ~SpdyHttpStream(); |
| 37 | 37 |
| 38 // Initializes this SpdyHttpStream by wraping an existing SpdyStream. | 38 // Initializes this SpdyHttpStream by wraping an existing SpdyStream. |
| 39 void InitializeWithExistingStream(SpdyStream* spdy_stream); | 39 void InitializeWithExistingStream(SpdyStream* spdy_stream); |
| 40 | 40 |
| 41 SpdyStream* stream() { return stream_.get(); } | 41 SpdyStream* stream() { return stream_.get(); } |
| 42 | 42 |
| 43 // Cancels any callbacks from being invoked and deletes the stream. | 43 // Cancels any callbacks from being invoked and deletes the stream. |
| 44 void Cancel(); | 44 void Cancel(); |
| 45 | 45 |
| 46 // HttpStream methods: | 46 // HttpStream implementation. |
| 47 virtual int InitializeStream(const HttpRequestInfo* request_info, | 47 virtual int InitializeStream(const HttpRequestInfo* request_info, |
| 48 const BoundNetLog& net_log, | 48 const BoundNetLog& net_log, |
| 49 OldCompletionCallback* callback) OVERRIDE; | 49 const CompletionCallback& callback) OVERRIDE; |
| 50 virtual int SendRequest(const HttpRequestHeaders& headers, | 50 virtual int SendRequest(const HttpRequestHeaders& headers, |
| 51 UploadDataStream* request_body, | 51 UploadDataStream* request_body, |
| 52 HttpResponseInfo* response, | 52 HttpResponseInfo* response, |
| 53 OldCompletionCallback* callback) OVERRIDE; | 53 const CompletionCallback& callback) OVERRIDE; |
| 54 virtual uint64 GetUploadProgress() const OVERRIDE; | 54 virtual uint64 GetUploadProgress() const OVERRIDE; |
| 55 virtual int ReadResponseHeaders(OldCompletionCallback* callback) OVERRIDE; | 55 virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; |
| 56 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; | 56 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; |
| 57 virtual int ReadResponseBody(IOBuffer* buf, | 57 virtual int ReadResponseBody(IOBuffer* buf, |
| 58 int buf_len, | 58 int buf_len, |
| 59 OldCompletionCallback* callback) OVERRIDE; | 59 const CompletionCallback& callback) OVERRIDE; |
| 60 virtual void Close(bool not_reusable) OVERRIDE; | 60 virtual void Close(bool not_reusable) OVERRIDE; |
| 61 virtual HttpStream* RenewStreamForAuth() OVERRIDE; | 61 virtual HttpStream* RenewStreamForAuth() OVERRIDE; |
| 62 virtual bool IsResponseBodyComplete() const OVERRIDE; | 62 virtual bool IsResponseBodyComplete() const OVERRIDE; |
| 63 virtual bool CanFindEndOfResponse() const OVERRIDE; | 63 virtual bool CanFindEndOfResponse() const OVERRIDE; |
| 64 virtual bool IsMoreDataBuffered() const OVERRIDE; | 64 virtual bool IsMoreDataBuffered() const OVERRIDE; |
| 65 virtual bool IsConnectionReused() const OVERRIDE; | 65 virtual bool IsConnectionReused() const OVERRIDE; |
| 66 virtual void SetConnectionReused() OVERRIDE; | 66 virtual void SetConnectionReused() OVERRIDE; |
| 67 virtual bool IsConnectionReusable() const OVERRIDE; | 67 virtual bool IsConnectionReusable() const OVERRIDE; |
| 68 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 68 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
| 69 virtual void GetSSLCertRequestInfo( | 69 virtual void GetSSLCertRequestInfo( |
| 70 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 70 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
| 71 virtual bool IsSpdyHttpStream() const OVERRIDE; | 71 virtual bool IsSpdyHttpStream() const OVERRIDE; |
| 72 virtual void LogNumRttVsBytesMetrics() const OVERRIDE {} | 72 virtual void LogNumRttVsBytesMetrics() const OVERRIDE {} |
| 73 virtual void Drain(HttpNetworkSession* session) OVERRIDE; | 73 virtual void Drain(HttpNetworkSession* session) OVERRIDE; |
| 74 | 74 |
| 75 // SpdyStream::Delegate methods: | 75 // SpdyStream::Delegate implementation. |
| 76 virtual bool OnSendHeadersComplete(int status) OVERRIDE; | 76 virtual bool OnSendHeadersComplete(int status) OVERRIDE; |
| 77 virtual int OnSendBody() OVERRIDE; | 77 virtual int OnSendBody() OVERRIDE; |
| 78 virtual int OnSendBodyComplete(int status, bool* eof) OVERRIDE; | 78 virtual int OnSendBodyComplete(int status, bool* eof) OVERRIDE; |
| 79 virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response, | 79 virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response, |
| 80 base::Time response_time, | 80 base::Time response_time, |
| 81 int status) OVERRIDE; | 81 int status) OVERRIDE; |
| 82 virtual void OnDataReceived(const char* buffer, int bytes) OVERRIDE; | 82 virtual void OnDataReceived(const char* buffer, int bytes) OVERRIDE; |
| 83 virtual void OnDataSent(int length) OVERRIDE; | 83 virtual void OnDataSent(int length) OVERRIDE; |
| 84 virtual void OnClose(int status) OVERRIDE; | 84 virtual void OnClose(int status) OVERRIDE; |
| 85 virtual void set_chunk_callback(ChunkCallback* callback) OVERRIDE; | 85 virtual void set_chunk_callback(ChunkCallback* callback) OVERRIDE; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 112 | 112 |
| 113 scoped_ptr<HttpResponseInfo> push_response_info_; | 113 scoped_ptr<HttpResponseInfo> push_response_info_; |
| 114 | 114 |
| 115 bool download_finished_; | 115 bool download_finished_; |
| 116 bool response_headers_received_; // Indicates waiting for more HEADERS. | 116 bool response_headers_received_; // Indicates waiting for more HEADERS. |
| 117 | 117 |
| 118 // We buffer the response body as it arrives asynchronously from the stream. | 118 // We buffer the response body as it arrives asynchronously from the stream. |
| 119 // TODO(mbelshe): is this infinite buffering? | 119 // TODO(mbelshe): is this infinite buffering? |
| 120 std::list<scoped_refptr<IOBufferWithSize> > response_body_; | 120 std::list<scoped_refptr<IOBufferWithSize> > response_body_; |
| 121 | 121 |
| 122 OldCompletionCallback* user_callback_; | 122 CompletionCallback callback_; |
| 123 | 123 |
| 124 // User provided buffer for the ReadResponseBody() response. | 124 // User provided buffer for the ReadResponseBody() response. |
| 125 scoped_refptr<IOBuffer> user_buffer_; | 125 scoped_refptr<IOBuffer> user_buffer_; |
| 126 int user_buffer_len_; | 126 int user_buffer_len_; |
| 127 | 127 |
| 128 // Is there a scheduled read callback pending. | 128 // Is there a scheduled read callback pending. |
| 129 bool buffered_read_callback_pending_; | 129 bool buffered_read_callback_pending_; |
| 130 // Has more data been received from the network during the wait for the | 130 // Has more data been received from the network during the wait for the |
| 131 // scheduled read callback. | 131 // scheduled read callback. |
| 132 bool more_read_data_pending_; | 132 bool more_read_data_pending_; |
| 133 | 133 |
| 134 // Is this spdy stream direct to the origin server (or to a proxy). | 134 // Is this spdy stream direct to the origin server (or to a proxy). |
| 135 bool direct_; | 135 bool direct_; |
| 136 | 136 |
| 137 bool send_last_chunk_; | 137 bool send_last_chunk_; |
| 138 | 138 |
| 139 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 139 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 } // namespace net | 142 } // namespace net |
| 143 | 143 |
| 144 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 144 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
| OLD | NEW |