Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: net/spdy/spdy_session_pool.cc

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | net/spdy/spdy_session_spdy2_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/spdy/spdy_session_pool.h" 5 #include "net/spdy/spdy_session_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 HttpServerProperties* http_server_properties, 46 HttpServerProperties* http_server_properties,
47 const std::string& trusted_spdy_proxy) 47 const std::string& trusted_spdy_proxy)
48 : http_server_properties_(http_server_properties), 48 : http_server_properties_(http_server_properties),
49 ssl_config_service_(ssl_config_service), 49 ssl_config_service_(ssl_config_service),
50 resolver_(resolver), 50 resolver_(resolver),
51 verify_domain_authentication_(true), 51 verify_domain_authentication_(true),
52 enable_sending_initial_settings_(true), 52 enable_sending_initial_settings_(true),
53 trusted_spdy_proxy_( 53 trusted_spdy_proxy_(
54 HostPortPair::FromString(trusted_spdy_proxy)) { 54 HostPortPair::FromString(trusted_spdy_proxy)) {
55 NetworkChangeNotifier::AddIPAddressObserver(this); 55 NetworkChangeNotifier::AddIPAddressObserver(this);
56 if (ssl_config_service_) 56 if (ssl_config_service_.get())
57 ssl_config_service_->AddObserver(this); 57 ssl_config_service_->AddObserver(this);
58 CertDatabase::GetInstance()->AddObserver(this); 58 CertDatabase::GetInstance()->AddObserver(this);
59 } 59 }
60 60
61 SpdySessionPool::~SpdySessionPool() { 61 SpdySessionPool::~SpdySessionPool() {
62 CloseAllSessions(); 62 CloseAllSessions();
63 63
64 if (ssl_config_service_) 64 if (ssl_config_service_.get())
65 ssl_config_service_->RemoveObserver(this); 65 ssl_config_service_->RemoveObserver(this);
66 NetworkChangeNotifier::RemoveIPAddressObserver(this); 66 NetworkChangeNotifier::RemoveIPAddressObserver(this);
67 CertDatabase::GetInstance()->RemoveObserver(this); 67 CertDatabase::GetInstance()->RemoveObserver(this);
68 } 68 }
69 69
70 scoped_refptr<SpdySession> SpdySessionPool::Get( 70 scoped_refptr<SpdySession> SpdySessionPool::Get(
71 const HostPortProxyPair& host_port_proxy_pair, 71 const HostPortProxyPair& host_port_proxy_pair,
72 const BoundNetLog& net_log) { 72 const BoundNetLog& net_log) {
73 return GetInternal(host_port_proxy_pair, net_log, false); 73 return GetInternal(host_port_proxy_pair, net_log, false);
74 } 74 }
75 75
76 scoped_refptr<SpdySession> SpdySessionPool::GetIfExists( 76 scoped_refptr<SpdySession> SpdySessionPool::GetIfExists(
77 const HostPortProxyPair& host_port_proxy_pair, 77 const HostPortProxyPair& host_port_proxy_pair,
78 const BoundNetLog& net_log) { 78 const BoundNetLog& net_log) {
79 return GetInternal(host_port_proxy_pair, net_log, true); 79 return GetInternal(host_port_proxy_pair, net_log, true);
80 } 80 }
81 81
82 scoped_refptr<SpdySession> SpdySessionPool::GetInternal( 82 scoped_refptr<SpdySession> SpdySessionPool::GetInternal(
83 const HostPortProxyPair& host_port_proxy_pair, 83 const HostPortProxyPair& host_port_proxy_pair,
84 const BoundNetLog& net_log, 84 const BoundNetLog& net_log,
85 bool only_use_existing_sessions) { 85 bool only_use_existing_sessions) {
86 scoped_refptr<SpdySession> spdy_session; 86 scoped_refptr<SpdySession> spdy_session;
87 SpdySessionList* list = GetSessionList(host_port_proxy_pair); 87 SpdySessionList* list = GetSessionList(host_port_proxy_pair);
88 if (!list) { 88 if (!list) {
89 // Check if we have a Session through a domain alias. 89 // Check if we have a Session through a domain alias.
90 spdy_session = GetFromAlias(host_port_proxy_pair, net_log, true); 90 spdy_session = GetFromAlias(host_port_proxy_pair, net_log, true);
91 if (spdy_session) { 91 if (spdy_session.get()) {
92 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionGet", 92 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionGet",
93 FOUND_EXISTING_FROM_IP_POOL, 93 FOUND_EXISTING_FROM_IP_POOL,
94 SPDY_SESSION_GET_MAX); 94 SPDY_SESSION_GET_MAX);
95 net_log.AddEvent( 95 net_log.AddEvent(
96 NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION_FROM_IP_POOL, 96 NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION_FROM_IP_POOL,
97 spdy_session->net_log().source().ToEventParametersCallback()); 97 spdy_session->net_log().source().ToEventParametersCallback());
98 // Add this session to the map so that we can find it next time. 98 // Add this session to the map so that we can find it next time.
99 list = AddSessionList(host_port_proxy_pair); 99 list = AddSessionList(host_port_proxy_pair);
100 list->push_back(spdy_session); 100 list->push_back(spdy_session);
101 spdy_session->AddPooledAlias(host_port_proxy_pair); 101 spdy_session->AddPooledAlias(host_port_proxy_pair);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 const scoped_refptr<SpdySession>& session = *session_it; 452 const scoped_refptr<SpdySession>& session = *session_it;
453 CHECK(session); 453 CHECK(session);
454 if (!session->is_active()) { 454 if (!session->is_active()) {
455 session->CloseSessionOnError( 455 session->CloseSessionOnError(
456 net::ERR_ABORTED, true, "Closing idle sessions."); 456 net::ERR_ABORTED, true, "Closing idle sessions.");
457 } 457 }
458 } 458 }
459 } 459 }
460 460
461 } // namespace net 461 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | net/spdy/spdy_session_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698