diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 04:19:49 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 04:19:49 +0000 |
commit | 4f38642501dba0b9d93f24392daf26db428b8ea8 (patch) | |
tree | 4952ee7910b3d0fbde0cd469b74d749034e03e7c /net/spdy/spdy_stream.h | |
parent | a38afbfe24dea4fcbece532908af76c52cf3d85a (diff) | |
download | chromium_src-4f38642501dba0b9d93f24392daf26db428b8ea8.zip chromium_src-4f38642501dba0b9d93f24392daf26db428b8ea8.tar.gz chromium_src-4f38642501dba0b9d93f24392daf26db428b8ea8.tar.bz2 |
Refactor SpdyStream state for WebSocket support
In HTTP, it doesn't use STATE_READ_BODY/STATE_READ_BODY_COMPLETE states. Reading body message is handled in OnDataReceived() and DoLoop() is not involved in this state.
In WebSocket, it will send frame after handshake has been finished, and need to get how many data has been written.
STATE_OPEN handles this.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2962015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_stream.h')
-rw-r--r-- | net/spdy/spdy_stream.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h index 6183be2..bcb38c7 100644 --- a/net/spdy/spdy_stream.h +++ b/net/spdy/spdy_stream.h @@ -57,9 +57,11 @@ class SpdyStream : public base::RefCounted<SpdyStream> { int status) = 0; // Called when data is received. - // Returns true if data is successfully processed. virtual void OnDataReceived(const char* data, int length) = 0; + // Called when data is sent. + virtual void OnDataSent(int length) = 0; + // Called when SpdyStream is closed. virtual void OnClose(int status) = 0; @@ -152,11 +154,14 @@ class SpdyStream : public base::RefCounted<SpdyStream> { int DoReadResponseHeaders(); // Sends DATA frame. - int WriteStreamData(IOBuffer* data, int length); + int WriteStreamData(IOBuffer* data, int length, + spdy::SpdyDataFlags flags); bool GetSSLInfo(SSLInfo* ssl_info, bool* was_npn_negotiated); - bool is_idle() const { return io_state_ == STATE_NONE; } + bool is_idle() const { + return io_state_ == STATE_NONE || io_state_ == STATE_OPEN; + } bool response_complete() const { return response_complete_; } int response_status() const { return response_status_; } @@ -169,8 +174,7 @@ class SpdyStream : public base::RefCounted<SpdyStream> { STATE_SEND_BODY_COMPLETE, STATE_READ_HEADERS, STATE_READ_HEADERS_COMPLETE, - STATE_READ_BODY, - STATE_READ_BODY_COMPLETE, + STATE_OPEN, STATE_DONE }; @@ -187,8 +191,7 @@ class SpdyStream : public base::RefCounted<SpdyStream> { int DoSendBodyComplete(int result); int DoReadHeaders(); int DoReadHeadersComplete(int result); - int DoReadBody(); - int DoReadBodyComplete(int result); + int DoOpen(int result); // Update the histograms. Can safely be called repeatedly, but should only // be called after the stream has completed. |