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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "net/http/http_request_info.h" | 22 #include "net/http/http_request_info.h" |
23 #include "net/http/http_response_info.h" | 23 #include "net/http/http_response_info.h" |
24 #include "net/log/net_log.h" | 24 #include "net/log/net_log.h" |
25 #include "net/spdy/spdy_header_block.h" | 25 #include "net/spdy/spdy_header_block.h" |
26 #include "net/spdy/spdy_http_utils.h" | 26 #include "net/spdy/spdy_http_utils.h" |
27 #include "net/spdy/spdy_protocol.h" | 27 #include "net/spdy/spdy_protocol.h" |
28 #include "net/spdy/spdy_session.h" | 28 #include "net/spdy/spdy_session.h" |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 | 31 |
| 32 const size_t SpdyHttpStream::kRequestBodyBufferSize = 1 << 14; // 16KB |
| 33 |
32 SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, | 34 SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, |
33 bool direct) | 35 bool direct) |
34 : spdy_session_(spdy_session), | 36 : spdy_session_(spdy_session), |
35 is_reused_(spdy_session_->IsReused()), | 37 is_reused_(spdy_session_->IsReused()), |
36 stream_closed_(false), | 38 stream_closed_(false), |
37 closed_stream_status_(ERR_FAILED), | 39 closed_stream_status_(ERR_FAILED), |
38 closed_stream_id_(0), | 40 closed_stream_id_(0), |
39 closed_stream_received_bytes_(0), | 41 closed_stream_received_bytes_(0), |
40 closed_stream_sent_bytes_(0), | 42 closed_stream_sent_bytes_(0), |
41 request_info_(NULL), | 43 request_info_(NULL), |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 227 |
226 stream_->SetRequestTime(request_time); | 228 stream_->SetRequestTime(request_time); |
227 // This should only get called in the case of a request occurring | 229 // This should only get called in the case of a request occurring |
228 // during server push that has already begun but hasn't finished, | 230 // during server push that has already begun but hasn't finished, |
229 // so we set the response's request time to be the actual one | 231 // so we set the response's request time to be the actual one |
230 if (response_info_) | 232 if (response_info_) |
231 response_info_->request_time = request_time; | 233 response_info_->request_time = request_time; |
232 | 234 |
233 CHECK(!request_body_buf_.get()); | 235 CHECK(!request_body_buf_.get()); |
234 if (HasUploadData()) { | 236 if (HasUploadData()) { |
235 // Use kMaxSpdyFrameChunkSize as the buffer size, since the request | 237 request_body_buf_ = new IOBufferWithSize(kRequestBodyBufferSize); |
236 // body data is written with this size at a time. | |
237 request_body_buf_ = new IOBufferWithSize(kMaxSpdyFrameChunkSize); | |
238 // The request body buffer is empty at first. | 238 // The request body buffer is empty at first. |
239 request_body_buf_size_ = 0; | 239 request_body_buf_size_ = 0; |
240 } | 240 } |
241 | 241 |
242 CHECK(!callback.is_null()); | 242 CHECK(!callback.is_null()); |
243 CHECK(response); | 243 CHECK(response); |
244 | 244 |
245 // SendRequest can be called in two cases. | 245 // SendRequest can be called in two cases. |
246 // | 246 // |
247 // a) A client initiated request. In this case, |response_info_| should be | 247 // a) A client initiated request. In this case, |response_info_| should be |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; | 584 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; |
585 return; | 585 return; |
586 } | 586 } |
587 | 587 |
588 void SpdyHttpStream::SetPriority(RequestPriority priority) { | 588 void SpdyHttpStream::SetPriority(RequestPriority priority) { |
589 // TODO(akalin): Plumb this through to |stream_request_| and | 589 // TODO(akalin): Plumb this through to |stream_request_| and |
590 // |stream_|. | 590 // |stream_|. |
591 } | 591 } |
592 | 592 |
593 } // namespace net | 593 } // namespace net |
OLD | NEW |