| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // cancel the request with the factory. | 51 // cancel the request with the factory. |
| 52 class NET_EXPORT_PRIVATE QuicStreamRequest { | 52 class NET_EXPORT_PRIVATE QuicStreamRequest { |
| 53 public: | 53 public: |
| 54 explicit QuicStreamRequest(QuicStreamFactory* factory); | 54 explicit QuicStreamRequest(QuicStreamFactory* factory); |
| 55 ~QuicStreamRequest(); | 55 ~QuicStreamRequest(); |
| 56 | 56 |
| 57 // For http, |is_https| is false. | 57 // For http, |is_https| is false. |
| 58 int Request(const HostPortPair& host_port_pair, | 58 int Request(const HostPortPair& host_port_pair, |
| 59 bool is_https, | 59 bool is_https, |
| 60 PrivacyMode privacy_mode, | 60 PrivacyMode privacy_mode, |
| 61 base::StringPiece origin_host, |
| 61 base::StringPiece method, | 62 base::StringPiece method, |
| 62 const BoundNetLog& net_log, | 63 const BoundNetLog& net_log, |
| 63 const CompletionCallback& callback); | 64 const CompletionCallback& callback); |
| 64 | 65 |
| 65 void OnRequestComplete(int rv); | 66 void OnRequestComplete(int rv); |
| 66 | 67 |
| 67 scoped_ptr<QuicHttpStream> ReleaseStream(); | 68 scoped_ptr<QuicHttpStream> ReleaseStream(); |
| 68 | 69 |
| 69 void set_stream(scoped_ptr<QuicHttpStream> stream); | 70 void set_stream(scoped_ptr<QuicHttpStream> stream); |
| 70 | 71 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ~QuicStreamFactory() override; | 116 ~QuicStreamFactory() override; |
| 116 | 117 |
| 117 // Creates a new QuicHttpStream to |host_port_pair| which will be | 118 // Creates a new QuicHttpStream to |host_port_pair| which will be |
| 118 // owned by |request|. |is_https| specifies if the protocol is https or not. | 119 // owned by |request|. |is_https| specifies if the protocol is https or not. |
| 119 // If a matching session already exists, this method will return OK. If no | 120 // If a matching session already exists, this method will return OK. If no |
| 120 // matching session exists, this will return ERR_IO_PENDING and will invoke | 121 // matching session exists, this will return ERR_IO_PENDING and will invoke |
| 121 // OnRequestComplete asynchronously. | 122 // OnRequestComplete asynchronously. |
| 122 int Create(const HostPortPair& host_port_pair, | 123 int Create(const HostPortPair& host_port_pair, |
| 123 bool is_https, | 124 bool is_https, |
| 124 PrivacyMode privacy_mode, | 125 PrivacyMode privacy_mode, |
| 126 bool server_and_origin_have_same_host, |
| 125 base::StringPiece method, | 127 base::StringPiece method, |
| 126 const BoundNetLog& net_log, | 128 const BoundNetLog& net_log, |
| 127 QuicStreamRequest* request); | 129 QuicStreamRequest* request); |
| 128 | 130 |
| 129 // Returns false if |packet_loss_rate| is less than |packet_loss_threshold_| | 131 // Returns false if |packet_loss_rate| is less than |packet_loss_threshold_| |
| 130 // otherwise it returns true and closes the session and marks QUIC as recently | 132 // otherwise it returns true and closes the session and marks QUIC as recently |
| 131 // broken for the port of the session. Increments | 133 // broken for the port of the session. Increments |
| 132 // |number_of_lossy_connections_| by port. | 134 // |number_of_lossy_connections_| by port. |
| 133 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate); | 135 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate); |
| 134 | 136 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; | 226 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; |
| 225 typedef std::set<Job*> JobSet; | 227 typedef std::set<Job*> JobSet; |
| 226 typedef std::map<QuicServerId, JobSet> JobMap; | 228 typedef std::map<QuicServerId, JobSet> JobMap; |
| 227 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; | 229 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; |
| 228 typedef std::set<QuicStreamRequest*> RequestSet; | 230 typedef std::set<QuicStreamRequest*> RequestSet; |
| 229 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; | 231 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; |
| 230 | 232 |
| 231 // Creates a job which doesn't wait for server config to be loaded from the | 233 // Creates a job which doesn't wait for server config to be loaded from the |
| 232 // disk cache. This job is started via a PostTask. | 234 // disk cache. This job is started via a PostTask. |
| 233 void CreateAuxilaryJob(const QuicServerId server_id, | 235 void CreateAuxilaryJob(const QuicServerId server_id, |
| 236 bool server_and_origin_have_same_host, |
| 234 bool is_post, | 237 bool is_post, |
| 235 const BoundNetLog& net_log); | 238 const BoundNetLog& net_log); |
| 236 | 239 |
| 237 // Returns a newly created QuicHttpStream owned by the caller, if a | 240 // Returns a newly created QuicHttpStream owned by the caller, if a |
| 238 // matching session already exists. Returns NULL otherwise. | 241 // matching session already exists. Returns NULL otherwise. |
| 239 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicServerId& key, | 242 scoped_ptr<QuicHttpStream> CreateIfSessionExists(const QuicServerId& key, |
| 240 const BoundNetLog& net_log); | 243 const BoundNetLog& net_log); |
| 241 | 244 |
| 242 bool OnResolution(const QuicServerId& server_id, | 245 bool OnResolution(const QuicServerId& server_id, |
| 243 const AddressList& address_list); | 246 const AddressList& address_list); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 base::TaskRunner* task_runner_; | 372 base::TaskRunner* task_runner_; |
| 370 | 373 |
| 371 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 374 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
| 372 | 375 |
| 373 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 376 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 374 }; | 377 }; |
| 375 | 378 |
| 376 } // namespace net | 379 } // namespace net |
| 377 | 380 |
| 378 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 381 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| OLD | NEW |