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

Side by Side Diff: net/http/http_stream_base.h

Issue 11364068: Add a QuicHttpStream class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NET_EXPORT_PRIVATE Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // HttpStreamBase is an interface for reading and writing data to an 5 // HttpStreamBase is an interface for reading and writing data to an
6 // HTTP-like stream that keeps the client agnostic of the actual underlying 6 // HTTP-like stream that keeps the client agnostic of the actual underlying
7 // transport layer. This provides an abstraction for HttpStream and 7 // transport layer. This provides an abstraction for HttpStream and
8 // WebSocketStream. 8 // WebSocketStream.
9 9
10 #ifndef NET_HTTP_HTTP_STREAM_BASE_H_ 10 #ifndef NET_HTTP_HTTP_STREAM_BASE_H_
(...skipping 17 matching lines...) Expand all
28 class IOBuffer; 28 class IOBuffer;
29 class SSLCertRequestInfo; 29 class SSLCertRequestInfo;
30 class SSLInfo; 30 class SSLInfo;
31 31
32 class NET_EXPORT_PRIVATE HttpStreamBase { 32 class NET_EXPORT_PRIVATE HttpStreamBase {
33 public: 33 public:
34 HttpStreamBase() {} 34 HttpStreamBase() {}
35 virtual ~HttpStreamBase() {} 35 virtual ~HttpStreamBase() {}
36 36
37 // Initialize stream. Must be called before calling SendRequest(). 37 // Initialize stream. Must be called before calling SendRequest().
38 // |request_info| must outlive the HttpStreamBase.
38 // Returns a net error code, possibly ERR_IO_PENDING. 39 // Returns a net error code, possibly ERR_IO_PENDING.
39 virtual int InitializeStream(const HttpRequestInfo* request_info, 40 virtual int InitializeStream(const HttpRequestInfo* request_info,
40 const BoundNetLog& net_log, 41 const BoundNetLog& net_log,
41 const CompletionCallback& callback) = 0; 42 const CompletionCallback& callback) = 0;
42 43
43 // Writes the headers and uploads body data to the underlying socket. 44 // Writes the headers and uploads body data to the underlying socket.
44 // ERR_IO_PENDING is returned if the operation could not be completed 45 // ERR_IO_PENDING is returned if the operation could not be completed
45 // synchronously, in which case the result will be passed to the callback 46 // synchronously, in which case the result will be passed to the callback
46 // when available. Returns OK on success. 47 // when available. Returns OK on success.
48 // |response| must outlive the HttpStreamBase.
47 virtual int SendRequest(const HttpRequestHeaders& request_headers, 49 virtual int SendRequest(const HttpRequestHeaders& request_headers,
48 HttpResponseInfo* response, 50 HttpResponseInfo* response,
49 const CompletionCallback& callback) = 0; 51 const CompletionCallback& callback) = 0;
50 52
51 // Reads from the underlying socket until the response headers have been 53 // Reads from the underlying socket until the response headers have been
52 // completely received. ERR_IO_PENDING is returned if the operation could 54 // completely received. ERR_IO_PENDING is returned if the operation could
53 // not be completed synchronously, in which case the result will be passed 55 // not be completed synchronously, in which case the result will be passed
54 // to the callback when available. Returns OK on success. The response 56 // to the callback when available. Returns OK on success. The response
55 // headers are available in the HttpResponseInfo returned by GetResponseInfo 57 // headers are available in the HttpResponseInfo returned by GetResponseInfo
56 virtual int ReadResponseHeaders(const CompletionCallback& callback) = 0; 58 virtual int ReadResponseHeaders(const CompletionCallback& callback) = 0;
(...skipping 25 matching lines...) Expand all
82 // eliminate the SetConnectionReused() below. 84 // eliminate the SetConnectionReused() below.
83 virtual void Close(bool not_reusable) = 0; 85 virtual void Close(bool not_reusable) = 0;
84 86
85 // Indicates if the response body has been completely read. 87 // Indicates if the response body has been completely read.
86 virtual bool IsResponseBodyComplete() const = 0; 88 virtual bool IsResponseBodyComplete() const = 0;
87 89
88 // Indicates that the end of the response is detectable. This means that 90 // Indicates that the end of the response is detectable. This means that
89 // the response headers indicate either chunked encoding or content length. 91 // the response headers indicate either chunked encoding or content length.
90 // If neither is sent, the server must close the connection for us to detect 92 // If neither is sent, the server must close the connection for us to detect
91 // the end of the response. 93 // the end of the response.
94 // TODO(rch): Rename this method, so that it is clear why it exists
95 // particularly as it applies to QUIC and SPDY for which the end of the
96 // response is always findable.
92 virtual bool CanFindEndOfResponse() const = 0; 97 virtual bool CanFindEndOfResponse() const = 0;
93 98
94 // A stream exists on top of a connection. If the connection has been used 99 // A stream exists on top of a connection. If the connection has been used
95 // to successfully exchange data in the past, error handling for the 100 // to successfully exchange data in the past, error handling for the
96 // stream is done differently. This method returns true if the underlying 101 // stream is done differently. This method returns true if the underlying
97 // connection is reused or has been connected and idle for some time. 102 // connection is reused or has been connected and idle for some time.
98 virtual bool IsConnectionReused() const = 0; 103 virtual bool IsConnectionReused() const = 0;
99 virtual void SetConnectionReused() = 0; 104 virtual void SetConnectionReused() = 0;
100 105
101 // Checks whether the current state of the underlying connection 106 // Checks whether the current state of the underlying connection
(...skipping 20 matching lines...) Expand all
122 // draining is complete. 127 // draining is complete.
123 virtual void Drain(HttpNetworkSession* session) = 0; 128 virtual void Drain(HttpNetworkSession* session) = 0;
124 129
125 private: 130 private:
126 DISALLOW_COPY_AND_ASSIGN(HttpStreamBase); 131 DISALLOW_COPY_AND_ASSIGN(HttpStreamBase);
127 }; 132 };
128 133
129 } // namespace net 134 } // namespace net
130 135
131 #endif // NET_HTTP_HTTP_STREAM_BASE_H_ 136 #endif // NET_HTTP_HTTP_STREAM_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698