| 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/quic_crypto_client_stream.h" | 5 #include "net/quic/quic_crypto_client_stream.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 251 } |
| 252 | 252 |
| 253 void QuicCryptoClientStream::DoInitialize( | 253 void QuicCryptoClientStream::DoInitialize( |
| 254 QuicCryptoClientConfig::CachedState* cached) { | 254 QuicCryptoClientConfig::CachedState* cached) { |
| 255 if (!cached->IsEmpty() && !cached->signature().empty()) { | 255 if (!cached->IsEmpty() && !cached->signature().empty()) { |
| 256 // Note that we verify the proof even if the cached proof is valid. | 256 // Note that we verify the proof even if the cached proof is valid. |
| 257 // This allows us to respond to CA trust changes or certificate | 257 // This allows us to respond to CA trust changes or certificate |
| 258 // expiration because it may have been a while since we last verified | 258 // expiration because it may have been a while since we last verified |
| 259 // the proof. | 259 // the proof. |
| 260 DCHECK(crypto_config_->proof_verifier()); | 260 DCHECK(crypto_config_->proof_verifier()); |
| 261 // Track proof verification time when cached server config is used. |
| 262 proof_verify_start_time_ = base::TimeTicks::Now(); |
| 261 // If the cached state needs to be verified, do it now. | 263 // If the cached state needs to be verified, do it now. |
| 262 next_state_ = STATE_VERIFY_PROOF; | 264 next_state_ = STATE_VERIFY_PROOF; |
| 263 } else { | 265 } else { |
| 264 next_state_ = STATE_GET_CHANNEL_ID; | 266 next_state_ = STATE_GET_CHANNEL_ID; |
| 265 } | 267 } |
| 266 } | 268 } |
| 267 | 269 |
| 268 void QuicCryptoClientStream::DoSendCHLO( | 270 void QuicCryptoClientStream::DoSendCHLO( |
| 269 QuicCryptoClientConfig::CachedState* cached) { | 271 QuicCryptoClientConfig::CachedState* cached) { |
| 270 if (stateless_reject_received_) { | 272 if (stateless_reject_received_) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 case QUIC_SUCCESS: | 475 case QUIC_SUCCESS: |
| 474 delete proof_verify_callback; | 476 delete proof_verify_callback; |
| 475 verify_ok_ = true; | 477 verify_ok_ = true; |
| 476 break; | 478 break; |
| 477 } | 479 } |
| 478 return status; | 480 return status; |
| 479 } | 481 } |
| 480 | 482 |
| 481 void QuicCryptoClientStream::DoVerifyProofComplete( | 483 void QuicCryptoClientStream::DoVerifyProofComplete( |
| 482 QuicCryptoClientConfig::CachedState* cached) { | 484 QuicCryptoClientConfig::CachedState* cached) { |
| 485 if (!proof_verify_start_time_.is_null()) { |
| 486 UMA_HISTOGRAM_TIMES("Net.QuicSession.VerifyProofTime.CachedServerConfig", |
| 487 base::TimeTicks::Now() - proof_verify_start_time_); |
| 488 } |
| 483 if (!verify_ok_) { | 489 if (!verify_ok_) { |
| 484 if (verify_details_.get()) { | 490 if (verify_details_.get()) { |
| 485 client_session()->OnProofVerifyDetailsAvailable(*verify_details_); | 491 client_session()->OnProofVerifyDetailsAvailable(*verify_details_); |
| 486 } | 492 } |
| 487 if (num_client_hellos_ == 0) { | 493 if (num_client_hellos_ == 0) { |
| 488 cached->Clear(); | 494 cached->Clear(); |
| 489 next_state_ = STATE_INITIALIZE; | 495 next_state_ = STATE_INITIALIZE; |
| 490 return; | 496 return; |
| 491 } | 497 } |
| 492 next_state_ = STATE_NONE; | 498 next_state_ = STATE_NONE; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 676 } |
| 671 } | 677 } |
| 672 return false; | 678 return false; |
| 673 } | 679 } |
| 674 | 680 |
| 675 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 681 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
| 676 return reinterpret_cast<QuicClientSessionBase*>(session()); | 682 return reinterpret_cast<QuicClientSessionBase*>(session()); |
| 677 } | 683 } |
| 678 | 684 |
| 679 } // namespace net | 685 } // namespace net |
| OLD | NEW |