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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 { |
50 public: | 50 public: |
51 explicit QuicStreamRequest(QuicStreamFactory* factory); | 51 explicit QuicStreamRequest(QuicStreamFactory* factory); |
52 ~QuicStreamRequest(); | 52 ~QuicStreamRequest(); |
53 | 53 |
54 // For http, |is_https| is false and |cert_verifier| can be null. | 54 // For http, |is_https| is false and |cert_verifier| can be null. |
55 int Request(const HostPortPair& host_port_pair, | 55 int Request(const HostPortPair& host_port_pair, |
56 bool is_https, | 56 bool is_https, |
57 PrivacyMode privacy_mode, | |
58 base::StringPiece method, | 57 base::StringPiece method, |
59 const BoundNetLog& net_log, | 58 const BoundNetLog& net_log, |
60 const CompletionCallback& callback); | 59 const CompletionCallback& callback); |
61 | 60 |
62 void OnRequestComplete(int rv); | 61 void OnRequestComplete(int rv); |
63 | 62 |
64 scoped_ptr<QuicHttpStream> ReleaseStream(); | 63 scoped_ptr<QuicHttpStream> ReleaseStream(); |
65 | 64 |
66 void set_stream(scoped_ptr<QuicHttpStream> stream); | 65 void set_stream(scoped_ptr<QuicHttpStream> stream); |
67 | 66 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 101 |
103 // Creates a new QuicHttpStream to |host_port_pair| which will be | 102 // Creates a new QuicHttpStream to |host_port_pair| which will be |
104 // owned by |request|. |is_https| specifies if the protocol is https or not. | 103 // owned by |request|. |is_https| specifies if the protocol is https or not. |
105 // |cert_verifier| is used by ProofVerifier for verifying the certificate | 104 // |cert_verifier| is used by ProofVerifier for verifying the certificate |
106 // chain and signature. For http, this can be null. If a matching session | 105 // chain and signature. For http, this can be null. If a matching session |
107 // already exists, this method will return OK. If no matching session exists, | 106 // already exists, this method will return OK. If no matching session exists, |
108 // this will return ERR_IO_PENDING and will invoke OnRequestComplete | 107 // this will return ERR_IO_PENDING and will invoke OnRequestComplete |
109 // asynchronously. | 108 // asynchronously. |
110 int Create(const HostPortPair& host_port_pair, | 109 int Create(const HostPortPair& host_port_pair, |
111 bool is_https, | 110 bool is_https, |
112 PrivacyMode privacy_mode, | |
113 base::StringPiece method, | 111 base::StringPiece method, |
114 const BoundNetLog& net_log, | 112 const BoundNetLog& net_log, |
115 QuicStreamRequest* request); | 113 QuicStreamRequest* request); |
116 | 114 |
117 // Called by a session when it becomes idle. | 115 // Called by a session when it becomes idle. |
118 void OnIdleSession(QuicClientSession* session); | 116 void OnIdleSession(QuicClientSession* session); |
119 | 117 |
120 // Called by a session when it is going away and no more streams should be | 118 // Called by a session when it is going away and no more streams should be |
121 // created on it. | 119 // created on it. |
122 void OnSessionGoingAway(QuicClientSession* session); | 120 void OnSessionGoingAway(QuicClientSession* session); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DCHECK(!quic_server_info_factory_); | 157 DCHECK(!quic_server_info_factory_); |
160 quic_server_info_factory_ = quic_server_info_factory; | 158 quic_server_info_factory_ = quic_server_info_factory; |
161 } | 159 } |
162 | 160 |
163 bool enable_pacing() const { return enable_pacing_; } | 161 bool enable_pacing() const { return enable_pacing_; } |
164 | 162 |
165 private: | 163 private: |
166 class Job; | 164 class Job; |
167 friend class test::QuicStreamFactoryPeer; | 165 friend class test::QuicStreamFactoryPeer; |
168 | 166 |
169 // The key used to find session by ip. Includes | 167 // The key used to find session by hostname. Includes |
170 // the ip address, port, and scheme. | 168 // the ip address, port, and scheme. |
171 struct NET_EXPORT_PRIVATE IpAliasKey { | 169 struct NET_EXPORT_PRIVATE IpAliasKey { |
172 IpAliasKey(); | 170 IpAliasKey(); |
173 IpAliasKey(IPEndPoint ip_endpoint, bool is_https); | 171 IpAliasKey(IPEndPoint ip_endpoint, bool is_https); |
174 ~IpAliasKey(); | 172 ~IpAliasKey(); |
175 | 173 |
176 IPEndPoint ip_endpoint; | 174 IPEndPoint ip_endpoint; |
177 bool is_https; | 175 bool is_https; |
178 | 176 |
179 // Needed to be an element of std::set. | 177 // Needed to be an element of std::set. |
(...skipping 15 matching lines...) Expand all Loading... |
195 // Returns a newly created QuicHttpStream owned by the caller, if a | 193 // Returns a newly created QuicHttpStream owned by the caller, if a |
196 // matching session already exists. Returns NULL otherwise. | 194 // matching session already exists. Returns NULL otherwise. |
197 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicSessionKey& key, | 195 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicSessionKey& key, |
198 const BoundNetLog& net_log); | 196 const BoundNetLog& net_log); |
199 | 197 |
200 bool OnResolution(const QuicSessionKey& session_key, | 198 bool OnResolution(const QuicSessionKey& session_key, |
201 const AddressList& address_list); | 199 const AddressList& address_list); |
202 void OnJobComplete(Job* job, int rv); | 200 void OnJobComplete(Job* job, int rv); |
203 bool HasActiveSession(const QuicSessionKey& session_key) const; | 201 bool HasActiveSession(const QuicSessionKey& session_key) const; |
204 bool HasActiveJob(const QuicSessionKey& session_key) const; | 202 bool HasActiveJob(const QuicSessionKey& session_key) const; |
205 int CreateSession(const QuicSessionKey& session_key, | 203 int CreateSession(const HostPortPair& host_port_pair, |
| 204 bool is_https, |
206 scoped_ptr<QuicServerInfo> quic_server_info, | 205 scoped_ptr<QuicServerInfo> quic_server_info, |
207 const AddressList& address_list, | 206 const AddressList& address_list, |
208 const BoundNetLog& net_log, | 207 const BoundNetLog& net_log, |
209 QuicClientSession** session); | 208 QuicClientSession** session); |
210 void ActivateSession(const QuicSessionKey& key, | 209 void ActivateSession(const QuicSessionKey& key, |
211 QuicClientSession* session); | 210 QuicClientSession* session); |
212 | 211 |
213 // Initializes the cached state associated with |session_key| in | 212 // Initializes the cached state associated with |session_key| in |
214 // |crypto_config_| with the information in |server_info|. | 213 // |crypto_config_| with the information in |server_info|. |
215 void InitializeCachedState(const QuicSessionKey& session_key, | 214 void InitializeCachedState(const QuicSessionKey& session_key, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 uint64 port_seed_; | 284 uint64 port_seed_; |
286 | 285 |
287 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 286 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
288 | 287 |
289 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 288 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
290 }; | 289 }; |
291 | 290 |
292 } // namespace net | 291 } // namespace net |
293 | 292 |
294 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 293 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |