| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bidirectional_stream_spdy_job.h" | 5 #include "net/spdy/bidirectional_stream_spdy_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "net/http/bidirectional_stream_request_info.h" | 12 #include "net/http/bidirectional_stream_request_info.h" |
| 13 #include "net/spdy/spdy_buffer.h" | 13 #include "net/spdy/spdy_buffer.h" |
| 14 #include "net/spdy/spdy_header_block.h" | 14 #include "net/spdy/spdy_header_block.h" |
| 15 #include "net/spdy/spdy_http_utils.h" | 15 #include "net/spdy/spdy_http_utils.h" |
| 16 #include "net/spdy/spdy_stream.h" | 16 #include "net/spdy/spdy_stream.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Time to wait in millisecond to notify |delegate_| of data received. | 22 // Time to wait in millisecond to notify |delegate_| of data received. |
| 23 // Handing small chunks of data to the caller creates measurable overhead. | 23 // Handing small chunks of data to the caller creates measurable overhead. |
| 24 // So buffer data in short time-spans and send a single read notification. | 24 // So buffer data in short time-spans and send a single read notification. |
| 25 const int64 kBufferTimeMs = 1; | 25 const int kBufferTimeMs = 1; |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 BidirectionalStreamSpdyJob::BidirectionalStreamSpdyJob( | 29 BidirectionalStreamSpdyJob::BidirectionalStreamSpdyJob( |
| 30 const base::WeakPtr<SpdySession>& spdy_session) | 30 const base::WeakPtr<SpdySession>& spdy_session) |
| 31 : spdy_session_(spdy_session), | 31 : spdy_session_(spdy_session), |
| 32 request_info_(nullptr), | 32 request_info_(nullptr), |
| 33 delegate_(nullptr), | 33 delegate_(nullptr), |
| 34 negotiated_protocol_(kProtoUnknown), | 34 negotiated_protocol_(kProtoUnknown), |
| 35 more_read_data_pending_(false), | 35 more_read_data_pending_(false), |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 bool BidirectionalStreamSpdyJob::ShouldWaitForMoreBufferedData() const { | 272 bool BidirectionalStreamSpdyJob::ShouldWaitForMoreBufferedData() const { |
| 273 if (stream_closed_) | 273 if (stream_closed_) |
| 274 return false; | 274 return false; |
| 275 DCHECK_GT(read_buffer_len_, 0); | 275 DCHECK_GT(read_buffer_len_, 0); |
| 276 return read_data_queue_.GetTotalSize() < | 276 return read_data_queue_.GetTotalSize() < |
| 277 static_cast<size_t>(read_buffer_len_); | 277 static_cast<size_t>(read_buffer_len_); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace net | 280 } // namespace net |
| OLD | NEW |