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_ |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "net/quic/chromium/quic_chromium_client_stream.h" | 31 #include "net/quic/chromium/quic_chromium_client_stream.h" |
32 #include "net/quic/chromium/quic_chromium_packet_reader.h" | 32 #include "net/quic/chromium/quic_chromium_packet_reader.h" |
33 #include "net/quic/chromium/quic_chromium_packet_writer.h" | 33 #include "net/quic/chromium/quic_chromium_packet_writer.h" |
34 #include "net/quic/chromium/quic_connection_logger.h" | 34 #include "net/quic/chromium/quic_connection_logger.h" |
35 #include "net/quic/core/quic_client_session_base.h" | 35 #include "net/quic/core/quic_client_session_base.h" |
36 #include "net/quic/core/quic_crypto_client_stream.h" | 36 #include "net/quic/core/quic_crypto_client_stream.h" |
37 #include "net/quic/core/quic_protocol.h" | 37 #include "net/quic/core/quic_protocol.h" |
38 #include "net/quic/core/quic_server_id.h" | 38 #include "net/quic/core/quic_server_id.h" |
39 #include "net/quic/core/quic_time.h" | 39 #include "net/quic/core/quic_time.h" |
40 #include "net/socket/socket_performance_watcher.h" | 40 #include "net/socket/socket_performance_watcher.h" |
| 41 #include "net/spdy/server_push_delegate.h" |
41 | 42 |
42 namespace net { | 43 namespace net { |
43 | 44 |
44 class CertVerifyResult; | 45 class CertVerifyResult; |
45 class DatagramClientSocket; | 46 class DatagramClientSocket; |
46 class NetLog; | 47 class NetLog; |
47 class QuicCryptoClientStreamFactory; | 48 class QuicCryptoClientStreamFactory; |
48 class QuicServerInfo; | 49 class QuicServerInfo; |
49 class QuicStreamFactory; | 50 class QuicStreamFactory; |
50 class SSLInfo; | 51 class SSLInfo; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // Returns current default socket. This is the socket over which all | 291 // Returns current default socket. This is the socket over which all |
291 // QUIC packets are sent. This default socket can change, so do not store the | 292 // QUIC packets are sent. This default socket can change, so do not store the |
292 // returned socket. | 293 // returned socket. |
293 const DatagramClientSocket* GetDefaultSocket() const; | 294 const DatagramClientSocket* GetDefaultSocket() const; |
294 | 295 |
295 bool IsAuthorized(const std::string& hostname) override; | 296 bool IsAuthorized(const std::string& hostname) override; |
296 | 297 |
297 // Returns true if session has one ore more streams marked as non-migratable. | 298 // Returns true if session has one ore more streams marked as non-migratable. |
298 bool HasNonMigratableStreams() const; | 299 bool HasNonMigratableStreams() const; |
299 | 300 |
300 void HandlePromised(QuicStreamId associated_id, | 301 bool HandlePromised(QuicStreamId associated_id, |
301 QuicStreamId promised_id, | 302 QuicStreamId promised_id, |
302 const SpdyHeaderBlock& headers) override; | 303 const SpdyHeaderBlock& headers) override; |
303 | 304 |
304 void DeletePromised(QuicClientPromisedInfo* promised) override; | 305 void DeletePromised(QuicClientPromisedInfo* promised) override; |
305 | 306 |
306 void OnPushStreamTimedOut(QuicStreamId stream_id) override; | 307 void OnPushStreamTimedOut(QuicStreamId stream_id) override; |
307 | 308 |
| 309 void set_push_delegte(ServerPushDelegate* push_delegate) { |
| 310 push_delegate_ = push_delegate; |
| 311 } |
| 312 |
308 // Cancels the push if the push stream for |url| has not been claimed and is | 313 // Cancels the push if the push stream for |url| has not been claimed and is |
309 // still active. Otherwise, no-op. | 314 // still active. Otherwise, no-op. |
310 void CancelPush(const GURL& url); | 315 void CancelPush(const GURL& url); |
311 | 316 |
312 const LoadTimingInfo::ConnectTiming& GetConnectTiming(); | 317 const LoadTimingInfo::ConnectTiming& GetConnectTiming(); |
313 | 318 |
314 protected: | 319 protected: |
315 // QuicSession methods: | 320 // QuicSession methods: |
316 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; | 321 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; |
317 bool ShouldCreateOutgoingDynamicStream() override; | 322 bool ShouldCreateOutgoingDynamicStream() override; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 NetLogWithSource net_log_; | 383 NetLogWithSource net_log_; |
379 std::vector<std::unique_ptr<QuicChromiumPacketReader>> packet_readers_; | 384 std::vector<std::unique_ptr<QuicChromiumPacketReader>> packet_readers_; |
380 LoadTimingInfo::ConnectTiming connect_timing_; | 385 LoadTimingInfo::ConnectTiming connect_timing_; |
381 std::unique_ptr<QuicConnectionLogger> logger_; | 386 std::unique_ptr<QuicConnectionLogger> logger_; |
382 // True when the session is going away, and streams may no longer be created | 387 // True when the session is going away, and streams may no longer be created |
383 // on this session. Existing stream will continue to be processed. | 388 // on this session. Existing stream will continue to be processed. |
384 bool going_away_; | 389 bool going_away_; |
385 // True when the session receives a go away from server due to port migration. | 390 // True when the session receives a go away from server due to port migration. |
386 bool port_migration_detected_; | 391 bool port_migration_detected_; |
387 TokenBindingSignatureMap token_binding_signatures_; | 392 TokenBindingSignatureMap token_binding_signatures_; |
| 393 // Not owned. |push_delegate_| outlives the session and handles server pushes |
| 394 // received by session. |
| 395 ServerPushDelegate* push_delegate_; |
388 // UMA histogram counters for streams pushed to this session. | 396 // UMA histogram counters for streams pushed to this session. |
389 int streams_pushed_count_; | 397 int streams_pushed_count_; |
390 int streams_pushed_and_claimed_count_; | 398 int streams_pushed_and_claimed_count_; |
391 uint64_t bytes_pushed_count_; | 399 uint64_t bytes_pushed_count_; |
392 uint64_t bytes_pushed_and_unclaimed_count_; | 400 uint64_t bytes_pushed_and_unclaimed_count_; |
393 // Stores packet that witnesses socket write error. This packet is | 401 // Stores packet that witnesses socket write error. This packet is |
394 // written to a new socket after migration completes. | 402 // written to a new socket after migration completes. |
395 scoped_refptr<StringIOBuffer> packet_; | 403 scoped_refptr<StringIOBuffer> packet_; |
396 // TODO(jri): Replace use of migration_pending_ sockets_.size(). | 404 // TODO(jri): Replace use of migration_pending_ sockets_.size(). |
397 // When a task is posted for MigrateSessionOnError, pass in | 405 // When a task is posted for MigrateSessionOnError, pass in |
398 // sockets_.size(). Then in MigrateSessionOnError, check to see if | 406 // sockets_.size(). Then in MigrateSessionOnError, check to see if |
399 // the current sockets_.size() == the passed in value. | 407 // the current sockets_.size() == the passed in value. |
400 bool migration_pending_; // True while migration is underway. | 408 bool migration_pending_; // True while migration is underway. |
401 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 409 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
402 | 410 |
403 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 411 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
404 }; | 412 }; |
405 | 413 |
406 } // namespace net | 414 } // namespace net |
407 | 415 |
408 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 416 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |