| OLD | NEW |
| 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 "net/spdy/spdy_session.h" | 8 #include "net/spdy/spdy_session.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 list->push_back(spdy_session); | 46 list->push_back(spdy_session); |
| 47 DCHECK_LE(list->size(), static_cast<unsigned int>(g_max_sessions_per_domain)); | 47 DCHECK_LE(list->size(), static_cast<unsigned int>(g_max_sessions_per_domain)); |
| 48 return spdy_session; | 48 return spdy_session; |
| 49 } | 49 } |
| 50 | 50 |
| 51 net::Error SpdySessionPool::GetSpdySessionFromSSLSocket( | 51 net::Error SpdySessionPool::GetSpdySessionFromSSLSocket( |
| 52 const HostPortPair& host_port_pair, | 52 const HostPortPair& host_port_pair, |
| 53 HttpNetworkSession* session, | 53 HttpNetworkSession* session, |
| 54 ClientSocketHandle* connection, | 54 ClientSocketHandle* connection, |
| 55 const BoundNetLog& net_log, | 55 const BoundNetLog& net_log, |
| 56 scoped_refptr<SpdySession>& spdy_session) { | 56 int certificate_error_code, |
| 57 scoped_refptr<SpdySession>* spdy_session) { |
| 57 // Create the SPDY session and add it to the pool. | 58 // Create the SPDY session and add it to the pool. |
| 58 spdy_session = (new SpdySession(host_port_pair, session, net_log.net_log())); | 59 *spdy_session = new SpdySession(host_port_pair, session, net_log.net_log()); |
| 59 SpdySessionList* list = GetSessionList(host_port_pair); | 60 SpdySessionList* list = GetSessionList(host_port_pair); |
| 60 if (!list) | 61 if (!list) |
| 61 list = AddSessionList(host_port_pair); | 62 list = AddSessionList(host_port_pair); |
| 62 DCHECK(list->empty()); | 63 DCHECK(list->empty()); |
| 63 list->push_back(spdy_session); | 64 list->push_back(*spdy_session); |
| 64 | 65 |
| 65 // Now we can initialize the session with the SSL socket. | 66 // Now we can initialize the session with the SSL socket. |
| 66 return spdy_session->InitializeWithSSLSocket(connection); | 67 return (*spdy_session)->InitializeWithSSLSocket(connection, |
| 68 certificate_error_code); |
| 67 } | 69 } |
| 68 | 70 |
| 69 bool SpdySessionPool::HasSession(const HostPortPair& host_port_pair) const { | 71 bool SpdySessionPool::HasSession(const HostPortPair& host_port_pair) const { |
| 70 if (GetSessionList(host_port_pair)) | 72 if (GetSessionList(host_port_pair)) |
| 71 return true; | 73 return true; |
| 72 return false; | 74 return false; |
| 73 } | 75 } |
| 74 | 76 |
| 75 void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) { | 77 void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) { |
| 76 SpdySessionList* list = GetSessionList(session->host_port_pair()); | 78 SpdySessionList* list = GetSessionList(session->host_port_pair()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 scoped_refptr<SpdySession> session = list->front(); | 131 scoped_refptr<SpdySession> session = list->front(); |
| 130 list->pop_front(); | 132 list->pop_front(); |
| 131 if (close) | 133 if (close) |
| 132 session->CloseAllStreams(net::ERR_ABORTED); | 134 session->CloseAllStreams(net::ERR_ABORTED); |
| 133 } | 135 } |
| 134 delete list; | 136 delete list; |
| 135 } | 137 } |
| 136 } | 138 } |
| 137 | 139 |
| 138 } // namespace net | 140 } // namespace net |
| OLD | NEW |