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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { | 1449 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { |
1450 DCHECK_GE(num_streams_, 0); | 1450 DCHECK_GE(num_streams_, 0); |
1451 return num_streams_ > 0; | 1451 return num_streams_ > 0; |
1452 } | 1452 } |
1453 | 1453 |
1454 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { | 1454 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { |
1455 return !IsPreconnecting() && !request_; | 1455 return !IsPreconnecting() && !request_; |
1456 } | 1456 } |
1457 | 1457 |
1458 void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() { | 1458 void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() { |
| 1459 net::AlternateProtocolExperiment alternate_protocol_experiment = |
| 1460 ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT; |
| 1461 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 1462 session_->http_server_properties(); |
| 1463 if (http_server_properties) { |
| 1464 alternate_protocol_experiment = |
| 1465 http_server_properties->GetAlternateProtocolExperiment(); |
| 1466 } |
1459 if (using_existing_quic_session_) { | 1467 if (using_existing_quic_session_) { |
1460 // If an existing session was used, then no TCP connection was | 1468 // If an existing session was used, then no TCP connection was |
1461 // started. | 1469 // started. |
1462 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_NO_RACE); | 1470 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_NO_RACE, |
| 1471 alternate_protocol_experiment); |
1463 } else if (original_url_) { | 1472 } else if (original_url_) { |
1464 // This job was the alternate protocol job, and hence won the race. | 1473 // This job was the alternate protocol job, and hence won the race. |
1465 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_WON_RACE); | 1474 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_WON_RACE, |
| 1475 alternate_protocol_experiment); |
1466 } else { | 1476 } else { |
1467 // This job was the normal job, and hence the alternate protocol job lost | 1477 // This job was the normal job, and hence the alternate protocol job lost |
1468 // the race. | 1478 // the race. |
1469 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_LOST_RACE); | 1479 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_LOST_RACE, |
| 1480 alternate_protocol_experiment); |
1470 } | 1481 } |
1471 } | 1482 } |
1472 | 1483 |
1473 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() { | 1484 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() { |
1474 if (IsPreconnecting() || !request_) { | 1485 if (IsPreconnecting() || !request_) { |
1475 return false; | 1486 return false; |
1476 } | 1487 } |
1477 if (stream_factory_->for_websockets_) { | 1488 if (stream_factory_->for_websockets_) { |
1478 return false; | 1489 return false; |
1479 } | 1490 } |
(...skipping 13 matching lines...) Expand all Loading... |
1493 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | 1504 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
1494 net::LOAD_IS_DOWNLOAD)) { | 1505 net::LOAD_IS_DOWNLOAD)) { |
1495 // Avoid pipelining resources that may be streamed for a long time. | 1506 // Avoid pipelining resources that may be streamed for a long time. |
1496 return false; | 1507 return false; |
1497 } | 1508 } |
1498 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1509 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
1499 *http_pipelining_key_.get()); | 1510 *http_pipelining_key_.get()); |
1500 } | 1511 } |
1501 | 1512 |
1502 } // namespace net | 1513 } // namespace net |
OLD | NEW |