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_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
11 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 11 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
12 | 12 |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 | 14 |
15 #include <list> | 15 #include <list> |
16 #include <memory> | 16 #include <memory> |
17 #include <set> | 17 #include <set> |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "base/containers/mru_cache.h" | 21 #include "base/containers/mru_cache.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "net/base/completion_callback.h" | 24 #include "net/base/completion_callback.h" |
25 #include "net/base/load_timing_info.h" | |
26 #include "net/base/net_error_details.h" | 25 #include "net/base/net_error_details.h" |
27 #include "net/cert/ct_verify_result.h" | 26 #include "net/cert/ct_verify_result.h" |
28 #include "net/proxy/proxy_server.h" | 27 #include "net/proxy/proxy_server.h" |
29 #include "net/quic/chromium/quic_chromium_client_stream.h" | 28 #include "net/quic/chromium/quic_chromium_client_stream.h" |
30 #include "net/quic/chromium/quic_chromium_packet_reader.h" | 29 #include "net/quic/chromium/quic_chromium_packet_reader.h" |
31 #include "net/quic/chromium/quic_chromium_packet_writer.h" | 30 #include "net/quic/chromium/quic_chromium_packet_writer.h" |
32 #include "net/quic/chromium/quic_connection_logger.h" | 31 #include "net/quic/chromium/quic_connection_logger.h" |
33 #include "net/quic/core/quic_client_session_base.h" | 32 #include "net/quic/core/quic_client_session_base.h" |
34 #include "net/quic/core/quic_crypto_client_stream.h" | 33 #include "net/quic/core/quic_crypto_client_stream.h" |
35 #include "net/quic/core/quic_protocol.h" | 34 #include "net/quic/core/quic_protocol.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 QuicClock* clock, | 114 QuicClock* clock, |
116 TransportSecurityState* transport_security_state, | 115 TransportSecurityState* transport_security_state, |
117 std::unique_ptr<QuicServerInfo> server_info, | 116 std::unique_ptr<QuicServerInfo> server_info, |
118 const QuicServerId& server_id, | 117 const QuicServerId& server_id, |
119 int yield_after_packets, | 118 int yield_after_packets, |
120 QuicTime::Delta yield_after_duration, | 119 QuicTime::Delta yield_after_duration, |
121 int cert_verify_flags, | 120 int cert_verify_flags, |
122 const QuicConfig& config, | 121 const QuicConfig& config, |
123 QuicCryptoClientConfig* crypto_config, | 122 QuicCryptoClientConfig* crypto_config, |
124 const char* const connection_description, | 123 const char* const connection_description, |
125 base::TimeTicks dns_resolution_start_time, | |
126 base::TimeTicks dns_resolution_end_time, | 124 base::TimeTicks dns_resolution_end_time, |
127 QuicClientPushPromiseIndex* push_promise_index, | 125 QuicClientPushPromiseIndex* push_promise_index, |
128 base::TaskRunner* task_runner, | 126 base::TaskRunner* task_runner, |
129 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 127 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
130 NetLog* net_log); | 128 NetLog* net_log); |
131 ~QuicChromiumClientSession() override; | 129 ~QuicChromiumClientSession() override; |
132 | 130 |
133 void Initialize() override; | 131 void Initialize() override; |
134 | 132 |
135 void AddObserver(Observer* observer); | 133 void AddObserver(Observer* observer); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 284 |
287 // Returns true if session has one ore more streams marked as non-migratable. | 285 // Returns true if session has one ore more streams marked as non-migratable. |
288 bool HasNonMigratableStreams() const; | 286 bool HasNonMigratableStreams() const; |
289 | 287 |
290 void HandlePromised(QuicStreamId associated_id, | 288 void HandlePromised(QuicStreamId associated_id, |
291 QuicStreamId promised_id, | 289 QuicStreamId promised_id, |
292 const SpdyHeaderBlock& headers) override; | 290 const SpdyHeaderBlock& headers) override; |
293 | 291 |
294 void DeletePromised(QuicClientPromisedInfo* promised) override; | 292 void DeletePromised(QuicClientPromisedInfo* promised) override; |
295 | 293 |
296 const LoadTimingInfo::ConnectTiming& GetConnectTiming(); | |
297 | |
298 protected: | 294 protected: |
299 // QuicSession methods: | 295 // QuicSession methods: |
300 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; | 296 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; |
301 bool ShouldCreateOutgoingDynamicStream() override; | 297 bool ShouldCreateOutgoingDynamicStream() override; |
302 | 298 |
303 QuicChromiumClientStream* CreateIncomingDynamicStream( | 299 QuicChromiumClientStream* CreateIncomingDynamicStream( |
304 QuicStreamId id) override; | 300 QuicStreamId id) override; |
305 | 301 |
306 private: | 302 private: |
307 friend class test::QuicChromiumClientSessionPeer; | 303 friend class test::QuicChromiumClientSessionPeer; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 std::unique_ptr<ct::CTVerifyResult> ct_verify_result_; | 350 std::unique_ptr<ct::CTVerifyResult> ct_verify_result_; |
355 std::string pinning_failure_log_; | 351 std::string pinning_failure_log_; |
356 bool pkp_bypassed_; | 352 bool pkp_bypassed_; |
357 ObserverSet observers_; | 353 ObserverSet observers_; |
358 StreamRequestQueue stream_requests_; | 354 StreamRequestQueue stream_requests_; |
359 CompletionCallback callback_; | 355 CompletionCallback callback_; |
360 size_t num_total_streams_; | 356 size_t num_total_streams_; |
361 base::TaskRunner* task_runner_; | 357 base::TaskRunner* task_runner_; |
362 BoundNetLog net_log_; | 358 BoundNetLog net_log_; |
363 std::vector<std::unique_ptr<QuicChromiumPacketReader>> packet_readers_; | 359 std::vector<std::unique_ptr<QuicChromiumPacketReader>> packet_readers_; |
364 LoadTimingInfo::ConnectTiming connect_timing_; | 360 base::TimeTicks dns_resolution_end_time_; |
| 361 base::TimeTicks handshake_start_; // Time the handshake was started. |
365 std::unique_ptr<QuicConnectionLogger> logger_; | 362 std::unique_ptr<QuicConnectionLogger> logger_; |
366 // True when the session is going away, and streams may no longer be created | 363 // True when the session is going away, and streams may no longer be created |
367 // on this session. Existing stream will continue to be processed. | 364 // on this session. Existing stream will continue to be processed. |
368 bool going_away_; | 365 bool going_away_; |
369 // True when the session receives a go away from server due to port migration. | 366 // True when the session receives a go away from server due to port migration. |
370 bool port_migration_detected_; | 367 bool port_migration_detected_; |
371 TokenBindingSignatureMap token_binding_signatures_; | 368 TokenBindingSignatureMap token_binding_signatures_; |
372 // UMA histogram counters for streams pushed to this session. | 369 // UMA histogram counters for streams pushed to this session. |
373 int streams_pushed_count_; | 370 int streams_pushed_count_; |
374 int streams_pushed_and_claimed_count_; | 371 int streams_pushed_and_claimed_count_; |
375 // Stores packet that witnesses socket write error. This packet is | 372 // Stores packet that witnesses socket write error. This packet is |
376 // written to a new socket after migration completes. | 373 // written to a new socket after migration completes. |
377 scoped_refptr<StringIOBuffer> packet_; | 374 scoped_refptr<StringIOBuffer> packet_; |
378 // TODO(jri): Replace use of migration_pending_ sockets_.size(). | 375 // TODO(jri): Replace use of migration_pending_ sockets_.size(). |
379 // When a task is posted for MigrateSessionOnError, pass in | 376 // When a task is posted for MigrateSessionOnError, pass in |
380 // sockets_.size(). Then in MigrateSessionOnError, check to see if | 377 // sockets_.size(). Then in MigrateSessionOnError, check to see if |
381 // the current sockets_.size() == the passed in value. | 378 // the current sockets_.size() == the passed in value. |
382 bool migration_pending_; // True while migration is underway. | 379 bool migration_pending_; // True while migration is underway. |
383 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 380 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
384 | 381 |
385 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 382 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
386 }; | 383 }; |
387 | 384 |
388 } // namespace net | 385 } // namespace net |
389 | 386 |
390 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 387 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |