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 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { | 1423 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { |
1424 DCHECK_GE(num_streams_, 0); | 1424 DCHECK_GE(num_streams_, 0); |
1425 return num_streams_ > 0; | 1425 return num_streams_ > 0; |
1426 } | 1426 } |
1427 | 1427 |
1428 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { | 1428 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { |
1429 return !IsPreconnecting() && !request_; | 1429 return !IsPreconnecting() && !request_; |
1430 } | 1430 } |
1431 | 1431 |
1432 void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() { | 1432 void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() { |
1433 net::AlternateProtocolExperiment alternate_protocol_experiment = | |
1434 ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT; | |
1435 base::WeakPtr<HttpServerProperties> http_server_properties = | |
1436 session_->http_server_properties(); | |
1437 if (http_server_properties) { | |
1438 alternate_protocol_experiment = | |
1439 http_server_properties->GetAlternateProtocolExperiment(); | |
1440 } | |
1441 if (using_existing_quic_session_) { | 1433 if (using_existing_quic_session_) { |
1442 // If an existing session was used, then no TCP connection was | 1434 // If an existing session was used, then no TCP connection was |
1443 // started. | 1435 // started. |
1444 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_NO_RACE, | 1436 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_NO_RACE); |
1445 alternate_protocol_experiment); | |
1446 } else if (original_url_) { | 1437 } else if (original_url_) { |
1447 // This job was the alternate protocol job, and hence won the race. | 1438 // This job was the alternate protocol job, and hence won the race. |
1448 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_WON_RACE, | 1439 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_WON_RACE); |
1449 alternate_protocol_experiment); | |
1450 } else { | 1440 } else { |
1451 // This job was the normal job, and hence the alternate protocol job lost | 1441 // This job was the normal job, and hence the alternate protocol job lost |
1452 // the race. | 1442 // the race. |
1453 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_LOST_RACE, | 1443 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_LOST_RACE); |
1454 alternate_protocol_experiment); | |
1455 } | 1444 } |
1456 } | 1445 } |
1457 | 1446 |
1458 void HttpStreamFactoryImpl::Job::MarkOtherJobComplete(const Job& job) { | 1447 void HttpStreamFactoryImpl::Job::MarkOtherJobComplete(const Job& job) { |
1459 DCHECK_EQ(STATUS_RUNNING, other_job_status_); | 1448 DCHECK_EQ(STATUS_RUNNING, other_job_status_); |
1460 other_job_status_ = job.job_status_; | 1449 other_job_status_ = job.job_status_; |
1461 MaybeMarkAlternateProtocolBroken(); | 1450 MaybeMarkAlternateProtocolBroken(); |
1462 } | 1451 } |
1463 | 1452 |
1464 void HttpStreamFactoryImpl::Job::MaybeMarkAlternateProtocolBroken() { | 1453 void HttpStreamFactoryImpl::Job::MaybeMarkAlternateProtocolBroken() { |
(...skipping 13 matching lines...) Expand all Loading... |
1478 | 1467 |
1479 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1468 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1480 HistogramBrokenAlternateProtocolLocation( | 1469 HistogramBrokenAlternateProtocolLocation( |
1481 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1470 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1482 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1471 session_->http_server_properties()->SetBrokenAlternateProtocol( |
1483 HostPortPair::FromURL(request_info_.url)); | 1472 HostPortPair::FromURL(request_info_.url)); |
1484 } | 1473 } |
1485 } | 1474 } |
1486 | 1475 |
1487 } // namespace net | 1476 } // namespace net |
OLD | NEW |