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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // working. | 336 // working. |
337 return origin_url_.SchemeIs("https") || | 337 return origin_url_.SchemeIs("https") || |
338 proxy_info_.proxy_server().is_https() || IsSpdyAlternative(); | 338 proxy_info_.proxy_server().is_https() || IsSpdyAlternative(); |
339 } | 339 } |
340 | 340 |
341 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { | 341 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { |
342 DCHECK(stream_.get()); | 342 DCHECK(stream_.get()); |
343 DCHECK(!IsPreconnecting()); | 343 DCHECK(!IsPreconnecting()); |
344 DCHECK(!stream_factory_->for_websockets_); | 344 DCHECK(!stream_factory_->for_websockets_); |
345 | 345 |
| 346 UMA_HISTOGRAM_TIMES("Net.HttpStreamFactoryJob.StreamReadyCallbackTime", |
| 347 base::TimeTicks::Now() - job_stream_ready_start_time_); |
| 348 |
346 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 349 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
347 | 350 |
348 if (IsOrphaned()) { | 351 if (IsOrphaned()) { |
349 stream_factory_->OnOrphanedJobComplete(this); | 352 stream_factory_->OnOrphanedJobComplete(this); |
350 } else { | 353 } else { |
351 request_->Complete(was_npn_negotiated(), protocol_negotiated(), | 354 request_->Complete(was_npn_negotiated(), protocol_negotiated(), |
352 using_spdy()); | 355 using_spdy()); |
353 request_->OnStreamReady(this, server_ssl_config_, proxy_info_, | 356 request_->OnStreamReady(this, server_ssl_config_, proxy_info_, |
354 stream_.release()); | 357 stream_.release()); |
355 } | 358 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } else { | 634 } else { |
632 base::ThreadTaskRunnerHandle::Get()->PostTask( | 635 base::ThreadTaskRunnerHandle::Get()->PostTask( |
633 FROM_HERE, base::Bind(&Job::OnBidirectionalStreamJobReadyCallback, | 636 FROM_HERE, base::Bind(&Job::OnBidirectionalStreamJobReadyCallback, |
634 ptr_factory_.GetWeakPtr())); | 637 ptr_factory_.GetWeakPtr())); |
635 } | 638 } |
636 #else | 639 #else |
637 DCHECK(false); | 640 DCHECK(false); |
638 #endif | 641 #endif |
639 } else { | 642 } else { |
640 DCHECK(stream_.get()); | 643 DCHECK(stream_.get()); |
| 644 job_stream_ready_start_time_ = base::TimeTicks::Now(); |
641 base::ThreadTaskRunnerHandle::Get()->PostTask( | 645 base::ThreadTaskRunnerHandle::Get()->PostTask( |
642 FROM_HERE, | 646 FROM_HERE, |
643 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); | 647 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); |
644 } | 648 } |
645 return ERR_IO_PENDING; | 649 return ERR_IO_PENDING; |
646 | 650 |
647 default: | 651 default: |
648 DCHECK(result != ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN || | 652 DCHECK(result != ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN || |
649 IsSpdyAlternative() || IsQuicAlternative()); | 653 IsSpdyAlternative() || IsQuicAlternative()); |
650 if (job_status_ != STATUS_BROKEN) { | 654 if (job_status_ != STATUS_BROKEN) { |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 if (connection_->socket()) { | 1694 if (connection_->socket()) { |
1691 ConnectionAttempts socket_attempts; | 1695 ConnectionAttempts socket_attempts; |
1692 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1696 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1693 request_->AddConnectionAttempts(socket_attempts); | 1697 request_->AddConnectionAttempts(socket_attempts); |
1694 } else { | 1698 } else { |
1695 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1699 request_->AddConnectionAttempts(connection_->connection_attempts()); |
1696 } | 1700 } |
1697 } | 1701 } |
1698 | 1702 |
1699 } // namespace net | 1703 } // namespace net |
OLD | NEW |