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

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

Issue 2619583002: Clean up HttpStreamFactoryImpl::JobController when Impl::Jobs complete (Closed)
Patch Set: 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_stream_factory_impl_job_controller.h" 5 #include "net/http/http_stream_factory_impl_job_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Just pick the first one. 136 // Just pick the first one.
137 return main_job_ ? main_job_->GetLoadState() 137 return main_job_ ? main_job_->GetLoadState()
138 : alternative_job_->GetLoadState(); 138 : alternative_job_->GetLoadState();
139 } 139 }
140 140
141 void HttpStreamFactoryImpl::JobController::OnRequestComplete() { 141 void HttpStreamFactoryImpl::JobController::OnRequestComplete() {
142 CancelJobs(); 142 CancelJobs();
143 DCHECK(request_); 143 DCHECK(request_);
144 request_ = nullptr; 144 request_ = nullptr;
145 if (bound_job_) { 145 if (bound_job_) {
146 if (bound_job_->job_type() == MAIN) { 146 DCHECK(bound_job_->job_type() == MAIN ||
147 main_job_.reset(); 147 bound_job_->job_type() == ALTERNATIVE);
148 } else { 148 alternative_job_.reset();
149 DCHECK(bound_job_->job_type() == ALTERNATIVE); 149 main_job_.reset();
Wez 2017/01/06 18:21:44 So IIUC the issue was that MaybeNotifyFactoryOfCom
Ryan Sleevi 2017/01/06 20:24:13 A big +1 to that. A longer CL description that cov
150 alternative_job_.reset();
151 }
152 bound_job_ = nullptr; 150 bound_job_ = nullptr;
153 } 151 }
154 MaybeNotifyFactoryOfCompletion(); 152 MaybeNotifyFactoryOfCompletion();
155 } 153 }
156 154
157 int HttpStreamFactoryImpl::JobController::RestartTunnelWithProxyAuth( 155 int HttpStreamFactoryImpl::JobController::RestartTunnelWithProxyAuth(
158 const AuthCredentials& credentials) { 156 const AuthCredentials& credentials) {
159 DCHECK(bound_job_); 157 DCHECK(bound_job_);
160 return bound_job_->RestartTunnelWithProxyAuth(credentials); 158 return bound_job_->RestartTunnelWithProxyAuth(credentials);
161 } 159 }
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } 1077 }
1080 1078
1081 void HttpStreamFactoryImpl::JobController::StartAlternativeProxyServerJob() { 1079 void HttpStreamFactoryImpl::JobController::StartAlternativeProxyServerJob() {
1082 if (!alternative_job_ || !request_) 1080 if (!alternative_job_ || !request_)
1083 return; 1081 return;
1084 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); 1082 DCHECK(alternative_job_->alternative_proxy_server().is_valid());
1085 alternative_job_->Start(request_->stream_type()); 1083 alternative_job_->Start(request_->stream_type());
1086 } 1084 }
1087 1085
1088 } // namespace net 1086 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698