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/bidirectional_stream_impl.h" | 30 #include "net/http/bidirectional_stream_impl.h" |
30 #include "net/http/http_basic_stream.h" | 31 #include "net/http/http_basic_stream.h" |
31 #include "net/http/http_network_session.h" | 32 #include "net/http/http_network_session.h" |
32 #include "net/http/http_proxy_client_socket.h" | 33 #include "net/http/http_proxy_client_socket.h" |
33 #include "net/http/http_proxy_client_socket_pool.h" | 34 #include "net/http/http_proxy_client_socket_pool.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 SSLFailureState ssl_failure_state = | 518 SSLFailureState ssl_failure_state = |
518 connection_ ? connection_->ssl_failure_state() : SSL_FAILURE_NONE; | 519 connection_ ? connection_->ssl_failure_state() : SSL_FAILURE_NONE; |
519 request_->OnStreamFailed(this, result, server_ssl_config_, | 520 request_->OnStreamFailed(this, result, server_ssl_config_, |
520 ssl_failure_state); | 521 ssl_failure_state); |
521 } | 522 } |
522 // |this| may be deleted after this call. | 523 // |this| may be deleted after this call. |
523 } | 524 } |
524 | 525 |
525 void HttpStreamFactoryImpl::Job::OnCertificateErrorCallback( | 526 void HttpStreamFactoryImpl::Job::OnCertificateErrorCallback( |
526 int result, const SSLInfo& ssl_info) { | 527 int result, const SSLInfo& ssl_info) { |
528 TRACE_EVENT0("net", "HttpStreamFactoryImpl::Job::OnCertificateErrorCallback"); | |
mmenke
2016/03/28 20:46:51
How are you planning on using these? Seems like b
ssid
2016/03/29 00:33:06
I agree, in general the answer to your question is
| |
527 DCHECK(!IsPreconnecting()); | 529 DCHECK(!IsPreconnecting()); |
528 | 530 |
529 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 531 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
530 | 532 |
531 if (IsOrphaned()) | 533 if (IsOrphaned()) |
532 stream_factory_->OnOrphanedJobComplete(this); | 534 stream_factory_->OnOrphanedJobComplete(this); |
533 else | 535 else |
534 request_->OnCertificateError(this, result, server_ssl_config_, ssl_info); | 536 request_->OnCertificateError(this, result, server_ssl_config_, ssl_info); |
535 // |this| may be deleted after this call. | 537 // |this| may be deleted after this call. |
536 } | 538 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 net_log) | 601 net_log) |
600 ? ERR_SPDY_SESSION_ALREADY_EXISTS | 602 ? ERR_SPDY_SESSION_ALREADY_EXISTS |
601 : OK; | 603 : OK; |
602 } | 604 } |
603 | 605 |
604 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { | 606 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { |
605 RunLoop(result); | 607 RunLoop(result); |
606 } | 608 } |
607 | 609 |
608 int HttpStreamFactoryImpl::Job::RunLoop(int result) { | 610 int HttpStreamFactoryImpl::Job::RunLoop(int result) { |
611 TRACE_EVENT0("net", "HttpStreamFactoryImpl::Job::RunLoop"); | |
609 result = DoLoop(result); | 612 result = DoLoop(result); |
610 | 613 |
611 if (result == ERR_IO_PENDING) | 614 if (result == ERR_IO_PENDING) |
612 return result; | 615 return result; |
613 | 616 |
614 // If there was an error, we should have already resumed the |waiting_job_|, | 617 // If there was an error, we should have already resumed the |waiting_job_|, |
615 // if there was one. | 618 // if there was one. |
616 DCHECK(result == OK || waiting_job_ == NULL); | 619 DCHECK(result == OK || waiting_job_ == NULL); |
617 | 620 |
618 if (IsPreconnecting()) { | 621 if (IsPreconnecting()) { |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1793 if (connection_->socket()) { | 1796 if (connection_->socket()) { |
1794 ConnectionAttempts socket_attempts; | 1797 ConnectionAttempts socket_attempts; |
1795 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1798 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1796 request_->AddConnectionAttempts(socket_attempts); | 1799 request_->AddConnectionAttempts(socket_attempts); |
1797 } else { | 1800 } else { |
1798 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1801 request_->AddConnectionAttempts(connection_->connection_attempts()); |
1799 } | 1802 } |
1800 } | 1803 } |
1801 | 1804 |
1802 } // namespace net | 1805 } // namespace net |
OLD | NEW |