| 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_QUIC_QUIC_HTTP_STREAM_H_ | 5 #ifndef NET_QUIC_QUIC_HTTP_STREAM_H_ |
| 6 #define NET_QUIC_QUIC_HTTP_STREAM_H_ | 6 #define NET_QUIC_QUIC_HTTP_STREAM_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/http/http_stream.h" | 12 #include "net/http/http_stream.h" |
| 13 #include "net/quic/quic_reliable_client_stream.h" | 13 #include "net/quic/quic_reliable_client_stream.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a | 17 // The QuicHttpStream is a QUIC-specific HttpStream subclass. It holds a |
| 18 // non-owning pointer to a QuicReliableClientStream which it uses to | 18 // non-owning pointer to a QuicReliableClientStream which it uses to |
| 19 // send and receive data. | 19 // send and receive data. |
| 20 class NET_EXPORT_PRIVATE QuicHttpStream : | 20 class NET_EXPORT_PRIVATE QuicHttpStream : |
| 21 public QuicReliableClientStream::Delegate, | 21 public QuicReliableClientStream::Delegate, |
| 22 public HttpStream { | 22 public HttpStream { |
| 23 public: | 23 public: |
| 24 QuicHttpStream(QuicReliableClientStream* stream, bool use_spdy); | 24 explicit QuicHttpStream(QuicReliableClientStream* stream); |
| 25 | 25 |
| 26 virtual ~QuicHttpStream(); | 26 virtual ~QuicHttpStream(); |
| 27 | 27 |
| 28 // HttpStream implementation. | 28 // HttpStream implementation. |
| 29 virtual int InitializeStream(const HttpRequestInfo* request_info, | 29 virtual int InitializeStream(const HttpRequestInfo* request_info, |
| 30 const BoundNetLog& net_log, | 30 const BoundNetLog& net_log, |
| 31 const CompletionCallback& callback) OVERRIDE; | 31 const CompletionCallback& callback) OVERRIDE; |
| 32 virtual int SendRequest(const HttpRequestHeaders& request_headers, | 32 virtual int SendRequest(const HttpRequestHeaders& request_headers, |
| 33 HttpResponseInfo* response, | 33 HttpResponseInfo* response, |
| 34 const CompletionCallback& callback) OVERRIDE; | 34 const CompletionCallback& callback) OVERRIDE; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // when a the response headers are read. It is not owned by this stream. | 106 // when a the response headers are read. It is not owned by this stream. |
| 107 HttpResponseInfo* response_info_; | 107 HttpResponseInfo* response_info_; |
| 108 // Because response data is buffered, also buffer the response status if the | 108 // Because response data is buffered, also buffer the response status if the |
| 109 // stream is explicitly closed via OnError or OnClose with an error. | 109 // stream is explicitly closed via OnError or OnClose with an error. |
| 110 // Once all buffered data has been returned, this will be used as the final | 110 // Once all buffered data has been returned, this will be used as the final |
| 111 // response. | 111 // response. |
| 112 int response_status_; | 112 int response_status_; |
| 113 | 113 |
| 114 bool response_headers_received_; | 114 bool response_headers_received_; |
| 115 | 115 |
| 116 // True if the request and response bodies should be serialized via SPDY. | |
| 117 bool use_spdy_; | |
| 118 | |
| 119 // Serialized HTTP request. | 116 // Serialized HTTP request. |
| 120 std::string request_; | 117 std::string request_; |
| 121 | 118 |
| 122 // Buffer into which response header data is read. | 119 // Buffer into which response header data is read. |
| 123 scoped_refptr<GrowableIOBuffer> read_buf_; | 120 scoped_refptr<GrowableIOBuffer> read_buf_; |
| 124 | 121 |
| 125 // We buffer the response body as it arrives asynchronously from the stream. | 122 // We buffer the response body as it arrives asynchronously from the stream. |
| 126 // TODO(rch): This is infinite buffering, which is bad. | 123 // TODO(rch): This is infinite buffering, which is bad. |
| 127 std::list<scoped_refptr<IOBufferWithSize> > response_body_; | 124 std::list<scoped_refptr<IOBufferWithSize> > response_body_; |
| 128 | 125 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 139 scoped_refptr<DrainableIOBuffer> request_body_buf_; | 136 scoped_refptr<DrainableIOBuffer> request_body_buf_; |
| 140 | 137 |
| 141 BoundNetLog stream_net_log_; | 138 BoundNetLog stream_net_log_; |
| 142 | 139 |
| 143 base::WeakPtrFactory<QuicHttpStream> weak_factory_; | 140 base::WeakPtrFactory<QuicHttpStream> weak_factory_; |
| 144 }; | 141 }; |
| 145 | 142 |
| 146 } // namespace net | 143 } // namespace net |
| 147 | 144 |
| 148 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ | 145 #endif // NET_QUIC_QUIC_HTTP_STREAM_H_ |
| OLD | NEW |