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

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: add check for OnHeadersSent in tests 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
Index: net/spdy/spdy_stream.cc
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 00dc01eb77cbdba1e21d20d67df3e62600c3f588..ec78b6f6ccbf8d12d35d905033b0e6ea96b9e5d9 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);
Ryan Hamilton 2012/08/13 17:10:02 It doesn't look like the HEADERS frame is added to
Takashi Toyoshima 2012/08/14 09:14:02 I added frame.type at line 145 for both of TYPE_DA
// 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(
@@ -580,7 +582,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);
@@ -822,8 +824,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;
}

Powered by Google App Engine
This is Rietveld 408576698