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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 stream_ = quic_request_.ReleaseStream(); | 1006 stream_ = quic_request_.ReleaseStream(); |
1007 next_state_ = STATE_NONE; | 1007 next_state_ = STATE_NONE; |
1008 return OK; | 1008 return OK; |
1009 } | 1009 } |
1010 | 1010 |
1011 if (result < 0 && !ssl_started) | 1011 if (result < 0 && !ssl_started) |
1012 return ReconsiderProxyAfterError(result); | 1012 return ReconsiderProxyAfterError(result); |
1013 establishing_tunnel_ = false; | 1013 establishing_tunnel_ = false; |
1014 | 1014 |
1015 if (connection_->socket()) { | 1015 if (connection_->socket()) { |
1016 LogHttpConnectedMetrics(*connection_); | |
1017 | |
1018 // We officially have a new connection. Record the type. | 1016 // We officially have a new connection. Record the type. |
1019 if (!connection_->is_reused()) { | 1017 if (!connection_->is_reused()) { |
1020 ConnectionType type = using_spdy_ ? CONNECTION_SPDY : CONNECTION_HTTP; | 1018 ConnectionType type = using_spdy_ ? CONNECTION_SPDY : CONNECTION_HTTP; |
1021 UpdateConnectionTypeHistograms(type); | 1019 UpdateConnectionTypeHistograms(type); |
1022 } | 1020 } |
1023 } | 1021 } |
1024 | 1022 |
1025 // Handle SSL errors below. | 1023 // Handle SSL errors below. |
1026 if (using_ssl_) { | 1024 if (using_ssl_) { |
1027 DCHECK(ssl_started); | 1025 DCHECK(ssl_started); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 if (ssl_socket->IgnoreCertError(error, load_flags)) | 1411 if (ssl_socket->IgnoreCertError(error, load_flags)) |
1414 return OK; | 1412 return OK; |
1415 return error; | 1413 return error; |
1416 } | 1414 } |
1417 | 1415 |
1418 void HttpStreamFactoryImpl::Job::SwitchToSpdyMode() { | 1416 void HttpStreamFactoryImpl::Job::SwitchToSpdyMode() { |
1419 if (HttpStreamFactory::spdy_enabled()) | 1417 if (HttpStreamFactory::spdy_enabled()) |
1420 using_spdy_ = true; | 1418 using_spdy_ = true; |
1421 } | 1419 } |
1422 | 1420 |
1423 // static | |
1424 void HttpStreamFactoryImpl::Job::LogHttpConnectedMetrics( | |
1425 const ClientSocketHandle& handle) { | |
1426 UMA_HISTOGRAM_ENUMERATION("Net.HttpSocketType", handle.reuse_type(), | |
1427 ClientSocketHandle::NUM_TYPES); | |
1428 | |
1429 switch (handle.reuse_type()) { | |
1430 case ClientSocketHandle::UNUSED: | |
1431 UMA_HISTOGRAM_CUSTOM_TIMES("Net.HttpConnectionLatency", | |
1432 handle.setup_time(), | |
1433 base::TimeDelta::FromMilliseconds(1), | |
1434 base::TimeDelta::FromMinutes(10), | |
1435 100); | |
1436 break; | |
1437 case ClientSocketHandle::UNUSED_IDLE: | |
1438 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SocketIdleTimeBeforeNextUse_UnusedSocket", | |
1439 handle.idle_time(), | |
1440 base::TimeDelta::FromMilliseconds(1), | |
1441 base::TimeDelta::FromMinutes(6), | |
1442 100); | |
1443 break; | |
1444 case ClientSocketHandle::REUSED_IDLE: | |
1445 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SocketIdleTimeBeforeNextUse_ReusedSocket", | |
1446 handle.idle_time(), | |
1447 base::TimeDelta::FromMilliseconds(1), | |
1448 base::TimeDelta::FromMinutes(6), | |
1449 100); | |
1450 break; | |
1451 default: | |
1452 NOTREACHED(); | |
1453 break; | |
1454 } | |
1455 } | |
1456 | |
1457 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { | 1421 bool HttpStreamFactoryImpl::Job::IsPreconnecting() const { |
1458 DCHECK_GE(num_streams_, 0); | 1422 DCHECK_GE(num_streams_, 0); |
1459 return num_streams_ > 0; | 1423 return num_streams_ > 0; |
1460 } | 1424 } |
1461 | 1425 |
1462 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { | 1426 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { |
1463 return !IsPreconnecting() && !request_; | 1427 return !IsPreconnecting() && !request_; |
1464 } | 1428 } |
1465 | 1429 |
1466 void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() { | 1430 void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 | 1466 |
1503 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1467 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1504 HistogramBrokenAlternateProtocolLocation( | 1468 HistogramBrokenAlternateProtocolLocation( |
1505 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1469 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1506 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1470 session_->http_server_properties()->SetBrokenAlternateProtocol( |
1507 HostPortPair::FromURL(request_info_.url)); | 1471 HostPortPair::FromURL(request_info_.url)); |
1508 } | 1472 } |
1509 } | 1473 } |
1510 | 1474 |
1511 } // namespace net | 1475 } // namespace net |
OLD | NEW |