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

Unified Diff: net/spdy/spdy_stream.cc

Issue 6292013: Add chunked uploads support to SPDY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 10 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/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_stream.cc
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 3900993c02aeac8dbe48220b8a4cb07c90b0256c..e948b332e76cddcb6b4ff4f075fed4e30209e23a 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -112,6 +112,8 @@ void SpdyStream::PushedStreamReplayData() {
}
void SpdyStream::DetachDelegate() {
+ if (delegate_)
+ delegate_->set_chunk_callback(NULL);
delegate_ = NULL;
if (!closed())
Cancel();
@@ -348,13 +350,22 @@ void SpdyStream::OnWriteComplete(int bytes) {
DoLoop(bytes);
}
+void SpdyStream::OnChunkAvailable() {
+ DCHECK(io_state_ == STATE_SEND_HEADERS || io_state_ == STATE_SEND_BODY ||
+ io_state_ == STATE_SEND_BODY_COMPLETE);
+ if (io_state_ == STATE_SEND_BODY)
+ OnWriteComplete(0);
+}
+
void SpdyStream::OnClose(int status) {
io_state_ = STATE_DONE;
response_status_ = status;
Delegate* delegate = delegate_;
delegate_ = NULL;
- if (delegate)
+ if (delegate) {
+ delegate->set_chunk_callback(NULL);
delegate->OnClose(status);
+ }
}
void SpdyStream::Cancel() {
@@ -367,6 +378,9 @@ void SpdyStream::Cancel() {
}
int SpdyStream::SendRequest(bool has_upload_data) {
+ if (delegate_)
+ delegate_->set_chunk_callback(this);
+
// Pushed streams do not send any data, and should always be in STATE_OPEN or
// STATE_DONE. However, we still want to return IO_PENDING to mimic non-push
// behavior.
@@ -545,17 +559,17 @@ int SpdyStream::DoSendBodyComplete(int result) {
if (result < 0)
return result;
- CHECK_NE(result, 0);
-
if (!delegate_)
return ERR_UNEXPECTED;
- if (!delegate_->OnSendBodyComplete(result))
+ bool eof = false;
+ result = delegate_->OnSendBodyComplete(result, &eof);
+ if (!eof)
io_state_ = STATE_SEND_BODY;
else
io_state_ = STATE_WAITING_FOR_RESPONSE;
- return OK;
+ return result;
}
int SpdyStream::DoOpen(int result) {
« no previous file with comments | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698