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

Unified Diff: net/spdy/spdy_http_stream.cc

Issue 2064593002: Change SPDY to call request_callback after data is sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: call cb only after the whole data has been sent if there was data Created 4 years, 6 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 | « no previous file | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_stream.cc
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 259581a5229173cc2e7fcbc84963396f357c0d80..97c4ad6e1fec4899313131ab8c4b1bdf20abb998 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -302,13 +302,12 @@ void SpdyHttpStream::Cancel() {
}
void SpdyHttpStream::OnRequestHeadersSent() {
- if (!request_callback_.is_null())
- DoRequestCallback(OK);
-
- // TODO(akalin): Do this immediately after sending the request
- // headers.
- if (HasUploadData())
+ if (HasUploadData()) {
ReadAndSendRequestBodyData();
+ } else {
+ if (!request_callback_.is_null())
+ DoRequestCallback(OK);
+ }
}
SpdyResponseHeadersStatus SpdyHttpStream::OnResponseHeadersUpdated(
@@ -437,8 +436,14 @@ void SpdyHttpStream::ReadAndSendRequestBodyData() {
CHECK(HasUploadData());
CHECK_EQ(request_body_buf_size_, 0);
- if (request_info_->upload_data_stream->IsEOF())
+ if (request_info_->upload_data_stream->IsEOF()) {
+ // The cb should be null here, but it's better to be
+ // paranoid.
mmenke 2016/06/14 15:25:44 I don't believe this is true - when uploading chun
maksims (do not use this acc) 2016/06/15 07:51:45 Check the SendChunkedPostLastEmpty that I added. A
+ if (!request_callback_.is_null()) {
+ DoRequestCallback(OK);
+ }
mmenke 2016/06/14 15:25:44 nit: Remove braces
return;
+ }
// Read the data from the request body stream.
const int rv = request_info_->upload_data_stream
@@ -461,6 +466,10 @@ void SpdyHttpStream::OnRequestBodyReadCompleted(int status) {
// Only the final fame may have a length of 0.
if (eof) {
CHECK_GE(request_body_buf_size_, 0);
+ // Call the cb only after the whole data is sent.
mmenke 2016/06/14 15:25:44 nit: "after the whole file is sent." or "after al
maksims (do not use this acc) 2016/06/15 07:51:45 Done.
+ if (!request_callback_.is_null()) {
+ DoRequestCallback(OK);
+ }
mmenke 2016/06/14 15:25:44 nit: Remove braces
maksims (do not use this acc) 2016/06/15 07:51:45 Done.
} else {
CHECK_GT(request_body_buf_size_, 0);
}
@@ -533,7 +542,6 @@ void SpdyHttpStream::DoBufferedReadCallback() {
void SpdyHttpStream::DoRequestCallback(int rv) {
CHECK_NE(rv, ERR_IO_PENDING);
CHECK(!request_callback_.is_null());
-
// Since Run may result in being called back, reset request_callback_ in
// advance.
base::ResetAndReturn(&request_callback_).Run(rv);
« no previous file with comments | « no previous file | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698