Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Side by Side Diff: net/http/http_basic_stream.cc

Issue 2619583002: Clean up HttpStreamFactoryImpl::JobController when Impl::Jobs complete (Closed)
Patch Set: address wez@ comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl_job_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "net/http/http_request_info.h" 9 #include "net/http/http_request_info.h"
10 #include "net/http/http_response_body_drainer.h" 10 #include "net/http/http_response_body_drainer.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return parser()->ReadResponseHeaders(callback); 42 return parser()->ReadResponseHeaders(callback);
43 } 43 }
44 44
45 int HttpBasicStream::ReadResponseBody(IOBuffer* buf, 45 int HttpBasicStream::ReadResponseBody(IOBuffer* buf,
46 int buf_len, 46 int buf_len,
47 const CompletionCallback& callback) { 47 const CompletionCallback& callback) {
48 return parser()->ReadResponseBody(buf, buf_len, callback); 48 return parser()->ReadResponseBody(buf, buf_len, callback);
49 } 49 }
50 50
51 void HttpBasicStream::Close(bool not_reusable) { 51 void HttpBasicStream::Close(bool not_reusable) {
52 parser()->Close(not_reusable); 52 // parser() is null if |this| is created by an orphaned
53 // HttpStreamFactoryImpl::Job in which case InitializeStream() will not have
54 // been called.
55 if (parser())
56 parser()->Close(not_reusable);
53 } 57 }
54 58
55 HttpStream* HttpBasicStream::RenewStreamForAuth() { 59 HttpStream* HttpBasicStream::RenewStreamForAuth() {
56 DCHECK(IsResponseBodyComplete()); 60 DCHECK(IsResponseBodyComplete());
57 DCHECK(!parser()->IsMoreDataBuffered()); 61 DCHECK(!parser()->IsMoreDataBuffered());
58 // The HttpStreamParser object still has a pointer to the connection. Just to 62 // The HttpStreamParser object still has a pointer to the connection. Just to
59 // be extra-sure it doesn't touch the connection again, delete it here rather 63 // be extra-sure it doesn't touch the connection again, delete it here rather
60 // than leaving it until the destructor is called. 64 // than leaving it until the destructor is called.
61 state_.DeleteParser(); 65 state_.DeleteParser();
62 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy(), 66 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy(),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // like the right version should be reported, if headers were received. 132 // like the right version should be reported, if headers were received.
129 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1; 133 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1;
130 return; 134 return;
131 } 135 }
132 136
133 void HttpBasicStream::SetPriority(RequestPriority priority) { 137 void HttpBasicStream::SetPriority(RequestPriority priority) {
134 // TODO(akalin): Plumb this through to |connection_|. 138 // TODO(akalin): Plumb this through to |connection_|.
135 } 139 }
136 140
137 } // namespace net 141 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl_job_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698