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_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1175 |
1176 // TODO(mbelshe): reduce memory copies here. | 1176 // TODO(mbelshe): reduce memory copies here. |
1177 DCHECK(buffered_spdy_framer_.get()); | 1177 DCHECK(buffered_spdy_framer_.get()); |
1178 scoped_ptr<SpdyFrame> frame( | 1178 scoped_ptr<SpdyFrame> frame( |
1179 buffered_spdy_framer_->CreateDataFrame( | 1179 buffered_spdy_framer_->CreateDataFrame( |
1180 stream_id, data->data(), | 1180 stream_id, data->data(), |
1181 static_cast<uint32>(effective_len), flags)); | 1181 static_cast<uint32>(effective_len), flags)); |
1182 | 1182 |
1183 scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(frame.Pass())); | 1183 scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(frame.Pass())); |
1184 | 1184 |
1185 if (flow_control_state_ == FLOW_CONTROL_STREAM_AND_SESSION) { | 1185 // Send window size is based on payload size, so nothing to do if this is |
| 1186 // just a FIN with no payload. |
| 1187 if (flow_control_state_ == FLOW_CONTROL_STREAM_AND_SESSION && |
| 1188 effective_len != 0) { |
1186 DecreaseSendWindowSize(static_cast<int32>(effective_len)); | 1189 DecreaseSendWindowSize(static_cast<int32>(effective_len)); |
1187 data_buffer->AddConsumeCallback( | 1190 data_buffer->AddConsumeCallback( |
1188 base::Bind(&SpdySession::OnWriteBufferConsumed, | 1191 base::Bind(&SpdySession::OnWriteBufferConsumed, |
1189 weak_factory_.GetWeakPtr(), | 1192 weak_factory_.GetWeakPtr(), |
1190 static_cast<size_t>(effective_len))); | 1193 static_cast<size_t>(effective_len))); |
1191 } | 1194 } |
1192 | 1195 |
1193 return data_buffer.Pass(); | 1196 return data_buffer.Pass(); |
1194 } | 1197 } |
1195 | 1198 |
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3195 if (!queue->empty()) { | 3198 if (!queue->empty()) { |
3196 SpdyStreamId stream_id = queue->front(); | 3199 SpdyStreamId stream_id = queue->front(); |
3197 queue->pop_front(); | 3200 queue->pop_front(); |
3198 return stream_id; | 3201 return stream_id; |
3199 } | 3202 } |
3200 } | 3203 } |
3201 return 0; | 3204 return 0; |
3202 } | 3205 } |
3203 | 3206 |
3204 } // namespace net | 3207 } // namespace net |
OLD | NEW |