OLD | NEW |
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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ | 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ |
6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ | 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "net/base/address_list.h" | 12 #include "net/base/address_list.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
16 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
| 17 #include "net/quic/quic_config.h" |
| 18 #include "net/quic/quic_crypto_stream.h" |
17 #include "net/quic/quic_http_stream.h" | 19 #include "net/quic/quic_http_stream.h" |
18 #include "net/quic/quic_protocol.h" | 20 #include "net/quic/quic_protocol.h" |
19 | 21 |
20 namespace net { | 22 namespace net { |
21 | 23 |
22 class HostResolver; | 24 class HostResolver; |
23 class ClientSocketFactory; | 25 class ClientSocketFactory; |
24 class QuicClock; | 26 class QuicClock; |
25 class QuicClientSession; | 27 class QuicClientSession; |
26 class QuicCryptoClientStreamFactory; | 28 class QuicCryptoClientStreamFactory; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 101 |
100 base::Value* QuicStreamFactoryInfoToValue() const; | 102 base::Value* QuicStreamFactoryInfoToValue() const; |
101 | 103 |
102 private: | 104 private: |
103 class Job; | 105 class Job; |
104 | 106 |
105 typedef std::map<HostPortProxyPair, QuicClientSession*> SessionMap; | 107 typedef std::map<HostPortProxyPair, QuicClientSession*> SessionMap; |
106 typedef std::set<HostPortProxyPair> AliasSet; | 108 typedef std::set<HostPortProxyPair> AliasSet; |
107 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; | 109 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; |
108 typedef std::set<QuicClientSession*> SessionSet; | 110 typedef std::set<QuicClientSession*> SessionSet; |
| 111 typedef std::map<HostPortProxyPair, QuicCryptoClientConfig*> CryptoConfigMap; |
109 typedef std::map<HostPortProxyPair, Job*> JobMap; | 112 typedef std::map<HostPortProxyPair, Job*> JobMap; |
110 typedef std::map<QuicStreamRequest*, Job*> RequestMap; | 113 typedef std::map<QuicStreamRequest*, Job*> RequestMap; |
111 typedef std::set<QuicStreamRequest*> RequestSet; | 114 typedef std::set<QuicStreamRequest*> RequestSet; |
112 typedef std::map<Job*, RequestSet> JobRequestsMap; | 115 typedef std::map<Job*, RequestSet> JobRequestsMap; |
113 | 116 |
114 void OnJobComplete(Job* job, int rv); | 117 void OnJobComplete(Job* job, int rv); |
115 bool HasActiveSession(const HostPortProxyPair& host_port_proxy_pair); | 118 bool HasActiveSession(const HostPortProxyPair& host_port_proxy_pair); |
116 bool HasActiveJob(const HostPortProxyPair& host_port_proxy_pair); | 119 bool HasActiveJob(const HostPortProxyPair& host_port_proxy_pair); |
117 QuicClientSession* CreateSession(const std::string& host, | 120 QuicClientSession* CreateSession( |
118 const AddressList& address_list, | 121 const HostPortProxyPair& host_port_proxy_pair, |
119 const BoundNetLog& net_log); | 122 const AddressList& address_list, |
| 123 const BoundNetLog& net_log); |
120 void ActivateSession(const HostPortProxyPair& host_port_proxy_pair, | 124 void ActivateSession(const HostPortProxyPair& host_port_proxy_pair, |
121 QuicClientSession* session); | 125 QuicClientSession* session); |
122 | 126 |
| 127 QuicCryptoClientConfig* GetOrCreateCryptoConfig( |
| 128 const HostPortProxyPair& host_port_proxy_pair); |
| 129 |
123 HostResolver* host_resolver_; | 130 HostResolver* host_resolver_; |
124 ClientSocketFactory* client_socket_factory_; | 131 ClientSocketFactory* client_socket_factory_; |
125 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; | 132 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; |
126 QuicRandom* random_generator_; | 133 QuicRandom* random_generator_; |
127 scoped_ptr<QuicClock> clock_; | 134 scoped_ptr<QuicClock> clock_; |
128 | 135 |
129 // Contains owning pointers to all sessions that currently exist. | 136 // Contains owning pointers to all sessions that currently exist. |
130 SessionSet all_sessions_; | 137 SessionSet all_sessions_; |
131 // Contains non-owning pointers to currently active session | 138 // Contains non-owning pointers to currently active session |
132 // (not going away session, once they're implemented). | 139 // (not going away session, once they're implemented). |
133 SessionMap active_sessions_; | 140 SessionMap active_sessions_; |
134 SessionAliasMap session_aliases_; | 141 SessionAliasMap session_aliases_; |
135 | 142 |
| 143 // Contains owning pointers to QuicCryptoClientConfig. QuicCryptoClientConfig |
| 144 // contains configuration and cached state about servers. |
| 145 // TODO(rtenneti): Persist all_crypto_configs_ to disk and decide when to |
| 146 // clear the data in the map. |
| 147 CryptoConfigMap all_crypto_configs_; |
| 148 |
136 JobMap active_jobs_; | 149 JobMap active_jobs_; |
137 JobRequestsMap job_requests_map_; | 150 JobRequestsMap job_requests_map_; |
138 RequestMap active_requests_; | 151 RequestMap active_requests_; |
139 | 152 |
140 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 153 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
141 | 154 |
142 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 155 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
143 }; | 156 }; |
144 | 157 |
145 } // namespace net | 158 } // namespace net |
146 | 159 |
147 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 160 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |