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