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

Unified Diff: net/http/http_stream.h

Issue 1320683003: Move logic to figure out if a socket can be reused into HttpStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_response_body_drainer_unittest.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream.h
diff --git a/net/http/http_stream.h b/net/http/http_stream.h
index 3e8703d1b239edcdd8112aec6e9fbcacfb52e746..2bfc5b66b49a2dfbe4f4a6bb4e97dce0428c6383 100644
--- a/net/http/http_stream.h
+++ b/net/http/http_stream.h
@@ -89,34 +89,31 @@ class NET_EXPORT_PRIVATE HttpStream {
// In the case of HTTP, where we re-use the byte-stream (e.g. the connection)
// this means we need to close the connection; in the case of SPDY, where the
// underlying stream is never reused, it has no effect.
- // TODO(mbelshe): We should figure out how to fold the not_reusable flag
- // into the stream implementation itself so that the caller
- // does not need to pass it at all. We might also be able to
- // eliminate the SetConnectionReused() below.
+ // TODO(mmenke): We should fold the |not_reusable| flag into the stream
+ // implementation itself so that the caller does not need to
+ // pass it at all. Ideally we'd be able to remove
+ // CanReuseConnection() and IsResponseBodyComplete().
Ryan Hamilton 2015/09/02 04:42:40 Boy this would be great.
+ // TODO(mmenke): We should try and merge Drain() into this method as well.
virtual void Close(bool not_reusable) = 0;
// Indicates if the response body has been completely read.
virtual bool IsResponseBodyComplete() const = 0;
- // Indicates that the end of the response is detectable. This means that
- // the response headers indicate either chunked encoding or content length.
- // If neither is sent, the server must close the connection for us to detect
- // the end of the response.
- // TODO(rch): Rename this method, so that it is clear why it exists
- // particularly as it applies to QUIC and SPDY for which the end of the
- // response is always findable.
- virtual bool CanFindEndOfResponse() const = 0;
-
// A stream exists on top of a connection. If the connection has been used
// to successfully exchange data in the past, error handling for the
// stream is done differently. This method returns true if the underlying
// connection is reused or has been connected and idle for some time.
virtual bool IsConnectionReused() const = 0;
+ // TODO(mmenke): We should fold this into RenewStreamForAuth(), and make that
+ // method drain the stream as well, if needed (And return asynchronously).
virtual void SetConnectionReused() = 0;
- // Checks whether the current state of the underlying connection
- // allows it to be reused.
- virtual bool IsConnectionReusable() const = 0;
+ // Checks whether the underlying connection can be reused. The stream's
+ // connection can be reused if the response headers allow for it, the socket
+ // is still connected, and the stream exclusively owns the underlying
+ // connection. SPDY and QUIC streams don't own their own connections, so
+ // always return false.
+ virtual bool CanReuseConnection() const = 0;
// Get the total number of bytes received from network for this stream.
virtual int64 GetTotalReceivedBytes() const = 0;
@@ -142,10 +139,6 @@ class NET_EXPORT_PRIVATE HttpStream {
// behavior is undefined.
virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0;
- // HACK(willchan): Really, we should move the HttpResponseDrainer logic into
- // the HttpStream implementation. This is just a quick hack.
- virtual bool IsSpdyHttpStream() const = 0;
-
// In the case of an HTTP error or redirect, flush the response body (usually
// a simple error or "this page has moved") so that we can re-use the
// underlying connection. This stream is responsible for deleting itself when
« no previous file with comments | « net/http/http_response_body_drainer_unittest.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698