| 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_stream_factory_impl_request.h" | 5 #include "net/http/http_stream_factory_impl_request.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/http/http_stream_factory_impl_job.h" | 10 #include "net/http/http_stream_factory_impl_job.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 DCHECK(completed_); | 109 DCHECK(completed_); |
| 110 | 110 |
| 111 OnJobSucceeded(job); | 111 OnJobSucceeded(job); |
| 112 delegate_->OnWebSocketHandshakeStreamReady( | 112 delegate_->OnWebSocketHandshakeStreamReady( |
| 113 used_ssl_config, used_proxy_info, stream); | 113 used_ssl_config, used_proxy_info, stream); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void HttpStreamFactoryImpl::Request::OnStreamFailed( | 116 void HttpStreamFactoryImpl::Request::OnStreamFailed( |
| 117 Job* job, | 117 Job* job, |
| 118 int status, | 118 int status, |
| 119 const SSLConfig& used_ssl_config) { | 119 const SSLConfig& used_ssl_config, |
| 120 SSLFailureState ssl_failure_state) { |
| 120 DCHECK_NE(OK, status); | 121 DCHECK_NE(OK, status); |
| 121 DCHECK(job); | 122 DCHECK(job); |
| 122 if (!bound_job_.get()) { | 123 if (!bound_job_.get()) { |
| 123 // Hey, we've got other jobs! Maybe one of them will succeed, let's just | 124 // Hey, we've got other jobs! Maybe one of them will succeed, let's just |
| 124 // ignore this failure. | 125 // ignore this failure. |
| 125 if (jobs_.size() > 1) { | 126 if (jobs_.size() > 1) { |
| 126 jobs_.erase(job); | 127 jobs_.erase(job); |
| 127 factory_->request_map_.erase(job); | 128 factory_->request_map_.erase(job); |
| 128 // Notify all the other jobs that this one failed. | 129 // Notify all the other jobs that this one failed. |
| 129 for (std::set<Job*>::iterator it = jobs_.begin(); it != jobs_.end(); ++it) | 130 for (std::set<Job*>::iterator it = jobs_.begin(); it != jobs_.end(); ++it) |
| 130 (*it)->MarkOtherJobComplete(*job); | 131 (*it)->MarkOtherJobComplete(*job); |
| 131 delete job; | 132 delete job; |
| 132 return; | 133 return; |
| 133 } else { | 134 } else { |
| 134 bound_job_.reset(job); | 135 bound_job_.reset(job); |
| 135 jobs_.erase(job); | 136 jobs_.erase(job); |
| 136 DCHECK(jobs_.empty()); | 137 DCHECK(jobs_.empty()); |
| 137 factory_->request_map_.erase(job); | 138 factory_->request_map_.erase(job); |
| 138 } | 139 } |
| 139 } else { | 140 } else { |
| 140 DCHECK(jobs_.empty()); | 141 DCHECK(jobs_.empty()); |
| 141 } | 142 } |
| 142 delegate_->OnStreamFailed(status, used_ssl_config); | 143 delegate_->OnStreamFailed(status, used_ssl_config, ssl_failure_state); |
| 143 } | 144 } |
| 144 | 145 |
| 145 void HttpStreamFactoryImpl::Request::OnCertificateError( | 146 void HttpStreamFactoryImpl::Request::OnCertificateError( |
| 146 Job* job, | 147 Job* job, |
| 147 int status, | 148 int status, |
| 148 const SSLConfig& used_ssl_config, | 149 const SSLConfig& used_ssl_config, |
| 149 const SSLInfo& ssl_info) { | 150 const SSLInfo& ssl_info) { |
| 150 DCHECK_NE(OK, status); | 151 DCHECK_NE(OK, status); |
| 151 if (!bound_job_.get()) | 152 if (!bound_job_.get()) |
| 152 OrphanJobsExcept(job); | 153 OrphanJobsExcept(job); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 375 } |
| 375 // We may have other jobs in |jobs_|. For example, if we start multiple jobs | 376 // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
| 376 // for Alternate-Protocol. | 377 // for Alternate-Protocol. |
| 377 OrphanJobsExcept(job); | 378 OrphanJobsExcept(job); |
| 378 return; | 379 return; |
| 379 } | 380 } |
| 380 DCHECK(jobs_.empty()); | 381 DCHECK(jobs_.empty()); |
| 381 } | 382 } |
| 382 | 383 |
| 383 } // namespace net | 384 } // namespace net |
| OLD | NEW |