Chromium Code Reviews| 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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/quic/crypto/crypto_protocol.h" | 10 #include "net/quic/crypto/crypto_protocol.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 } | 416 } |
| 417 | 417 |
| 418 int QuicCryptoClientStream::DoLoadQuicServerInfo( | 418 int QuicCryptoClientStream::DoLoadQuicServerInfo( |
| 419 QuicCryptoClientConfig::CachedState* cached) { | 419 QuicCryptoClientConfig::CachedState* cached) { |
| 420 next_state_ = STATE_SEND_CHLO; | 420 next_state_ = STATE_SEND_CHLO; |
| 421 QuicServerInfo* quic_server_info = cached->quic_server_info(); | 421 QuicServerInfo* quic_server_info = cached->quic_server_info(); |
| 422 if (!quic_server_info) { | 422 if (!quic_server_info) { |
| 423 return OK; | 423 return OK; |
| 424 } | 424 } |
| 425 | 425 |
| 426 read_start_time_ = base::TimeTicks::Now(); | 426 disk_cache_load_start_time_ = base::TimeTicks::Now(); |
| 427 generation_counter_ = cached->generation_counter(); | 427 generation_counter_ = cached->generation_counter(); |
| 428 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE; | 428 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE; |
| 429 | 429 |
| 430 // TODO(rtenneti): Use host:port to access QUIC server information from disk | 430 // TODO(rtenneti): Use host:port to access QUIC server information from disk |
| 431 // cache. If multiple tabs load URLs with same hostname but different | 431 // cache. If multiple tabs load URLs with same hostname but different |
| 432 // ports, all requests except for the first request send InchoateClientHello. | 432 // ports, all requests except for the first request send InchoateClientHello. |
| 433 // Fix the code to handle multiple requests. A possible solution is to wait | 433 // Fix the code to handle multiple requests. A possible solution is to wait |
| 434 // for the first request to finish and use the data from the disk cache for | 434 // for the first request to finish and use the data from the disk cache for |
| 435 // all requests. | 435 // all requests. |
| 436 // We may need to call quic_server_info->Persist later. | 436 // We may need to call quic_server_info->Persist later. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 458 QuicCryptoClientConfig::CachedState* cached) { | 458 QuicCryptoClientConfig::CachedState* cached) { |
| 459 next_state_ = STATE_SEND_CHLO; | 459 next_state_ = STATE_SEND_CHLO; |
| 460 | 460 |
| 461 // If someone else already saved a server config, we don't want to overwrite | 461 // If someone else already saved a server config, we don't want to overwrite |
| 462 // it. Also, if someone else saved a server config and then cleared it (so | 462 // it. Also, if someone else saved a server config and then cleared it (so |
| 463 // cached->IsEmpty() is true), we still want to load from QuicServerInfo. | 463 // cached->IsEmpty() is true), we still want to load from QuicServerInfo. |
| 464 if (!cached->IsEmpty()) { | 464 if (!cached->IsEmpty()) { |
| 465 return; | 465 return; |
| 466 } | 466 } |
| 467 | 467 |
| 468 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheReadTime", | 468 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheLoadTime", |
|
wtc
2014/03/10 21:54:55
IMPORTANT: we probably should not rename the histo
ramant (doing other things)
2014/03/10 22:02:08
Done.
| |
| 469 base::TimeTicks::Now() - read_start_time_); | 469 base::TimeTicks::Now() - disk_cache_load_start_time_); |
| 470 | 470 |
| 471 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo( | 471 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo( |
| 472 session()->connection()->clock()->WallNow())) { | 472 session()->connection()->clock()->WallNow())) { |
| 473 // It is ok to proceed to STATE_SEND_CHLO when we cannot load QuicServerInfo | 473 // It is ok to proceed to STATE_SEND_CHLO when we cannot load QuicServerInfo |
| 474 // from the disk cache. | 474 // from the disk cache. |
| 475 DCHECK(cached->IsEmpty()); | 475 DCHECK(cached->IsEmpty()); |
| 476 DVLOG(1) << "Empty server_config"; | 476 DVLOG(1) << "Empty server_config"; |
| 477 return; | 477 return; |
| 478 } | 478 } |
| 479 | 479 |
| 480 ProofVerifier* verifier = crypto_config_->proof_verifier(); | 480 ProofVerifier* verifier = crypto_config_->proof_verifier(); |
| 481 if (!verifier) { | 481 if (!verifier) { |
| 482 // If no verifier is set then we don't check the certificates. | 482 // If no verifier is set then we don't check the certificates. |
| 483 cached->SetProofValid(); | 483 cached->SetProofValid(); |
| 484 } else if (!cached->signature().empty()) { | 484 } else if (!cached->signature().empty()) { |
| 485 next_state_ = STATE_VERIFY_PROOF; | 485 next_state_ = STATE_VERIFY_PROOF; |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace net | 489 } // namespace net |
| OLD | NEW |