| 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/quic/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 | 246 |
| 247 int64 QuicHttpStream::GetTotalReceivedBytes() const { | 247 int64 QuicHttpStream::GetTotalReceivedBytes() const { |
| 248 if (stream_) { | 248 if (stream_) { |
| 249 return stream_->stream_bytes_read(); | 249 return stream_->stream_bytes_read(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 return closed_stream_received_bytes_; | 252 return closed_stream_received_bytes_; |
| 253 } | 253 } |
| 254 | 254 |
| 255 int64 QuicHttpStream::GetReceivedBodyLength() const { |
| 256 return 0; |
| 257 } |
| 258 |
| 255 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { | 259 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { |
| 256 // TODO(mmenke): Figure out what to do here. | 260 // TODO(mmenke): Figure out what to do here. |
| 257 return true; | 261 return true; |
| 258 } | 262 } |
| 259 | 263 |
| 260 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { | 264 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { |
| 261 DCHECK(stream_); | 265 DCHECK(stream_); |
| 262 stream_->GetSSLInfo(ssl_info); | 266 stream_->GetSSLInfo(ssl_info); |
| 263 } | 267 } |
| 264 | 268 |
| 265 void QuicHttpStream::GetSSLCertRequestInfo( | 269 void QuicHttpStream::GetSSLCertRequestInfo( |
| 266 SSLCertRequestInfo* cert_request_info) { | 270 SSLCertRequestInfo* cert_request_info) { |
| 267 DCHECK(stream_); | 271 DCHECK(stream_); |
| 268 NOTIMPLEMENTED(); | 272 NOTIMPLEMENTED(); |
| 269 } | 273 } |
| 270 | 274 |
| 271 bool QuicHttpStream::IsSpdyHttpStream() const { | 275 bool QuicHttpStream::IsSpdyHttpStream() const { |
| 272 return false; | 276 return false; |
| 273 } | 277 } |
| 274 | 278 |
| 275 void QuicHttpStream::Drain(HttpNetworkSession* session) { | 279 void QuicHttpStream::Drain(HttpNetworkSession* session) { |
| 276 Close(false); | 280 Close(false); |
| 277 delete this; | 281 delete this; |
| 278 } | 282 } |
| 279 | 283 |
| 280 void QuicHttpStream::SetPriority(RequestPriority priority) { | 284 void QuicHttpStream::SetPriority(RequestPriority priority) { |
| 281 priority_ = priority; | 285 priority_ = priority; |
| 282 } | 286 } |
| 283 | 287 |
| 288 void QuicHttpStream::SetRestartInfo(int64 read_offset, const void* hash, |
| 289 size_t hash_length) { |
| 290 // Nothing to do here. |
| 291 } |
| 292 |
| 293 void QuicHttpStream::GetHash(void* output, size_t len) { |
| 294 // Nothing to do here. |
| 295 } |
| 296 |
| 284 int QuicHttpStream::OnDataReceived(const char* data, int length) { | 297 int QuicHttpStream::OnDataReceived(const char* data, int length) { |
| 285 DCHECK_NE(0, length); | 298 DCHECK_NE(0, length); |
| 286 // Are we still reading the response headers. | 299 // Are we still reading the response headers. |
| 287 if (!response_headers_received_) { | 300 if (!response_headers_received_) { |
| 288 // Grow the read buffer if necessary. | 301 // Grow the read buffer if necessary. |
| 289 if (read_buf_->RemainingCapacity() < length) { | 302 if (read_buf_->RemainingCapacity() < length) { |
| 290 size_t additional_capacity = length - read_buf_->RemainingCapacity(); | 303 size_t additional_capacity = length - read_buf_->RemainingCapacity(); |
| 291 if (additional_capacity < kHeaderBufInitialSize) | 304 if (additional_capacity < kHeaderBufInitialSize) |
| 292 additional_capacity = kHeaderBufInitialSize; | 305 additional_capacity = kHeaderBufInitialSize; |
| 293 read_buf_->SetCapacity(read_buf_->capacity() + additional_capacity); | 306 read_buf_->SetCapacity(read_buf_->capacity() + additional_capacity); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 562 |
| 550 void QuicHttpStream::BufferResponseBody(const char* data, int length) { | 563 void QuicHttpStream::BufferResponseBody(const char* data, int length) { |
| 551 if (length == 0) | 564 if (length == 0) |
| 552 return; | 565 return; |
| 553 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); | 566 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); |
| 554 memcpy(io_buffer->data(), data, length); | 567 memcpy(io_buffer->data(), data, length); |
| 555 response_body_.push_back(make_scoped_refptr(io_buffer)); | 568 response_body_.push_back(make_scoped_refptr(io_buffer)); |
| 556 } | 569 } |
| 557 | 570 |
| 558 } // namespace net | 571 } // namespace net |
| OLD | NEW |