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

Unified Diff: net/spdy/spdy_stream.cc

Issue 10828129: SPDY: WriteHeaders should not invoke OnDataSent callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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_spdy2_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 1e2db2ce1fe89a26226af9bf18bdf166a7c40e6f..aeb370e4fddf5a3ab5dc24c3dbfcfdb1a871ffbd 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -142,11 +142,13 @@ SpdyFrame* SpdyStream::ProduceNextFrame() {
PendingFrame frame = pending_frames_.front();
pending_frames_.pop_front();
+ waiting_completions_.push_back(frame.type);
+
if (frame.type == TYPE_DATA) {
// Send queued data frame.
return frame.data_frame;
} else {
- DCHECK(frame.type == TYPE_HEADER);
+ DCHECK(frame.type == TYPE_HEADERS);
// Create actual HEADERS frame just in time because it depends on
// compression context and should not be reordered after the creation.
SpdyFrame* header_frame = session_->CreateHeadersFrame(
@@ -589,7 +591,7 @@ int SpdyStream::WriteHeaders(SpdyHeaderBlock* headers) {
CHECK_GT(stream_id_, 0u);
PendingFrame frame;
- frame.type = TYPE_HEADER;
+ frame.type = TYPE_HEADERS;
frame.header_block = headers;
pending_frames_.push_back(frame);
@@ -831,8 +833,16 @@ int SpdyStream::DoSendBodyComplete(int result) {
}
int SpdyStream::DoOpen(int result) {
- if (delegate_)
- delegate_->OnDataSent(result);
+ if (delegate_) {
+ FrameType type = waiting_completions_.front();
+ waiting_completions_.pop_front();
+ if (type == TYPE_DATA) {
+ delegate_->OnDataSent(result);
+ } else {
+ DCHECK(type == TYPE_HEADERS);
+ delegate_->OnHeadersSent();
+ }
+ }
io_state_ = STATE_OPEN;
return result;
}
« no previous file with comments | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698