| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| | 181 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| |
| 182 // it marks QUIC as recently broken for the port of the session. Increments | 182 // it marks QUIC as recently broken for the port of the session. Increments |
| 183 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| | 183 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| |
| 184 // is greater than or equal to |max_number_of_lossy_connections_| then it | 184 // is greater than or equal to |max_number_of_lossy_connections_| then it |
| 185 // disables QUIC. If QUIC is disabled then it closes the connection. | 185 // disables QUIC. If QUIC is disabled then it closes the connection. |
| 186 // | 186 // |
| 187 // Returns true if QUIC is disabled for the port of the session. | 187 // Returns true if QUIC is disabled for the port of the session. |
| 188 bool OnHandshakeConfirmed(QuicChromiumClientSession* session, | 188 bool OnHandshakeConfirmed(QuicChromiumClientSession* session, |
| 189 float packet_loss_rate); | 189 float packet_loss_rate); |
| 190 | 190 |
| 191 // Called when a TCP job completes for an origin that QUIC potentially |
| 192 // could be used for. |
| 193 void OnTcpJobCompleted(bool succeeded); |
| 194 |
| 191 // Returns true if QUIC is disabled for this port. | 195 // Returns true if QUIC is disabled for this port. |
| 192 bool IsQuicDisabled(uint16_t port); | 196 bool IsQuicDisabled(uint16_t port) const; |
| 193 | 197 |
| 194 // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not. | 198 // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not. |
| 195 QuicChromiumClientSession::QuicDisabledReason QuicDisabledReason( | 199 QuicChromiumClientSession::QuicDisabledReason QuicDisabledReason( |
| 196 uint16_t port) const; | 200 uint16_t port) const; |
| 197 | 201 |
| 198 // Returns reason QUIC is disabled as string for net-internals, or | 202 // Returns reason QUIC is disabled as string for net-internals, or |
| 199 // returns empty string if QUIC is not disabled. | 203 // returns empty string if QUIC is not disabled. |
| 200 const char* QuicDisabledReasonString() const; | 204 const char* QuicDisabledReasonString() const; |
| 201 | 205 |
| 202 // Called by a session when it becomes idle. | 206 // Called by a session when it becomes idle. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 typedef std::map<IPEndPoint, SessionSet> IPAliasMap; | 329 typedef std::map<IPEndPoint, SessionSet> IPAliasMap; |
| 326 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; | 330 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; |
| 327 typedef std::set<Job*> JobSet; | 331 typedef std::set<Job*> JobSet; |
| 328 typedef std::map<QuicServerId, JobSet> JobMap; | 332 typedef std::map<QuicServerId, JobSet> JobMap; |
| 329 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; | 333 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; |
| 330 typedef std::set<QuicStreamRequest*> RequestSet; | 334 typedef std::set<QuicStreamRequest*> RequestSet; |
| 331 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; | 335 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; |
| 332 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason> | 336 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason> |
| 333 DisabledReasonsQueue; | 337 DisabledReasonsQueue; |
| 334 | 338 |
| 339 enum FactoryStatus { |
| 340 OPEN, // New streams may be created. |
| 341 CLOSED, // No new streams may be created temporarily. |
| 342 DISABLED // No more streams may be created until the network changes. |
| 343 }; |
| 344 |
| 335 // Creates a job which doesn't wait for server config to be loaded from the | 345 // Creates a job which doesn't wait for server config to be loaded from the |
| 336 // disk cache. This job is started via a PostTask. | 346 // disk cache. This job is started via a PostTask. |
| 337 void CreateAuxilaryJob(const QuicServerId server_id, | 347 void CreateAuxilaryJob(const QuicServerId server_id, |
| 338 int cert_verify_flags, | 348 int cert_verify_flags, |
| 339 bool server_and_origin_have_same_host, | 349 bool server_and_origin_have_same_host, |
| 340 bool is_post, | 350 bool is_post, |
| 341 const BoundNetLog& net_log); | 351 const BoundNetLog& net_log); |
| 342 | 352 |
| 343 // Returns a newly created QuicHttpStream owned by the caller. | 353 // Returns a newly created QuicHttpStream owned by the caller. |
| 344 scoped_ptr<QuicHttpStream> CreateFromSession( | 354 scoped_ptr<QuicHttpStream> CreateFromSession( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // QuicServerInfo objects from HttpServerProperties. | 394 // QuicServerInfo objects from HttpServerProperties. |
| 385 void MaybeInitialize(); | 395 void MaybeInitialize(); |
| 386 | 396 |
| 387 void ProcessGoingAwaySession(QuicChromiumClientSession* session, | 397 void ProcessGoingAwaySession(QuicChromiumClientSession* session, |
| 388 const QuicServerId& server_id, | 398 const QuicServerId& server_id, |
| 389 bool was_session_active); | 399 bool was_session_active); |
| 390 | 400 |
| 391 // Collect stats from recent connections, possibly disabling Quic. | 401 // Collect stats from recent connections, possibly disabling Quic. |
| 392 void MaybeDisableQuic(QuicChromiumClientSession* session); | 402 void MaybeDisableQuic(QuicChromiumClientSession* session); |
| 393 | 403 |
| 404 void MaybeDisableQuic(uint16_t port); |
| 405 |
| 394 bool require_confirmation_; | 406 bool require_confirmation_; |
| 395 HostResolver* host_resolver_; | 407 HostResolver* host_resolver_; |
| 396 ClientSocketFactory* client_socket_factory_; | 408 ClientSocketFactory* client_socket_factory_; |
| 397 base::WeakPtr<HttpServerProperties> http_server_properties_; | 409 base::WeakPtr<HttpServerProperties> http_server_properties_; |
| 398 TransportSecurityState* transport_security_state_; | 410 TransportSecurityState* transport_security_state_; |
| 399 CTVerifier* cert_transparency_verifier_; | 411 CTVerifier* cert_transparency_verifier_; |
| 400 scoped_ptr<QuicServerInfoFactory> quic_server_info_factory_; | 412 scoped_ptr<QuicServerInfoFactory> quic_server_info_factory_; |
| 401 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; | 413 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; |
| 402 QuicRandom* random_generator_; | 414 QuicRandom* random_generator_; |
| 403 scoped_ptr<QuicClock> clock_; | 415 scoped_ptr<QuicClock> clock_; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 bool check_persisted_supports_quic_; | 538 bool check_persisted_supports_quic_; |
| 527 bool has_initialized_data_; | 539 bool has_initialized_data_; |
| 528 std::set<HostPortPair> quic_supported_servers_at_startup_; | 540 std::set<HostPortPair> quic_supported_servers_at_startup_; |
| 529 | 541 |
| 530 NetworkConnection network_connection_; | 542 NetworkConnection network_connection_; |
| 531 | 543 |
| 532 int num_push_streams_created_; | 544 int num_push_streams_created_; |
| 533 | 545 |
| 534 QuicClientPushPromiseIndex push_promise_index_; | 546 QuicClientPushPromiseIndex push_promise_index_; |
| 535 | 547 |
| 548 // Current status of the factory's ability to create streams. |
| 549 FactoryStatus status_; |
| 550 |
| 536 base::TaskRunner* task_runner_; | 551 base::TaskRunner* task_runner_; |
| 537 | 552 |
| 538 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 553 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
| 539 | 554 |
| 540 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 555 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 541 }; | 556 }; |
| 542 | 557 |
| 543 } // namespace net | 558 } // namespace net |
| 544 | 559 |
| 545 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 560 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| OLD | NEW |