| 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/http/http_basic_stream.h" | 5 #include "net/http/http_basic_stream.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "net/http/http_request_info.h" | 8 #include "net/http/http_request_info.h" |
| 9 #include "net/http/http_response_body_drainer.h" | 9 #include "net/http/http_response_body_drainer.h" |
| 10 #include "net/http/http_stream_parser.h" | 10 #include "net/http/http_stream_parser.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // than leaving it until the destructor is called. | 60 // than leaving it until the destructor is called. |
| 61 state_.DeleteParser(); | 61 state_.DeleteParser(); |
| 62 return new HttpBasicStream(state_.ReleaseConnection().release(), | 62 return new HttpBasicStream(state_.ReleaseConnection().release(), |
| 63 state_.using_proxy()); | 63 state_.using_proxy()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool HttpBasicStream::IsResponseBodyComplete() const { | 66 bool HttpBasicStream::IsResponseBodyComplete() const { |
| 67 return parser()->IsResponseBodyComplete(); | 67 return parser()->IsResponseBodyComplete(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool HttpBasicStream::CanFindEndOfResponse() const { | |
| 71 return parser()->CanFindEndOfResponse(); | |
| 72 } | |
| 73 | |
| 74 bool HttpBasicStream::IsConnectionReused() const { | 70 bool HttpBasicStream::IsConnectionReused() const { |
| 75 return parser()->IsConnectionReused(); | 71 return parser()->IsConnectionReused(); |
| 76 } | 72 } |
| 77 | 73 |
| 78 void HttpBasicStream::SetConnectionReused() { parser()->SetConnectionReused(); } | 74 void HttpBasicStream::SetConnectionReused() { parser()->SetConnectionReused(); } |
| 79 | 75 |
| 80 bool HttpBasicStream::IsConnectionReusable() const { | 76 bool HttpBasicStream::CanReuseConnection() const { |
| 81 return parser()->IsConnectionReusable(); | 77 return parser()->CanReuseConnection(); |
| 82 } | 78 } |
| 83 | 79 |
| 84 int64 HttpBasicStream::GetTotalReceivedBytes() const { | 80 int64 HttpBasicStream::GetTotalReceivedBytes() const { |
| 85 if (parser()) | 81 if (parser()) |
| 86 return parser()->received_bytes(); | 82 return parser()->received_bytes(); |
| 87 return 0; | 83 return 0; |
| 88 } | 84 } |
| 89 | 85 |
| 90 bool HttpBasicStream::GetLoadTimingInfo( | 86 bool HttpBasicStream::GetLoadTimingInfo( |
| 91 LoadTimingInfo* load_timing_info) const { | 87 LoadTimingInfo* load_timing_info) const { |
| 92 return state_.connection()->GetLoadTimingInfo(IsConnectionReused(), | 88 return state_.connection()->GetLoadTimingInfo(IsConnectionReused(), |
| 93 load_timing_info); | 89 load_timing_info); |
| 94 } | 90 } |
| 95 | 91 |
| 96 void HttpBasicStream::GetSSLInfo(SSLInfo* ssl_info) { | 92 void HttpBasicStream::GetSSLInfo(SSLInfo* ssl_info) { |
| 97 parser()->GetSSLInfo(ssl_info); | 93 parser()->GetSSLInfo(ssl_info); |
| 98 } | 94 } |
| 99 | 95 |
| 100 void HttpBasicStream::GetSSLCertRequestInfo( | 96 void HttpBasicStream::GetSSLCertRequestInfo( |
| 101 SSLCertRequestInfo* cert_request_info) { | 97 SSLCertRequestInfo* cert_request_info) { |
| 102 parser()->GetSSLCertRequestInfo(cert_request_info); | 98 parser()->GetSSLCertRequestInfo(cert_request_info); |
| 103 } | 99 } |
| 104 | 100 |
| 105 bool HttpBasicStream::IsSpdyHttpStream() const { return false; } | |
| 106 | |
| 107 void HttpBasicStream::Drain(HttpNetworkSession* session) { | 101 void HttpBasicStream::Drain(HttpNetworkSession* session) { |
| 108 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); | 102 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); |
| 109 drainer->Start(session); | 103 drainer->Start(session); |
| 110 // |drainer| will delete itself. | 104 // |drainer| will delete itself. |
| 111 } | 105 } |
| 112 | 106 |
| 113 void HttpBasicStream::SetPriority(RequestPriority priority) { | 107 void HttpBasicStream::SetPriority(RequestPriority priority) { |
| 114 // TODO(akalin): Plumb this through to |connection_|. | 108 // TODO(akalin): Plumb this through to |connection_|. |
| 115 } | 109 } |
| 116 | 110 |
| 117 } // namespace net | 111 } // namespace net |
| OLD | NEW |