summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_http_stream.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 19:05:18 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 19:05:18 +0000
commit78bf2aa62eb081644cf3b76bb36e95de1a730658 (patch)
tree26b891501661a39aee029106d6ace10620b81aa1 /net/spdy/spdy_http_stream.h
parent00f71870f67dcb264c0eabe3060fd06a3c9259af (diff)
downloadchromium_src-78bf2aa62eb081644cf3b76bb36e95de1a730658.zip
chromium_src-78bf2aa62eb081644cf3b76bb36e95de1a730658.tar.gz
chromium_src-78bf2aa62eb081644cf3b76bb36e95de1a730658.tar.bz2
Revert 50215 because of crashes - Refactor SpdyStream to get HTTP specific out of the interface and members.
Add SpdyStream::Delegate interface and SpdyHttpStream implements SpdyStream::Delegate. SpdyHeaderBlock<>HTTP request/response conversion functions moved from spdy_session.cc to spdy_http_stream.cc. All interface between SpdySession and SpdyStream uses SpdyHeaderBlock instead of HttpRequestInfo,HttpResponseInfo. BUG=42320,46925 TEST=none Review URL: http://codereview.chromium.org/2667002 TBR=ukai@chromium.org Review URL: http://codereview.chromium.org/2827015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50268 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_http_stream.h')
-rw-r--r--net/spdy/spdy_http_stream.h58
1 files changed, 17 insertions, 41 deletions
diff --git a/net/spdy/spdy_http_stream.h b/net/spdy/spdy_http_stream.h
index b83c670..11c00e0 100644
--- a/net/spdy/spdy_http_stream.h
+++ b/net/spdy/spdy_http_stream.h
@@ -11,7 +11,6 @@
#include "base/ref_counted.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
-#include "net/http/http_request_info.h"
#include "net/spdy/spdy_protocol.h"
#include "net/spdy/spdy_stream.h"
@@ -24,29 +23,21 @@ class UploadData;
class UploadDataStream;
// The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession.
-class SpdyHttpStream : public SpdyStream::Delegate,
- public base::RefCounted<SpdyHttpStream> {
+class SpdyHttpStream : public SpdyStream {
public:
// SpdyHttpStream constructor
- explicit SpdyHttpStream(const scoped_refptr<SpdyStream>& stream);
-
- SpdyStream* stream() { return stream_.get(); }
-
- // Initialize request. Must be called before calling SendRequest().
- // SpdyHttpStream takes ownership of |upload_data|. |upload_data| may be NULL.
- void InitializeRequest(const HttpRequestInfo& request_info,
- base::Time request_time,
- UploadDataStream* upload_data);
-
- const HttpResponseInfo* GetResponseInfo() const;
+ SpdyHttpStream(
+ SpdySession* session, spdy::SpdyStreamId stream_id, bool pushed);
// ===================================================
// Interface for [Http|Spdy]NetworkTransaction to use.
- // Sends the request.
- // |callback| is used when this completes asynchronously.
- // The actual SYN_STREAM packet will be sent if the stream is non-pushed.
- int SendRequest(HttpResponseInfo* response,
+ // Sends the request. If |upload_data| is non-NULL, sends that in the request
+ // body. |callback| is used when this completes asynchronously. Note that
+ // the actual SYN_STREAM packet will have already been sent by this point.
+ // Also note that SpdyStream takes ownership of |upload_data|.
+ int SendRequest(UploadDataStream* upload_data,
+ HttpResponseInfo* response,
CompletionCallback* callback);
// Reads the response headers. Returns a net error code.
@@ -64,25 +55,24 @@ class SpdyHttpStream : public SpdyStream::Delegate,
uint64 GetUploadProgress() const;
// ===================================================
- // SpdyStream::Delegate.
-
- virtual bool OnSendHeadersComplete(int status);
- virtual int OnSendBody();
- virtual bool OnSendBodyComplete(int status);
+ // Interface for SpdySession to use.
// Called by the SpdySession when a response (e.g. a SYN_REPLY) has been
// received for this stream.
// SpdyHttpSession calls back |callback| set by SendRequest or
// ReadResponseHeaders.
- virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response,
- base::Time response_time,
- int status);
+ virtual int OnResponseReceived(const HttpResponseInfo& response);
// Called by the SpdySession when response data has been received for this
// stream. This callback may be called multiple times as data arrives
// from the network, and will never be called prior to OnResponseReceived.
// SpdyHttpSession schedule to call back |callback| set by ReadResponseBody.
- virtual void OnDataReceived(const char* buffer, int bytes);
+ virtual bool OnDataReceived(const char* buffer, int bytes);
+
+ // Called by the SpdySession when a write has completed. This callback
+ // will be called multiple times for each write which completes. Writes
+ // include the SYN_STREAM write and also DATA frame writes.
+ virtual void OnWriteComplete(int status);
// Called by the SpdySession when the request is finished. This callback
// will always be called at the end of the request and signals to the
@@ -103,20 +93,6 @@ class SpdyHttpStream : public SpdyStream::Delegate,
void DoBufferedReadCallback();
bool ShouldWaitForMoreBufferedData() const;
- const scoped_refptr<SpdyStream> stream_;
-
- // The request to send.
- HttpRequestInfo request_info_;
-
- scoped_ptr<UploadDataStream> request_body_stream_;
-
- // |response_info_| is the HTTP response data object which is filled in
- // when a SYN_REPLY comes in for the stream.
- // It is not owned by this stream object, or point to |push_response_info_|.
- HttpResponseInfo* response_info_;
-
- scoped_ptr<HttpResponseInfo> push_response_info_;
-
bool download_finished_;
// We buffer the response body as it arrives asynchronously from the stream.