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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
595 // It is OK to dereference spdy_session_pool, because the | 596 // It is OK to dereference spdy_session_pool, because the |
596 // ClientSocketPoolManager will be destroyed in the same callback that | 597 // ClientSocketPoolManager will be destroyed in the same callback that |
597 // destroys the SpdySessionPool. | 598 // destroys the SpdySessionPool. |
598 return spdy_session_pool->FindAvailableSession(spdy_session_key, origin_url, | 599 return spdy_session_pool->FindAvailableSession(spdy_session_key, origin_url, |
599 net_log) | 600 net_log) |
600 ? ERR_SPDY_SESSION_ALREADY_EXISTS | 601 ? ERR_SPDY_SESSION_ALREADY_EXISTS |
601 : OK; | 602 : OK; |
602 } | 603 } |
603 | 604 |
604 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { | 605 void HttpStreamFactoryImpl::Job::OnIOComplete(int result) { |
606 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | |
607 "HttpStreamFactoryImpl::Job::OnIOComplete"); | |
605 RunLoop(result); | 608 RunLoop(result); |
606 } | 609 } |
607 | 610 |
608 int HttpStreamFactoryImpl::Job::RunLoop(int result) { | 611 int HttpStreamFactoryImpl::Job::RunLoop(int result) { |
612 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | |
613 "HttpStreamFactoryImpl::Job::RunLoop"); | |
609 result = DoLoop(result); | 614 result = DoLoop(result); |
610 | 615 |
611 if (result == ERR_IO_PENDING) | 616 if (result == ERR_IO_PENDING) |
612 return result; | 617 return result; |
613 | 618 |
614 // If there was an error, we should have already resumed the |waiting_job_|, | 619 // If there was an error, we should have already resumed the |waiting_job_|, |
615 // if there was one. | 620 // if there was one. |
616 DCHECK(result == OK || waiting_job_ == NULL); | 621 DCHECK(result == OK || waiting_job_ == NULL); |
617 | 622 |
618 if (IsPreconnecting()) { | 623 if (IsPreconnecting()) { |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1743 return CheckAlternativeServiceValidityForOrigin(*spdy_session); | 1748 return CheckAlternativeServiceValidityForOrigin(*spdy_session); |
1744 } | 1749 } |
1745 | 1750 |
1746 int HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: | 1751 int HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: |
1747 CreateAvailableSessionFromSocket(const SpdySessionKey& key, | 1752 CreateAvailableSessionFromSocket(const SpdySessionKey& key, |
1748 scoped_ptr<ClientSocketHandle> connection, | 1753 scoped_ptr<ClientSocketHandle> connection, |
1749 const BoundNetLog& net_log, | 1754 const BoundNetLog& net_log, |
1750 int certificate_error_code, | 1755 int certificate_error_code, |
1751 bool is_secure, | 1756 bool is_secure, |
1752 base::WeakPtr<SpdySession>* spdy_session) { | 1757 base::WeakPtr<SpdySession>* spdy_session) { |
1758 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | |
1759 "HttpStreamFactoryImpl::CreateAvailableSessionFromSocket"); | |
mmenke
2016/04/04 16:45:49
Think you should probably include the "Job::" in t
ssid
2016/04/05 00:50:12
Done.
| |
1753 *spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( | 1760 *spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( |
1754 key, std::move(connection), net_log, certificate_error_code, is_secure); | 1761 key, std::move(connection), net_log, certificate_error_code, is_secure); |
1755 return CheckAlternativeServiceValidityForOrigin(*spdy_session); | 1762 return CheckAlternativeServiceValidityForOrigin(*spdy_session); |
1756 } | 1763 } |
1757 | 1764 |
1758 int HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: | 1765 int HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: |
1759 CheckAlternativeServiceValidityForOrigin( | 1766 CheckAlternativeServiceValidityForOrigin( |
1760 base::WeakPtr<SpdySession> spdy_session) { | 1767 base::WeakPtr<SpdySession> spdy_session) { |
1761 // For an alternative Job, server_.host() might be different than | 1768 // For an alternative Job, server_.host() might be different than |
1762 // origin_url_.host(), therefore it needs to be verified that the former | 1769 // origin_url_.host(), therefore it needs to be verified that the former |
(...skipping 30 matching lines...) Expand all Loading... | |
1793 if (connection_->socket()) { | 1800 if (connection_->socket()) { |
1794 ConnectionAttempts socket_attempts; | 1801 ConnectionAttempts socket_attempts; |
1795 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1802 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1796 request_->AddConnectionAttempts(socket_attempts); | 1803 request_->AddConnectionAttempts(socket_attempts); |
1797 } else { | 1804 } else { |
1798 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1805 request_->AddConnectionAttempts(connection_->connection_attempts()); |
1799 } | 1806 } |
1800 } | 1807 } |
1801 | 1808 |
1802 } // namespace net | 1809 } // namespace net |
OLD | NEW |