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

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

Issue 4291001: Convert implicit scoped_refptr constructor calls to explicit ones, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/build
Patch Set: comments Created 10 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "net/http/http_network_session.h" 9 #include "net/http/http_network_session.h"
10 #include "net/spdy/spdy_session.h" 10 #include "net/spdy/spdy_session.h"
(...skipping 23 matching lines...) Expand all
34 scoped_refptr<SpdySession> SpdySessionPool::Get( 34 scoped_refptr<SpdySession> SpdySessionPool::Get(
35 const HostPortProxyPair& host_port_proxy_pair, 35 const HostPortProxyPair& host_port_proxy_pair,
36 SpdySettingsStorage* spdy_settings, 36 SpdySettingsStorage* spdy_settings,
37 const BoundNetLog& net_log) { 37 const BoundNetLog& net_log) {
38 scoped_refptr<SpdySession> spdy_session; 38 scoped_refptr<SpdySession> spdy_session;
39 SpdySessionList* list = GetSessionList(host_port_proxy_pair); 39 SpdySessionList* list = GetSessionList(host_port_proxy_pair);
40 if (list) { 40 if (list) {
41 if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) { 41 if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) {
42 spdy_session = list->front(); 42 spdy_session = list->front();
43 list->pop_front(); 43 list->pop_front();
44 net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION, 44 net_log.AddEvent(
45 new NetLogSourceParameter("session", 45 NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION,
46 spdy_session->net_log().source())); 46 make_scoped_refptr(new NetLogSourceParameter(
47 "session", spdy_session->net_log().source())));
47 } 48 }
48 } else { 49 } else {
49 list = AddSessionList(host_port_proxy_pair); 50 list = AddSessionList(host_port_proxy_pair);
50 } 51 }
51 52
52 DCHECK(list); 53 DCHECK(list);
53 if (!spdy_session) { 54 if (!spdy_session) {
54 spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings, 55 spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings,
55 net_log.net_log()); 56 net_log.net_log());
56 net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_CREATED_NEW_SESSION, 57 net_log.AddEvent(
57 new NetLogSourceParameter("session", 58 NetLog::TYPE_SPDY_SESSION_POOL_CREATED_NEW_SESSION,
58 spdy_session->net_log().source())); 59 make_scoped_refptr(new NetLogSourceParameter(
60 "session", spdy_session->net_log().source())));
59 } 61 }
60 62
61 DCHECK(spdy_session); 63 DCHECK(spdy_session);
62 list->push_back(spdy_session); 64 list->push_back(spdy_session);
63 DCHECK_LE(list->size(), static_cast<unsigned int>(g_max_sessions_per_domain)); 65 DCHECK_LE(list->size(), static_cast<unsigned int>(g_max_sessions_per_domain));
64 return spdy_session; 66 return spdy_session;
65 } 67 }
66 68
67 net::Error SpdySessionPool::GetSpdySessionFromSocket( 69 net::Error SpdySessionPool::GetSpdySessionFromSocket(
68 const HostPortProxyPair& host_port_proxy_pair, 70 const HostPortProxyPair& host_port_proxy_pair,
69 SpdySettingsStorage* spdy_settings, 71 SpdySettingsStorage* spdy_settings,
70 ClientSocketHandle* connection, 72 ClientSocketHandle* connection,
71 const BoundNetLog& net_log, 73 const BoundNetLog& net_log,
72 int certificate_error_code, 74 int certificate_error_code,
73 scoped_refptr<SpdySession>* spdy_session, 75 scoped_refptr<SpdySession>* spdy_session,
74 bool is_secure) { 76 bool is_secure) {
75 // Create the SPDY session and add it to the pool. 77 // Create the SPDY session and add it to the pool.
76 *spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings, 78 *spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings,
77 net_log.net_log()); 79 net_log.net_log());
78 SpdySessionList* list = GetSessionList(host_port_proxy_pair); 80 SpdySessionList* list = GetSessionList(host_port_proxy_pair);
79 if (!list) 81 if (!list)
80 list = AddSessionList(host_port_proxy_pair); 82 list = AddSessionList(host_port_proxy_pair);
81 DCHECK(list->empty()); 83 DCHECK(list->empty());
82 list->push_back(*spdy_session); 84 list->push_back(*spdy_session);
83 85
84 net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, 86 net_log.AddEvent(
85 new NetLogSourceParameter("session", 87 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET,
86 (*spdy_session)->net_log().source())); 88 make_scoped_refptr(new NetLogSourceParameter(
89 "session", (*spdy_session)->net_log().source())));
87 90
88 // Now we can initialize the session with the SSL socket. 91 // Now we can initialize the session with the SSL socket.
89 return (*spdy_session)->InitializeWithSocket(connection, is_secure, 92 return (*spdy_session)->InitializeWithSocket(connection, is_secure,
90 certificate_error_code); 93 certificate_error_code);
91 } 94 }
92 95
93 bool SpdySessionPool::HasSession( 96 bool SpdySessionPool::HasSession(
94 const HostPortProxyPair& host_port_proxy_pair) const { 97 const HostPortProxyPair& host_port_proxy_pair) const {
95 if (GetSessionList(host_port_proxy_pair)) 98 if (GetSessionList(host_port_proxy_pair))
96 return true; 99 return true;
97 return false; 100 return false;
98 } 101 }
99 102
100 void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) { 103 void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) {
101 SpdySessionList* list = GetSessionList(session->host_port_proxy_pair()); 104 SpdySessionList* list = GetSessionList(session->host_port_proxy_pair());
102 DCHECK(list); // We really shouldn't remove if we've already been removed. 105 DCHECK(list); // We really shouldn't remove if we've already been removed.
103 if (!list) 106 if (!list)
104 return; 107 return;
105 list->remove(session); 108 list->remove(session);
106 session->net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_REMOVE_SESSION, 109 session->net_log().AddEvent(
107 new NetLogSourceParameter("session", 110 NetLog::TYPE_SPDY_SESSION_POOL_REMOVE_SESSION,
108 session->net_log().source())); 111 make_scoped_refptr(new NetLogSourceParameter(
112 "session", session->net_log().source())));
109 if (list->empty()) 113 if (list->empty())
110 RemoveSessionList(session->host_port_proxy_pair()); 114 RemoveSessionList(session->host_port_proxy_pair());
111 } 115 }
112 116
113 Value* SpdySessionPool::SpdySessionPoolInfoToValue() { 117 Value* SpdySessionPool::SpdySessionPoolInfoToValue() {
114 ListValue* list = new ListValue(); 118 ListValue* list = new ListValue();
115 119
116 SpdySessionsMap::const_iterator spdy_session_pool_it = sessions_.begin(); 120 SpdySessionsMap::const_iterator spdy_session_pool_it = sessions_.begin();
117 for (SpdySessionsMap::const_iterator it = sessions_.begin(); 121 for (SpdySessionsMap::const_iterator it = sessions_.begin();
118 it != sessions_.end(); it++) { 122 it != sessions_.end(); it++) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 session->CloseSessionOnError(net::ERR_ABORTED, false); 207 session->CloseSessionOnError(net::ERR_ABORTED, false);
204 list->pop_front(); 208 list->pop_front();
205 if (list->empty()) { 209 if (list->empty()) {
206 delete list; 210 delete list;
207 old_map.erase(old_map.begin()->first); 211 old_map.erase(old_map.begin()->first);
208 } 212 }
209 } 213 }
210 } 214 }
211 215
212 } // namespace net 216 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698