Chromium Code Reviews| 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 // HttpStream is an interface for reading and writing data to an HttpStream that | 5 // HttpStream is an interface for reading and writing data to an HttpStream that |
| 6 // keeps the client agnostic of the actual underlying transport layer. This | 6 // keeps the client agnostic of the actual underlying transport layer. This |
| 7 // provides an abstraction for both a basic http stream as well as http | 7 // provides an abstraction for both a basic http stream as well as http |
| 8 // pipelining implementations. The HttpStream subtype is expected to manage the | 8 // pipelining implementations. The HttpStream subtype is expected to manage the |
| 9 // underlying transport appropriately. For example, a non-pipelined HttpStream | 9 // underlying transport appropriately. For example, a non-pipelined HttpStream |
| 10 // would return the transport socket to the pool for reuse. SPDY streams on the | 10 // would return the transport socket to the pool for reuse. SPDY streams on the |
| 11 // other hand leave the transport socket management to the SpdySession. | 11 // other hand leave the transport socket management to the SpdySession. |
| 12 | 12 |
| 13 #ifndef NET_HTTP_HTTP_STREAM_H_ | 13 #ifndef NET_HTTP_HTTP_STREAM_H_ |
| 14 #define NET_HTTP_HTTP_STREAM_H_ | 14 #define NET_HTTP_HTTP_STREAM_H_ |
| 15 #pragma once | 15 #pragma once |
| 16 | 16 |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
| 20 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
| 21 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 | 24 |
| 25 class BoundNetLog; | 25 class BoundNetLog; |
| 26 class HttpNetworkSession; | |
| 26 class HttpRequestHeaders; | 27 class HttpRequestHeaders; |
| 27 struct HttpRequestInfo; | 28 struct HttpRequestInfo; |
| 28 class HttpResponseInfo; | 29 class HttpResponseInfo; |
| 29 class IOBuffer; | 30 class IOBuffer; |
| 30 class SSLCertRequestInfo; | 31 class SSLCertRequestInfo; |
| 31 class SSLInfo; | 32 class SSLInfo; |
| 32 class UploadDataStream; | 33 class UploadDataStream; |
| 33 | 34 |
| 34 class NET_EXPORT_PRIVATE HttpStream { | 35 class NET_EXPORT_PRIVATE HttpStream { |
| 35 public: | 36 public: |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0; | 133 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0; |
| 133 | 134 |
| 134 // HACK(willchan): Really, we should move the HttpResponseDrainer logic into | 135 // HACK(willchan): Really, we should move the HttpResponseDrainer logic into |
| 135 // the HttpStream implementation. This is just a quick hack. | 136 // the HttpStream implementation. This is just a quick hack. |
| 136 virtual bool IsSpdyHttpStream() const = 0; | 137 virtual bool IsSpdyHttpStream() const = 0; |
| 137 | 138 |
| 138 // Record histogram of number of round trips taken to download the full | 139 // Record histogram of number of round trips taken to download the full |
| 139 // response body vs bytes transferred. | 140 // response body vs bytes transferred. |
| 140 virtual void LogNumRttVsBytesMetrics() const = 0; | 141 virtual void LogNumRttVsBytesMetrics() const = 0; |
| 141 | 142 |
| 143 // In the case of an HTTP error, flush the response body (usually a simple | |
|
willchan no longer on Chromium
2011/09/03 01:11:06
It's not only used for HTTP errors, but also redir
James Simonsen
2011/09/07 21:20:10
Done.
| |
| 144 // error page) so that we can re-use the underlying connection. This stream | |
| 145 // is responsible for deleting itself when draining is complete. | |
| 146 virtual void Drain(HttpNetworkSession* session) = 0; | |
| 147 | |
| 142 private: | 148 private: |
| 143 DISALLOW_COPY_AND_ASSIGN(HttpStream); | 149 DISALLOW_COPY_AND_ASSIGN(HttpStream); |
| 144 }; | 150 }; |
| 145 | 151 |
| 146 } // namespace net | 152 } // namespace net |
| 147 | 153 |
| 148 #endif // NET_HTTP_HTTP_STREAM_H_ | 154 #endif // NET_HTTP_HTTP_STREAM_H_ |
| OLD | NEW |