| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 class NET_EXPORT_PRIVATE QuicStreamRequest { | 69 class NET_EXPORT_PRIVATE QuicStreamRequest { |
| 70 public: | 70 public: |
| 71 explicit QuicStreamRequest(QuicStreamFactory* factory); | 71 explicit QuicStreamRequest(QuicStreamFactory* factory); |
| 72 ~QuicStreamRequest(); | 72 ~QuicStreamRequest(); |
| 73 | 73 |
| 74 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is | 74 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is |
| 75 // passed to CertVerifier::Verify. | 75 // passed to CertVerifier::Verify. |
| 76 int Request(const HostPortPair& host_port_pair, | 76 int Request(const HostPortPair& host_port_pair, |
| 77 PrivacyMode privacy_mode, | 77 PrivacyMode privacy_mode, |
| 78 int cert_verify_flags, | 78 int cert_verify_flags, |
| 79 base::StringPiece origin_host, | 79 const GURL& url, |
| 80 base::StringPiece method, | 80 base::StringPiece method, |
| 81 const BoundNetLog& net_log, | 81 const BoundNetLog& net_log, |
| 82 const CompletionCallback& callback); | 82 const CompletionCallback& callback); |
| 83 | 83 |
| 84 void OnRequestComplete(int rv); | 84 void OnRequestComplete(int rv); |
| 85 | 85 |
| 86 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It | 86 // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It |
| 87 // returns the amount of time waiting job should be delayed. | 87 // returns the amount of time waiting job should be delayed. |
| 88 base::TimeDelta GetTimeDelayForWaitingJob() const; | 88 base::TimeDelta GetTimeDelayForWaitingJob() const; |
| 89 | 89 |
| 90 scoped_ptr<QuicHttpStream> ReleaseStream(); | 90 scoped_ptr<QuicHttpStream> ReleaseStream(); |
| 91 | 91 |
| 92 void set_stream(scoped_ptr<QuicHttpStream> stream); | 92 void set_stream(scoped_ptr<QuicHttpStream> stream); |
| 93 | 93 |
| 94 const std::string& origin_host() const { return origin_host_; } | 94 const std::string& origin_host() const { return origin_host_; } |
| 95 | 95 |
| 96 PrivacyMode privacy_mode() const { return privacy_mode_; } | 96 PrivacyMode privacy_mode() const { return privacy_mode_; } |
| 97 | 97 |
| 98 const BoundNetLog& net_log() const { return net_log_; } | 98 const BoundNetLog& net_log() const { return net_log_; } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 QuicStreamFactory* factory_; | 101 QuicStreamFactory* factory_; |
| 102 HostPortPair host_port_pair_; | 102 HostPortPair host_port_pair_; |
| 103 std::string origin_host_; | 103 std::string origin_host_; |
| 104 string url_; |
| 104 PrivacyMode privacy_mode_; | 105 PrivacyMode privacy_mode_; |
| 105 BoundNetLog net_log_; | 106 BoundNetLog net_log_; |
| 106 CompletionCallback callback_; | 107 CompletionCallback callback_; |
| 107 scoped_ptr<QuicHttpStream> stream_; | 108 scoped_ptr<QuicHttpStream> stream_; |
| 108 | 109 |
| 109 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); | 110 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 // A factory for creating new QuicHttpStreams on top of a pool of | 113 // A factory for creating new QuicHttpStreams on top of a pool of |
| 113 // QuicChromiumClientSessions. | 114 // QuicChromiumClientSessions. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 StringPiece origin_host); | 165 StringPiece origin_host); |
| 165 | 166 |
| 166 // Creates a new QuicHttpStream to |host_port_pair| which will be | 167 // Creates a new QuicHttpStream to |host_port_pair| which will be |
| 167 // owned by |request|. | 168 // owned by |request|. |
| 168 // If a matching session already exists, this method will return OK. If no | 169 // If a matching session already exists, this method will return OK. If no |
| 169 // matching session exists, this will return ERR_IO_PENDING and will invoke | 170 // matching session exists, this will return ERR_IO_PENDING and will invoke |
| 170 // OnRequestComplete asynchronously. | 171 // OnRequestComplete asynchronously. |
| 171 int Create(const HostPortPair& host_port_pair, | 172 int Create(const HostPortPair& host_port_pair, |
| 172 PrivacyMode privacy_mode, | 173 PrivacyMode privacy_mode, |
| 173 int cert_verify_flags, | 174 int cert_verify_flags, |
| 174 base::StringPiece origin_host, | 175 const GURL& url, |
| 175 base::StringPiece method, | 176 base::StringPiece method, |
| 176 const BoundNetLog& net_log, | 177 const BoundNetLog& net_log, |
| 177 QuicStreamRequest* request); | 178 QuicStreamRequest* request); |
| 178 | 179 |
| 179 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| | 180 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| |
| 180 // it marks QUIC as recently broken for the port of the session. Increments | 181 // it marks QUIC as recently broken for the port of the session. Increments |
| 181 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| | 182 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| |
| 182 // is greater than or equal to |max_number_of_lossy_connections_| then it | 183 // is greater than or equal to |max_number_of_lossy_connections_| then it |
| 183 // disables QUIC. If QUIC is disabled then it closes the connection. | 184 // disables QUIC. If QUIC is disabled then it closes the connection. |
| 184 // | 185 // |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 uint64_t port_seed_; | 521 uint64_t port_seed_; |
| 521 | 522 |
| 522 // Local address of socket that was created in CreateSession. | 523 // Local address of socket that was created in CreateSession. |
| 523 IPEndPoint local_address_; | 524 IPEndPoint local_address_; |
| 524 bool check_persisted_supports_quic_; | 525 bool check_persisted_supports_quic_; |
| 525 bool has_initialized_data_; | 526 bool has_initialized_data_; |
| 526 std::set<HostPortPair> quic_supported_servers_at_startup_; | 527 std::set<HostPortPair> quic_supported_servers_at_startup_; |
| 527 | 528 |
| 528 NetworkConnection network_connection_; | 529 NetworkConnection network_connection_; |
| 529 | 530 |
| 531 int num_push_streams_created_; |
| 532 |
| 530 QuicClientPushPromiseIndex push_promise_index_; | 533 QuicClientPushPromiseIndex push_promise_index_; |
| 531 | 534 |
| 532 base::TaskRunner* task_runner_; | 535 base::TaskRunner* task_runner_; |
| 533 | 536 |
| 534 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 537 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
| 535 | 538 |
| 536 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 539 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 537 }; | 540 }; |
| 538 | 541 |
| 539 } // namespace net | 542 } // namespace net |
| 540 | 543 |
| 541 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 544 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| OLD | NEW |