Chromium Code Reviews| 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 // A client specific QuicSession subclass. This class owns the underlying | 5 // A client specific QuicSession subclass. This class owns the underlying |
| 6 // QuicConnection and QuicConnectionHelper objects. The connection stores | 6 // QuicConnection and QuicConnectionHelper objects. The connection stores |
| 7 // a non-owning pointer to the helper so this session needs to ensure that | 7 // a non-owning pointer to the helper so this session needs to ensure that |
| 8 // the helper outlives the connection. | 8 // the helper outlives the connection. |
| 9 | 9 |
| 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 class SSLInfo; | 37 class SSLInfo; |
| 38 class TransportSecurityState; | 38 class TransportSecurityState; |
| 39 | 39 |
| 40 namespace test { | 40 namespace test { |
| 41 class QuicClientSessionPeer; | 41 class QuicClientSessionPeer; |
| 42 } // namespace test | 42 } // namespace test |
| 43 | 43 |
| 44 class NET_EXPORT_PRIVATE QuicClientSession : public QuicClientSessionBase, | 44 class NET_EXPORT_PRIVATE QuicClientSession : public QuicClientSessionBase, |
| 45 public QuicPacketReader::Visitor { | 45 public QuicPacketReader::Visitor { |
| 46 public: | 46 public: |
| 47 // Reasons we may disable QUIC, that is under certain pathological | |
|
Ryan Hamilton
2015/07/07 03:09:37
nit: Please don't use the first person in comments
Buck
2015/07/07 18:38:48
Done.
| |
| 48 // connection errors. Note: these values must be kept in sync with | |
| 49 // the corresponding values of QuicDisabledReason in: | |
| 50 // tools/metrics/histograms/histograms.xml | |
| 51 enum QuicDisabledReason { | |
| 52 QUIC_DISABLED_NOT = 0, // default, not disabled | |
| 53 QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE = 1, | |
| 54 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS = 2, | |
| 55 QUIC_DISABLED_BAD_PACKET_LOSS_RATE = 3, | |
| 56 QUIC_DISABLED_MAX = 4, | |
| 57 }; | |
| 58 | |
| 47 // An interface for observing events on a session. | 59 // An interface for observing events on a session. |
| 48 class NET_EXPORT_PRIVATE Observer { | 60 class NET_EXPORT_PRIVATE Observer { |
| 49 public: | 61 public: |
| 50 virtual ~Observer() {} | 62 virtual ~Observer() {} |
| 51 virtual void OnCryptoHandshakeConfirmed() = 0; | 63 virtual void OnCryptoHandshakeConfirmed() = 0; |
| 52 virtual void OnSessionClosed(int error) = 0; | 64 virtual void OnSessionClosed(int error) = 0; |
| 53 }; | 65 }; |
| 54 | 66 |
| 55 // A helper class used to manage a request to create a stream. | 67 // A helper class used to manage a request to create a stream. |
| 56 class NET_EXPORT_PRIVATE StreamRequest { | 68 class NET_EXPORT_PRIVATE StreamRequest { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 // than the number of round-trips needed for the handshake. | 199 // than the number of round-trips needed for the handshake. |
| 188 int GetNumSentClientHellos() const; | 200 int GetNumSentClientHellos() const; |
| 189 | 201 |
| 190 // Returns true if |hostname| may be pooled onto this session. If this | 202 // Returns true if |hostname| may be pooled onto this session. If this |
| 191 // is a secure QUIC session, then |hostname| must match the certificate | 203 // is a secure QUIC session, then |hostname| must match the certificate |
| 192 // presented during the handshake. | 204 // presented during the handshake. |
| 193 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; | 205 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; |
| 194 | 206 |
| 195 const QuicServerId& server_id() const { return server_id_; } | 207 const QuicServerId& server_id() const { return server_id_; } |
| 196 | 208 |
| 209 const QuicDisabledReason disabled_reason() const { return disabled_reason_; } | |
|
Alexei Svitkine (slow)
2015/07/07 15:15:29
Nit: No need for leading const.
Buck
2015/07/07 18:38:48
Done.
| |
| 210 | |
| 197 protected: | 211 protected: |
| 198 // QuicSession methods: | 212 // QuicSession methods: |
| 199 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 213 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
| 200 | 214 |
| 201 private: | 215 private: |
| 202 friend class test::QuicClientSessionPeer; | 216 friend class test::QuicClientSessionPeer; |
| 203 | 217 |
| 204 typedef std::set<Observer*> ObserverSet; | 218 typedef std::set<Observer*> ObserverSet; |
| 205 typedef std::list<StreamRequest*> StreamRequestQueue; | 219 typedef std::list<StreamRequest*> StreamRequestQueue; |
| 206 | 220 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 size_t num_total_streams_; | 268 size_t num_total_streams_; |
| 255 base::TaskRunner* task_runner_; | 269 base::TaskRunner* task_runner_; |
| 256 BoundNetLog net_log_; | 270 BoundNetLog net_log_; |
| 257 QuicPacketReader packet_reader_; | 271 QuicPacketReader packet_reader_; |
| 258 base::TimeTicks dns_resolution_end_time_; | 272 base::TimeTicks dns_resolution_end_time_; |
| 259 base::TimeTicks handshake_start_; // Time the handshake was started. | 273 base::TimeTicks handshake_start_; // Time the handshake was started. |
| 260 scoped_ptr<QuicConnectionLogger> logger_; | 274 scoped_ptr<QuicConnectionLogger> logger_; |
| 261 // True when the session is going away, and streams may no longer be created | 275 // True when the session is going away, and streams may no longer be created |
| 262 // on this session. Existing stream will continue to be processed. | 276 // on this session. Existing stream will continue to be processed. |
| 263 bool going_away_; | 277 bool going_away_; |
| 278 QuicDisabledReason disabled_reason_; | |
| 264 base::WeakPtrFactory<QuicClientSession> weak_factory_; | 279 base::WeakPtrFactory<QuicClientSession> weak_factory_; |
| 265 | 280 |
| 266 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 281 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
| 267 }; | 282 }; |
| 268 | 283 |
| 269 } // namespace net | 284 } // namespace net |
| 270 | 285 |
| 271 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ | 286 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ |
| OLD | NEW |