OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/spdy_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if (stream_) { | 129 if (stream_) { |
130 CHECK(stream_->is_idle()); | 130 CHECK(stream_->is_idle()); |
131 CHECK(!stream_->closed()); | 131 CHECK(!stream_->closed()); |
132 } | 132 } |
133 CHECK(buf); | 133 CHECK(buf); |
134 CHECK(buf_len); | 134 CHECK(buf_len); |
135 CHECK(!callback.is_null()); | 135 CHECK(!callback.is_null()); |
136 | 136 |
137 // If we have data buffered, complete the IO immediately. | 137 // If we have data buffered, complete the IO immediately. |
138 if (!response_body_queue_.IsEmpty()) { | 138 if (!response_body_queue_.IsEmpty()) { |
139 size_t bytes_consumed = response_body_queue_.Dequeue(buf->data(), buf_len); | 139 return response_body_queue_.Dequeue(buf->data(), buf_len); |
140 if (stream_) | |
141 stream_->IncreaseRecvWindowSize(bytes_consumed); | |
142 return bytes_consumed; | |
143 } else if (stream_closed_) { | 140 } else if (stream_closed_) { |
144 return closed_stream_status_; | 141 return closed_stream_status_; |
145 } | 142 } |
146 | 143 |
147 CHECK(callback_.is_null()); | 144 CHECK(callback_.is_null()); |
148 CHECK(!user_buffer_); | 145 CHECK(!user_buffer_); |
149 CHECK_EQ(0, user_buffer_len_); | 146 CHECK_EQ(0, user_buffer_len_); |
150 | 147 |
151 callback_ = callback; | 148 callback_ = callback; |
152 user_buffer_ = buf; | 149 user_buffer_ = buf; |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 bool SpdyHttpStream::IsSpdyHttpStream() const { | 565 bool SpdyHttpStream::IsSpdyHttpStream() const { |
569 return true; | 566 return true; |
570 } | 567 } |
571 | 568 |
572 void SpdyHttpStream::Drain(HttpNetworkSession* session) { | 569 void SpdyHttpStream::Drain(HttpNetworkSession* session) { |
573 Close(false); | 570 Close(false); |
574 delete this; | 571 delete this; |
575 } | 572 } |
576 | 573 |
577 } // namespace net | 574 } // namespace net |
OLD | NEW |