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