| 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 #ifndef NET_SPDY_SPDY_SESSION_POOL_H_ | 5 #ifndef NET_SPDY_SPDY_SESSION_POOL_H_ |
| 6 #define NET_SPDY_SPDY_SESSION_POOL_H_ | 6 #define NET_SPDY_SPDY_SESSION_POOL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Set the maximum concurrent sessions per domain. | 40 // Set the maximum concurrent sessions per domain. |
| 41 static void set_max_sessions_per_domain(int max) { | 41 static void set_max_sessions_per_domain(int max) { |
| 42 if (max >= 1) | 42 if (max >= 1) |
| 43 g_max_sessions_per_domain = max; | 43 g_max_sessions_per_domain = max; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Builds a SpdySession from an existing SSL socket. Users should try | 46 // Builds a SpdySession from an existing SSL socket. Users should try |
| 47 // calling Get() first to use an existing SpdySession so we don't get | 47 // calling Get() first to use an existing SpdySession so we don't get |
| 48 // multiple SpdySessions per domain. Note that ownership of |connection| is | 48 // multiple SpdySessions per domain. Note that ownership of |connection| is |
| 49 // transferred from the caller to the SpdySession. | 49 // transferred from the caller to the SpdySession. |
| 50 // |certificate_error_code| is used to indicate the certificate error |
| 51 // encountered when connecting the SSL socket. OK means there was no error. |
| 50 // Returns OK on success, and the |spdy_session| will be provided. | 52 // Returns OK on success, and the |spdy_session| will be provided. |
| 51 // Returns an error on failure, and |spdy_session| will be NULL. | 53 // Returns an error on failure, and |spdy_session| will be NULL. |
| 52 net::Error GetSpdySessionFromSSLSocket( | 54 net::Error GetSpdySessionFromSSLSocket( |
| 53 const HostPortPair& host_port_pair, | 55 const HostPortPair& host_port_pair, |
| 54 HttpNetworkSession* session, | 56 HttpNetworkSession* session, |
| 55 ClientSocketHandle* connection, | 57 ClientSocketHandle* connection, |
| 56 const BoundNetLog& net_log, | 58 const BoundNetLog& net_log, |
| 57 scoped_refptr<SpdySession>& spdy_session); | 59 int certificate_error_code, |
| 60 scoped_refptr<SpdySession>* spdy_session); |
| 58 | 61 |
| 59 // TODO(willchan): Consider renaming to HasReusableSession, since perhaps we | 62 // TODO(willchan): Consider renaming to HasReusableSession, since perhaps we |
| 60 // should be creating a new session. | 63 // should be creating a new session. |
| 61 bool HasSession(const HostPortPair& host_port_pair)const; | 64 bool HasSession(const HostPortPair& host_port_pair)const; |
| 62 | 65 |
| 63 // Close all Spdy Sessions; used for debugging. | 66 // Close all Spdy Sessions; used for debugging. |
| 64 void CloseAllSessions() { RemoveAllSessions(true); } | 67 void CloseAllSessions() { RemoveAllSessions(true); } |
| 65 | 68 |
| 66 // Removes a SpdySession from the SpdySessionPool. | 69 // Removes a SpdySession from the SpdySessionPool. |
| 67 void Remove(const scoped_refptr<SpdySession>& session); | 70 void Remove(const scoped_refptr<SpdySession>& session); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 SpdySessionsMap sessions_; | 103 SpdySessionsMap sessions_; |
| 101 | 104 |
| 102 static int g_max_sessions_per_domain; | 105 static int g_max_sessions_per_domain; |
| 103 | 106 |
| 104 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 107 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
| 105 }; | 108 }; |
| 106 | 109 |
| 107 } // namespace net | 110 } // namespace net |
| 108 | 111 |
| 109 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 112 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
| OLD | NEW |