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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // working. | 355 // working. |
356 return origin_url_.SchemeIs("https") || | 356 return origin_url_.SchemeIs("https") || |
357 proxy_info_.proxy_server().is_https() || IsSpdyAlternative(); | 357 proxy_info_.proxy_server().is_https() || IsSpdyAlternative(); |
358 } | 358 } |
359 | 359 |
360 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { | 360 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { |
361 DCHECK(stream_.get()); | 361 DCHECK(stream_.get()); |
362 DCHECK_NE(job_type_, PRECONNECT); | 362 DCHECK_NE(job_type_, PRECONNECT); |
363 DCHECK(!delegate_->for_websockets()); | 363 DCHECK(!delegate_->for_websockets()); |
364 | 364 |
365 UMA_HISTOGRAM_TIMES("Net.HttpStreamFactoryJob.StreamReadyCallbackTime", | |
366 base::TimeTicks::Now() - job_stream_ready_start_time_); | |
367 | |
368 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 365 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
369 | 366 |
370 delegate_->OnStreamReady(this, server_ssl_config_, proxy_info_); | 367 delegate_->OnStreamReady(this, server_ssl_config_, proxy_info_); |
371 // |this| may be deleted after this call. | 368 // |this| may be deleted after this call. |
372 } | 369 } |
373 | 370 |
374 void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() { | 371 void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() { |
375 DCHECK(websocket_stream_); | 372 DCHECK(websocket_stream_); |
376 DCHECK_NE(job_type_, PRECONNECT); | 373 DCHECK_NE(job_type_, PRECONNECT); |
377 DCHECK(delegate_->for_websockets()); | 374 DCHECK(delegate_->for_websockets()); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 FROM_HERE, base::Bind(&Job::OnStreamFailedCallback, | 575 FROM_HERE, base::Bind(&Job::OnStreamFailedCallback, |
579 ptr_factory_.GetWeakPtr(), ERR_FAILED)); | 576 ptr_factory_.GetWeakPtr(), ERR_FAILED)); |
580 } else { | 577 } else { |
581 base::ThreadTaskRunnerHandle::Get()->PostTask( | 578 base::ThreadTaskRunnerHandle::Get()->PostTask( |
582 FROM_HERE, | 579 FROM_HERE, |
583 base::Bind(&Job::OnBidirectionalStreamImplReadyCallback, | 580 base::Bind(&Job::OnBidirectionalStreamImplReadyCallback, |
584 ptr_factory_.GetWeakPtr())); | 581 ptr_factory_.GetWeakPtr())); |
585 } | 582 } |
586 } else { | 583 } else { |
587 DCHECK(stream_.get()); | 584 DCHECK(stream_.get()); |
588 job_stream_ready_start_time_ = base::TimeTicks::Now(); | |
589 base::ThreadTaskRunnerHandle::Get()->PostTask( | 585 base::ThreadTaskRunnerHandle::Get()->PostTask( |
590 FROM_HERE, | 586 FROM_HERE, |
591 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); | 587 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); |
592 } | 588 } |
593 return ERR_IO_PENDING; | 589 return ERR_IO_PENDING; |
594 | 590 |
595 default: | 591 default: |
596 if (job_status_ != STATUS_BROKEN) { | 592 if (job_status_ != STATUS_BROKEN) { |
597 DCHECK_EQ(STATUS_RUNNING, job_status_); | 593 DCHECK_EQ(STATUS_RUNNING, job_status_); |
598 job_status_ = STATUS_FAILED; | 594 job_status_ = STATUS_FAILED; |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 | 1550 |
1555 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1551 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1556 if (connection_->socket()) { | 1552 if (connection_->socket()) { |
1557 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1553 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1558 } | 1554 } |
1559 | 1555 |
1560 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1556 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1561 } | 1557 } |
1562 | 1558 |
1563 } // namespace net | 1559 } // namespace net |
OLD | NEW |