Chromium Code Reviews| 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_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 default: | 164 default: |
| 165 return LOAD_STATE_IDLE; | 165 return LOAD_STATE_IDLE; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 void HttpStreamFactoryImpl::Job::MarkAsAlternate( | 169 void HttpStreamFactoryImpl::Job::MarkAsAlternate( |
| 170 const GURL& original_url, | 170 const GURL& original_url, |
| 171 AlternateProtocolInfo alternate) { | 171 AlternateProtocolInfo alternate) { |
| 172 DCHECK(!original_url_.get()); | 172 DCHECK(!original_url_.get()); |
| 173 original_url_.reset(new GURL(original_url)); | 173 original_url_.reset(new GURL(original_url)); |
| 174 alternate_protocol_ = alternate; | |
| 174 if (alternate.protocol == QUIC) { | 175 if (alternate.protocol == QUIC) { |
| 175 DCHECK(session_->params().enable_quic); | 176 DCHECK(session_->params().enable_quic); |
| 176 using_quic_ = true; | 177 using_quic_ = true; |
|
Ryan Hamilton
2014/11/03 19:00:31
If alternate_protocol_ now contains the alternate
Bence
2014/11/03 22:32:26
I feel like we still need |using_quic_|, otherwise
Ryan Hamilton
2014/11/04 18:56:22
Makes sense.
| |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 180 void HttpStreamFactoryImpl::Job::WaitFor(Job* job) { | 181 void HttpStreamFactoryImpl::Job::WaitFor(Job* job) { |
| 181 DCHECK_EQ(STATE_NONE, next_state_); | 182 DCHECK_EQ(STATE_NONE, next_state_); |
| 182 DCHECK_EQ(STATE_NONE, job->next_state_); | 183 DCHECK_EQ(STATE_NONE, job->next_state_); |
| 183 DCHECK(!blocking_job_); | 184 DCHECK(!blocking_job_); |
| 184 DCHECK(!job->waiting_job_); | 185 DCHECK(!job->waiting_job_); |
| 185 blocking_job_ = job; | 186 blocking_job_ = job; |
| 186 job->waiting_job_ = this; | 187 job->waiting_job_ = this; |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1453 void HttpStreamFactoryImpl::Job::MaybeMarkAlternateProtocolBroken() { | 1454 void HttpStreamFactoryImpl::Job::MaybeMarkAlternateProtocolBroken() { |
| 1454 if (job_status_ == STATUS_RUNNING || other_job_status_ == STATUS_RUNNING) | 1455 if (job_status_ == STATUS_RUNNING || other_job_status_ == STATUS_RUNNING) |
| 1455 return; | 1456 return; |
| 1456 | 1457 |
| 1457 bool is_alternate_protocol_job = original_url_.get() != NULL; | 1458 bool is_alternate_protocol_job = original_url_.get() != NULL; |
| 1458 if (is_alternate_protocol_job) { | 1459 if (is_alternate_protocol_job) { |
| 1459 if (job_status_ == STATUS_BROKEN && other_job_status_ == STATUS_SUCCEEDED) { | 1460 if (job_status_ == STATUS_BROKEN && other_job_status_ == STATUS_SUCCEEDED) { |
| 1460 HistogramBrokenAlternateProtocolLocation( | 1461 HistogramBrokenAlternateProtocolLocation( |
| 1461 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); | 1462 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); |
| 1462 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1463 session_->http_server_properties()->SetBrokenAlternateProtocol( |
| 1463 HostPortPair::FromURL(*original_url_)); | 1464 HostPortPair::FromURL(*original_url_), alternate_protocol_); |
| 1464 } | 1465 } |
| 1465 return; | 1466 return; |
| 1466 } | 1467 } |
| 1467 | 1468 |
| 1468 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1469 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
| 1469 HistogramBrokenAlternateProtocolLocation( | 1470 HistogramBrokenAlternateProtocolLocation( |
| 1470 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1471 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
| 1471 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1472 session_->http_server_properties()->SetBrokenAlternateProtocol( |
| 1472 HostPortPair::FromURL(request_info_.url)); | 1473 HostPortPair::FromURL(request_info_.url), alternate_protocol_); |
| 1473 } | 1474 } |
| 1474 } | 1475 } |
| 1475 | 1476 |
| 1476 } // namespace net | 1477 } // namespace net |
| OLD | NEW |