| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
| 16 #include "net/base/net_errors.h" |
| 16 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 | 20 |
| 20 class BoundNetLog; | 21 class BoundNetLog; |
| 21 class ClientSocketHandle; | 22 class ClientSocketHandle; |
| 22 class HttpNetworkSession; | 23 class HttpNetworkSession; |
| 23 class NetworkChangeNotifier; | 24 class NetworkChangeNotifier; |
| 24 class SpdySession; | 25 class SpdySession; |
| 25 | 26 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 // Set the maximum concurrent sessions per domain. | 41 // Set the maximum concurrent sessions per domain. |
| 41 static void set_max_sessions_per_domain(int max) { | 42 static void set_max_sessions_per_domain(int max) { |
| 42 if (max >= 1) | 43 if (max >= 1) |
| 43 g_max_sessions_per_domain = max; | 44 g_max_sessions_per_domain = max; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Builds a SpdySession from an existing SSL socket. Users should try | 47 // 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 | 48 // calling Get() first to use an existing SpdySession so we don't get |
| 48 // multiple SpdySessions per domain. Note that ownership of |connection| is | 49 // multiple SpdySessions per domain. Note that ownership of |connection| is |
| 49 // transferred from the caller to the SpdySession. | 50 // transferred from the caller to the SpdySession. |
| 50 scoped_refptr<SpdySession> GetSpdySessionFromSSLSocket( | 51 // Returns OK on success, and the |spdy_session| will be provided. |
| 52 // Returns an error on failure, and |spdy_session| will be NULL. |
| 53 net::Error GetSpdySessionFromSSLSocket( |
| 51 const HostPortPair& host_port_pair, | 54 const HostPortPair& host_port_pair, |
| 52 HttpNetworkSession* session, | 55 HttpNetworkSession* session, |
| 53 ClientSocketHandle* connection, | 56 ClientSocketHandle* connection, |
| 54 const BoundNetLog& net_log); | 57 const BoundNetLog& net_log, |
| 58 scoped_refptr<SpdySession>& spdy_session); |
| 55 | 59 |
| 56 // TODO(willchan): Consider renaming to HasReusableSession, since perhaps we | 60 // TODO(willchan): Consider renaming to HasReusableSession, since perhaps we |
| 57 // should be creating a new session. | 61 // should be creating a new session. |
| 58 bool HasSession(const HostPortPair& host_port_pair)const; | 62 bool HasSession(const HostPortPair& host_port_pair)const; |
| 59 | 63 |
| 60 // Close all Spdy Sessions; used for debugging. | 64 // Close all Spdy Sessions; used for debugging. |
| 61 void CloseAllSessions() { RemoveAllSessions(true); } | 65 void CloseAllSessions() { RemoveAllSessions(true); } |
| 62 | 66 |
| 63 // Removes a SpdySession from the SpdySessionPool. | 67 // Removes a SpdySession from the SpdySessionPool. |
| 64 void Remove(const scoped_refptr<SpdySession>& session); | 68 void Remove(const scoped_refptr<SpdySession>& session); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 NetworkChangeNotifier* const network_change_notifier_; | 103 NetworkChangeNotifier* const network_change_notifier_; |
| 100 | 104 |
| 101 static int g_max_sessions_per_domain; | 105 static int g_max_sessions_per_domain; |
| 102 | 106 |
| 103 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 107 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
| 104 }; | 108 }; |
| 105 | 109 |
| 106 } // namespace net | 110 } // namespace net |
| 107 | 111 |
| 108 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 112 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
| OLD | NEW |