| 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 #include "net/quic/chromium/quic_chromium_client_session.h" | 5 #include "net/quic/chromium/quic_chromium_client_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 return ERR_FAILED; | 663 return ERR_FAILED; |
| 664 token_binding_signatures_.Put(std::make_pair(tb_type, raw_public_key), *out); | 664 token_binding_signatures_.Put(std::make_pair(tb_type, raw_public_key), *out); |
| 665 return OK; | 665 return OK; |
| 666 } | 666 } |
| 667 | 667 |
| 668 int QuicChromiumClientSession::CryptoConnect( | 668 int QuicChromiumClientSession::CryptoConnect( |
| 669 const CompletionCallback& callback) { | 669 const CompletionCallback& callback) { |
| 670 connect_timing_.connect_start = base::TimeTicks::Now(); | 670 connect_timing_.connect_start = base::TimeTicks::Now(); |
| 671 RecordHandshakeState(STATE_STARTED); | 671 RecordHandshakeState(STATE_STARTED); |
| 672 DCHECK(flow_controller()); | 672 DCHECK(flow_controller()); |
| 673 crypto_stream_->CryptoConnect(); | |
| 674 | 673 |
| 675 // Check if the connection is still open, issues during CryptoConnect like | 674 if (!crypto_stream_->CryptoConnect()) |
| 676 // packet write error could cause the connection to be torn down. | |
| 677 if (!connection()->connected()) | |
| 678 return ERR_QUIC_HANDSHAKE_FAILED; | 675 return ERR_QUIC_HANDSHAKE_FAILED; |
| 679 | 676 |
| 680 if (IsCryptoHandshakeConfirmed()) { | 677 if (IsCryptoHandshakeConfirmed()) { |
| 681 connect_timing_.connect_end = base::TimeTicks::Now(); | 678 connect_timing_.connect_end = base::TimeTicks::Now(); |
| 682 return OK; | 679 return OK; |
| 683 } | 680 } |
| 684 | 681 |
| 685 // Unless we require handshake confirmation, activate the session if | 682 // Unless we require handshake confirmation, activate the session if |
| 686 // we have established initial encryption. | 683 // we have established initial encryption. |
| 687 if (!require_confirmation_ && IsEncryptionEstablished()) | 684 if (!require_confirmation_ && IsEncryptionEstablished()) |
| 688 return OK; | 685 return OK; |
| 689 | 686 |
| 690 callback_ = callback; | 687 callback_ = callback; |
| 691 return ERR_IO_PENDING; | 688 return ERR_IO_PENDING; |
| 692 } | 689 } |
| 693 | 690 |
| 694 int QuicChromiumClientSession::ResumeCryptoConnect( | |
| 695 const CompletionCallback& callback) { | |
| 696 if (IsCryptoHandshakeConfirmed()) { | |
| 697 connect_timing_.connect_end = base::TimeTicks::Now(); | |
| 698 return OK; | |
| 699 } | |
| 700 | |
| 701 if (!connection()->connected()) | |
| 702 return ERR_QUIC_HANDSHAKE_FAILED; | |
| 703 | |
| 704 callback_ = callback; | |
| 705 return ERR_IO_PENDING; | |
| 706 } | |
| 707 | |
| 708 int QuicChromiumClientSession::GetNumSentClientHellos() const { | 691 int QuicChromiumClientSession::GetNumSentClientHellos() const { |
| 709 return crypto_stream_->num_sent_client_hellos(); | 692 return crypto_stream_->num_sent_client_hellos(); |
| 710 } | 693 } |
| 711 | 694 |
| 712 QuicStreamId QuicChromiumClientSession::GetStreamIdForPush( | 695 QuicStreamId QuicChromiumClientSession::GetStreamIdForPush( |
| 713 const GURL& pushed_url) { | 696 const GURL& pushed_url) { |
| 714 QuicClientPromisedInfo* promised_info = | 697 QuicClientPromisedInfo* promised_info = |
| 715 QuicClientSessionBase::GetPromisedByUrl(pushed_url.spec()); | 698 QuicClientSessionBase::GetPromisedByUrl(pushed_url.spec()); |
| 716 if (!promised_info) | 699 if (!promised_info) |
| 717 return 0; | 700 return 0; |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 } | 1509 } |
| 1527 | 1510 |
| 1528 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { | 1511 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { |
| 1529 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's | 1512 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's |
| 1530 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and | 1513 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and |
| 1531 // unacked packet map. | 1514 // unacked packet map. |
| 1532 return base::trace_event::EstimateMemoryUsage(packet_readers_); | 1515 return base::trace_event::EstimateMemoryUsage(packet_readers_); |
| 1533 } | 1516 } |
| 1534 | 1517 |
| 1535 } // namespace net | 1518 } // namespace net |
| OLD | NEW |