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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
17 #include "base/profiler/scoped_tracker.h" | 17 #include "base/profiler/scoped_tracker.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/thread_task_runner_handle.h" | 23 #include "base/thread_task_runner_handle.h" |
| 24 #include "base/trace_event/trace_event.h" |
24 #include "base/values.h" | 25 #include "base/values.h" |
25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
26 #include "net/base/connection_type_histograms.h" | 27 #include "net/base/connection_type_histograms.h" |
27 #include "net/base/port_util.h" | 28 #include "net/base/port_util.h" |
28 #include "net/cert/cert_verifier.h" | 29 #include "net/cert/cert_verifier.h" |
29 #include "net/http/http_basic_stream.h" | 30 #include "net/http/http_basic_stream.h" |
30 #include "net/http/http_network_session.h" | 31 #include "net/http/http_network_session.h" |
31 #include "net/http/http_proxy_client_socket.h" | 32 #include "net/http/http_proxy_client_socket.h" |
32 #include "net/http/http_proxy_client_socket_pool.h" | 33 #include "net/http/http_proxy_client_socket_pool.h" |
33 #include "net/http/http_request_info.h" | 34 #include "net/http/http_request_info.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 SSLFailureState ssl_failure_state = | 534 SSLFailureState ssl_failure_state = |
534 connection_ ? connection_->ssl_failure_state() : SSL_FAILURE_NONE; | 535 connection_ ? connection_->ssl_failure_state() : SSL_FAILURE_NONE; |
535 request_->OnStreamFailed(this, result, server_ssl_config_, | 536 request_->OnStreamFailed(this, result, server_ssl_config_, |
536 ssl_failure_state); | 537 ssl_failure_state); |
537 } | 538 } |
538 // |this| may be deleted after this call. | 539 // |this| may be deleted after this call. |
539 } | 540 } |
540 | 541 |
541 void HttpStreamFactoryImpl::Job::OnCertificateErrorCallback( | 542 void HttpStreamFactoryImpl::Job::OnCertificateErrorCallback( |
542 int result, const SSLInfo& ssl_info) { | 543 int result, const SSLInfo& ssl_info) { |
| 544 TRACE_EVENT0("net", "net::HttpStreamFactoryImpl::Job::OnCertificateErrorCallba
ck"); |
543 DCHECK(!IsPreconnecting()); | 545 DCHECK(!IsPreconnecting()); |
544 | 546 |
545 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 547 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
546 | 548 |
547 if (IsOrphaned()) | 549 if (IsOrphaned()) |
548 stream_factory_->OnOrphanedJobComplete(this); | 550 stream_factory_->OnOrphanedJobComplete(this); |
549 else | 551 else |
550 request_->OnCertificateError(this, result, server_ssl_config_, ssl_info); | 552 request_->OnCertificateError(this, result, server_ssl_config_, ssl_info); |
551 // |this| may be deleted after this call. | 553 // |this| may be deleted after this call. |
552 } | 554 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 return | 615 return |
614 spdy_session_pool->FindAvailableSession(spdy_session_key, net_log) ? | 616 spdy_session_pool->FindAvailableSession(spdy_session_key, net_log) ? |
615 ERR_SPDY_SESSION_ALREADY_EXISTS : OK; | 617 ERR_SPDY_SESSION_ALREADY_EXISTS : OK; |
616 } | 618 } |
617 | 619 |
618 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { | 620 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { |
619 RunLoop(result); | 621 RunLoop(result); |
620 } | 622 } |
621 | 623 |
622 int HttpStreamFactoryImpl::Job::RunLoop(int result) { | 624 int HttpStreamFactoryImpl::Job::RunLoop(int result) { |
| 625 TRACE_EVENT0("net", "net::HttpStreamFactoryImpl::Job::RunLoop"); |
623 result = DoLoop(result); | 626 result = DoLoop(result); |
624 | 627 |
625 if (result == ERR_IO_PENDING) | 628 if (result == ERR_IO_PENDING) |
626 return result; | 629 return result; |
627 | 630 |
628 // If there was an error, we should have already resumed the |waiting_job_|, | 631 // If there was an error, we should have already resumed the |waiting_job_|, |
629 // if there was one. | 632 // if there was one. |
630 DCHECK(result == OK || waiting_job_ == NULL); | 633 DCHECK(result == OK || waiting_job_ == NULL); |
631 | 634 |
632 if (IsPreconnecting()) { | 635 if (IsPreconnecting()) { |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 if (connection_->socket()) { | 1806 if (connection_->socket()) { |
1804 ConnectionAttempts socket_attempts; | 1807 ConnectionAttempts socket_attempts; |
1805 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1808 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1806 request_->AddConnectionAttempts(socket_attempts); | 1809 request_->AddConnectionAttempts(socket_attempts); |
1807 } else { | 1810 } else { |
1808 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1811 request_->AddConnectionAttempts(connection_->connection_attempts()); |
1809 } | 1812 } |
1810 } | 1813 } |
1811 | 1814 |
1812 } // namespace net | 1815 } // namespace net |
OLD | NEW |