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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 18 matching lines...) Expand all Loading... |
29 class CertVerifier; | 29 class CertVerifier; |
30 class ClientSocketFactory; | 30 class ClientSocketFactory; |
31 class HostResolver; | 31 class HostResolver; |
32 class HttpServerProperties; | 32 class HttpServerProperties; |
33 class QuicClock; | 33 class QuicClock; |
34 class QuicClientSession; | 34 class QuicClientSession; |
35 class QuicConnectionHelper; | 35 class QuicConnectionHelper; |
36 class QuicCryptoClientStreamFactory; | 36 class QuicCryptoClientStreamFactory; |
37 class QuicRandom; | 37 class QuicRandom; |
38 class QuicServerInfoFactory; | 38 class QuicServerInfoFactory; |
39 class QuicSessionKey; | 39 class QuicServerId; |
40 class QuicStreamFactory; | 40 class QuicStreamFactory; |
41 | 41 |
42 namespace test { | 42 namespace test { |
43 class QuicStreamFactoryPeer; | 43 class QuicStreamFactoryPeer; |
44 } // namespace test | 44 } // namespace test |
45 | 45 |
46 // Encapsulates a pending request for a QuicHttpStream. | 46 // Encapsulates a pending request for a QuicHttpStream. |
47 // If the request is still pending when it is destroyed, it will | 47 // If the request is still pending when it is destroyed, it will |
48 // cancel the request with the factory. | 48 // cancel the request with the factory. |
49 class NET_EXPORT_PRIVATE QuicStreamRequest { | 49 class NET_EXPORT_PRIVATE QuicStreamRequest { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 ~IpAliasKey(); | 174 ~IpAliasKey(); |
175 | 175 |
176 IPEndPoint ip_endpoint; | 176 IPEndPoint ip_endpoint; |
177 bool is_https; | 177 bool is_https; |
178 | 178 |
179 // Needed to be an element of std::set. | 179 // Needed to be an element of std::set. |
180 bool operator<(const IpAliasKey &other) const; | 180 bool operator<(const IpAliasKey &other) const; |
181 bool operator==(const IpAliasKey &other) const; | 181 bool operator==(const IpAliasKey &other) const; |
182 }; | 182 }; |
183 | 183 |
184 typedef std::map<QuicSessionKey, QuicClientSession*> SessionMap; | 184 typedef std::map<QuicServerId, QuicClientSession*> SessionMap; |
185 typedef std::set<QuicSessionKey> AliasSet; | 185 typedef std::set<QuicServerId> AliasSet; |
186 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; | 186 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; |
187 typedef std::set<QuicClientSession*> SessionSet; | 187 typedef std::set<QuicClientSession*> SessionSet; |
188 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; | 188 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; |
189 typedef std::map<QuicSessionKey, QuicCryptoClientConfig*> CryptoConfigMap; | 189 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; |
190 typedef std::map<QuicSessionKey, Job*> JobMap; | 190 typedef std::map<QuicServerId, Job*> JobMap; |
191 typedef std::map<QuicStreamRequest*, Job*> RequestMap; | 191 typedef std::map<QuicStreamRequest*, Job*> RequestMap; |
192 typedef std::set<QuicStreamRequest*> RequestSet; | 192 typedef std::set<QuicStreamRequest*> RequestSet; |
193 typedef std::map<Job*, RequestSet> JobRequestsMap; | 193 typedef std::map<Job*, RequestSet> JobRequestsMap; |
194 | 194 |
195 // Returns a newly created QuicHttpStream owned by the caller, if a | 195 // Returns a newly created QuicHttpStream owned by the caller, if a |
196 // matching session already exists. Returns NULL otherwise. | 196 // matching session already exists. Returns NULL otherwise. |
197 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicSessionKey& key, | 197 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicServerId& key, |
198 const BoundNetLog& net_log); | 198 const BoundNetLog& net_log); |
199 | 199 |
200 bool OnResolution(const QuicSessionKey& session_key, | 200 bool OnResolution(const QuicServerId& server_id, |
201 const AddressList& address_list); | 201 const AddressList& address_list); |
202 void OnJobComplete(Job* job, int rv); | 202 void OnJobComplete(Job* job, int rv); |
203 bool HasActiveSession(const QuicSessionKey& session_key) const; | 203 bool HasActiveSession(const QuicServerId& server_id) const; |
204 bool HasActiveJob(const QuicSessionKey& session_key) const; | 204 bool HasActiveJob(const QuicServerId& server_id) const; |
205 int CreateSession(const QuicSessionKey& session_key, | 205 int CreateSession(const QuicServerId& server_id, |
206 scoped_ptr<QuicServerInfo> quic_server_info, | 206 scoped_ptr<QuicServerInfo> quic_server_info, |
207 const AddressList& address_list, | 207 const AddressList& address_list, |
208 const BoundNetLog& net_log, | 208 const BoundNetLog& net_log, |
209 QuicClientSession** session); | 209 QuicClientSession** session); |
210 void ActivateSession(const QuicSessionKey& key, | 210 void ActivateSession(const QuicServerId& key, |
211 QuicClientSession* session); | 211 QuicClientSession* session); |
212 | 212 |
213 // Initializes the cached state associated with |session_key| in | 213 // Initializes the cached state associated with |server_id| in |
214 // |crypto_config_| with the information in |server_info|. | 214 // |crypto_config_| with the information in |server_info|. |
215 void InitializeCachedState(const QuicSessionKey& session_key, | 215 void InitializeCachedState(const QuicServerId& server_id, |
216 const scoped_ptr<QuicServerInfo>& server_info); | 216 const scoped_ptr<QuicServerInfo>& server_info); |
217 | 217 |
218 void ExpireBrokenAlternateProtocolMappings(); | 218 void ExpireBrokenAlternateProtocolMappings(); |
219 void ScheduleBrokenAlternateProtocolMappingsExpiration(); | 219 void ScheduleBrokenAlternateProtocolMappingsExpiration(); |
220 | 220 |
221 bool require_confirmation_; | 221 bool require_confirmation_; |
222 HostResolver* host_resolver_; | 222 HostResolver* host_resolver_; |
223 ClientSocketFactory* client_socket_factory_; | 223 ClientSocketFactory* client_socket_factory_; |
224 base::WeakPtr<HttpServerProperties> http_server_properties_; | 224 base::WeakPtr<HttpServerProperties> http_server_properties_; |
225 CertVerifier* cert_verifier_; | 225 CertVerifier* cert_verifier_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 uint64 port_seed_; | 285 uint64 port_seed_; |
286 | 286 |
287 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 287 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
288 | 288 |
289 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 289 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
290 }; | 290 }; |
291 | 291 |
292 } // namespace net | 292 } // namespace net |
293 | 293 |
294 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 294 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |