| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 base::StringPiece method, | 58 base::StringPiece method, |
| 59 const BoundNetLog& net_log, | 59 const BoundNetLog& net_log, |
| 60 const CompletionCallback& callback); | 60 const CompletionCallback& callback); |
| 61 | 61 |
| 62 void OnRequestComplete(int rv); | 62 void OnRequestComplete(int rv); |
| 63 | 63 |
| 64 scoped_ptr<QuicHttpStream> ReleaseStream(); | 64 scoped_ptr<QuicHttpStream> ReleaseStream(); |
| 65 | 65 |
| 66 void set_stream(scoped_ptr<QuicHttpStream> stream); | 66 void set_stream(scoped_ptr<QuicHttpStream> stream); |
| 67 | 67 |
| 68 const BoundNetLog& net_log() const{ | 68 const BoundNetLog& net_log() const { return net_log_; } |
| 69 return net_log_; | |
| 70 } | |
| 71 | 69 |
| 72 private: | 70 private: |
| 73 QuicStreamFactory* factory_; | 71 QuicStreamFactory* factory_; |
| 74 HostPortPair host_port_pair_; | 72 HostPortPair host_port_pair_; |
| 75 bool is_https_; | 73 bool is_https_; |
| 76 BoundNetLog net_log_; | 74 BoundNetLog net_log_; |
| 77 CompletionCallback callback_; | 75 CompletionCallback callback_; |
| 78 scoped_ptr<QuicHttpStream> stream_; | 76 scoped_ptr<QuicHttpStream> stream_; |
| 79 | 77 |
| 80 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); | 78 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // the ip address, port, and scheme. | 172 // the ip address, port, and scheme. |
| 175 struct NET_EXPORT_PRIVATE IpAliasKey { | 173 struct NET_EXPORT_PRIVATE IpAliasKey { |
| 176 IpAliasKey(); | 174 IpAliasKey(); |
| 177 IpAliasKey(IPEndPoint ip_endpoint, bool is_https); | 175 IpAliasKey(IPEndPoint ip_endpoint, bool is_https); |
| 178 ~IpAliasKey(); | 176 ~IpAliasKey(); |
| 179 | 177 |
| 180 IPEndPoint ip_endpoint; | 178 IPEndPoint ip_endpoint; |
| 181 bool is_https; | 179 bool is_https; |
| 182 | 180 |
| 183 // Needed to be an element of std::set. | 181 // Needed to be an element of std::set. |
| 184 bool operator<(const IpAliasKey &other) const; | 182 bool operator<(const IpAliasKey& other) const; |
| 185 bool operator==(const IpAliasKey &other) const; | 183 bool operator==(const IpAliasKey& other) const; |
| 186 }; | 184 }; |
| 187 | 185 |
| 188 typedef std::map<QuicServerId, QuicClientSession*> SessionMap; | 186 typedef std::map<QuicServerId, QuicClientSession*> SessionMap; |
| 189 typedef std::map<QuicClientSession*, QuicServerId> SessionIdMap; | 187 typedef std::map<QuicClientSession*, QuicServerId> SessionIdMap; |
| 190 typedef std::set<QuicServerId> AliasSet; | 188 typedef std::set<QuicServerId> AliasSet; |
| 191 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; | 189 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; |
| 192 typedef std::set<QuicClientSession*> SessionSet; | 190 typedef std::set<QuicClientSession*> SessionSet; |
| 193 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; | 191 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; |
| 194 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; | 192 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; |
| 195 typedef std::map<QuicServerId, Job*> JobMap; | 193 typedef std::map<QuicServerId, Job*> JobMap; |
| 196 typedef std::map<QuicStreamRequest*, Job*> RequestMap; | 194 typedef std::map<QuicStreamRequest*, Job*> RequestMap; |
| 197 typedef std::set<QuicStreamRequest*> RequestSet; | 195 typedef std::set<QuicStreamRequest*> RequestSet; |
| 198 typedef std::map<Job*, RequestSet> JobRequestsMap; | 196 typedef std::map<Job*, RequestSet> JobRequestsMap; |
| 199 | 197 |
| 200 // Returns a newly created QuicHttpStream owned by the caller, if a | 198 // Returns a newly created QuicHttpStream owned by the caller, if a |
| 201 // matching session already exists. Returns NULL otherwise. | 199 // matching session already exists. Returns NULL otherwise. |
| 202 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicServerId& key, | 200 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicServerId& key, |
| 203 const BoundNetLog& net_log); | 201 const BoundNetLog& net_log); |
| 204 | 202 |
| 205 bool OnResolution(const QuicServerId& server_id, | 203 bool OnResolution(const QuicServerId& server_id, |
| 206 const AddressList& address_list); | 204 const AddressList& address_list); |
| 207 void OnJobComplete(Job* job, int rv); | 205 void OnJobComplete(Job* job, int rv); |
| 208 bool HasActiveSession(const QuicServerId& server_id) const; | 206 bool HasActiveSession(const QuicServerId& server_id) const; |
| 209 bool HasActiveJob(const QuicServerId& server_id) const; | 207 bool HasActiveJob(const QuicServerId& server_id) const; |
| 210 int CreateSession(const QuicServerId& server_id, | 208 int CreateSession(const QuicServerId& server_id, |
| 211 scoped_ptr<QuicServerInfo> quic_server_info, | 209 scoped_ptr<QuicServerInfo> quic_server_info, |
| 212 const AddressList& address_list, | 210 const AddressList& address_list, |
| 213 const BoundNetLog& net_log, | 211 const BoundNetLog& net_log, |
| 214 QuicClientSession** session); | 212 QuicClientSession** session); |
| 215 void ActivateSession(const QuicServerId& key, | 213 void ActivateSession(const QuicServerId& key, QuicClientSession* session); |
| 216 QuicClientSession* session); | |
| 217 | 214 |
| 218 // Initializes the cached state associated with |server_id| in | 215 // Initializes the cached state associated with |server_id| in |
| 219 // |crypto_config_| with the information in |server_info|. | 216 // |crypto_config_| with the information in |server_info|. |
| 220 void InitializeCachedStateInCryptoConfig( | 217 void InitializeCachedStateInCryptoConfig( |
| 221 const QuicServerId& server_id, | 218 const QuicServerId& server_id, |
| 222 const scoped_ptr<QuicServerInfo>& server_info); | 219 const scoped_ptr<QuicServerInfo>& server_info); |
| 223 | 220 |
| 224 void ProcessGoingAwaySession(QuicClientSession* session, | 221 void ProcessGoingAwaySession(QuicClientSession* session, |
| 225 const QuicServerId& server_id); | 222 const QuicServerId& server_id); |
| 226 | 223 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 uint64 port_seed_; | 274 uint64 port_seed_; |
| 278 | 275 |
| 279 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 276 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
| 280 | 277 |
| 281 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 278 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 282 }; | 279 }; |
| 283 | 280 |
| 284 } // namespace net | 281 } // namespace net |
| 285 | 282 |
| 286 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 283 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| OLD | NEW |