| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/http/http_basic_stream.h" | 5 #include "net/http/http_basic_stream.h" |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/http/http_request_headers.h" | 10 #include "net/http/http_request_headers.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 HttpBasicStream::~HttpBasicStream() {} | 28 HttpBasicStream::~HttpBasicStream() {} |
| 29 | 29 |
| 30 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, | 30 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, |
| 31 const BoundNetLog& net_log, | 31 const BoundNetLog& net_log, |
| 32 CompletionCallback* callback) { | 32 CompletionCallback* callback) { |
| 33 DCHECK(!parser_.get()); | 33 DCHECK(!parser_.get()); |
| 34 request_info_ = request_info; | 34 request_info_ = request_info; |
| 35 parser_.reset(new HttpStreamParser(connection_.get(), request_info, | 35 parser_.reset(new HttpStreamParser(connection_.get(), request_info, |
| 36 read_buf_, net_log)); | 36 read_buf_, net_log)); |
| 37 bytes_read_offset_ = connection_->socket()->NumBytesRead(); |
| 37 return OK; | 38 return OK; |
| 38 } | 39 } |
| 39 | 40 |
| 40 | 41 |
| 41 int HttpBasicStream::SendRequest(const HttpRequestHeaders& headers, | 42 int HttpBasicStream::SendRequest(const HttpRequestHeaders& headers, |
| 42 UploadDataStream* request_body, | 43 UploadDataStream* request_body, |
| 43 HttpResponseInfo* response, | 44 HttpResponseInfo* response, |
| 44 CompletionCallback* callback) { | 45 CompletionCallback* callback) { |
| 45 DCHECK(parser_.get()); | 46 DCHECK(parser_.get()); |
| 46 DCHECK(request_info_); | 47 DCHECK(request_info_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 113 |
| 113 void HttpBasicStream::GetSSLCertRequestInfo( | 114 void HttpBasicStream::GetSSLCertRequestInfo( |
| 114 SSLCertRequestInfo* cert_request_info) { | 115 SSLCertRequestInfo* cert_request_info) { |
| 115 parser_->GetSSLCertRequestInfo(cert_request_info); | 116 parser_->GetSSLCertRequestInfo(cert_request_info); |
| 116 } | 117 } |
| 117 | 118 |
| 118 bool HttpBasicStream::IsSpdyHttpStream() const { | 119 bool HttpBasicStream::IsSpdyHttpStream() const { |
| 119 return false; | 120 return false; |
| 120 } | 121 } |
| 121 | 122 |
| 123 double HttpBasicStream::GetRTTMs() const { |
| 124 return connection_->socket()->GetRTTMs(); |
| 125 } |
| 126 |
| 127 int HttpBasicStream::GetBytesReceived() const { |
| 128 return connection_->socket()->NumBytesRead() - bytes_read_offset_; |
| 129 } |
| 130 |
| 122 } // namespace net | 131 } // namespace net |
| OLD | NEW |