Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: net/quic/quic_crypto_client_stream.cc

Issue 189963002: QUIC - histograms to measure the time spent to read QUIC sever (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added TODO to use host:port to access QUIC server information Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "net/base/completion_callback.h" 8 #include "net/base/completion_callback.h"
8 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
9 #include "net/quic/crypto/crypto_protocol.h" 10 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/crypto_utils.h" 11 #include "net/quic/crypto/crypto_utils.h"
11 #include "net/quic/crypto/null_encrypter.h" 12 #include "net/quic/crypto/null_encrypter.h"
12 #include "net/quic/crypto/proof_verifier.h" 13 #include "net/quic/crypto/proof_verifier.h"
13 #include "net/quic/crypto/proof_verifier_chromium.h" 14 #include "net/quic/crypto/proof_verifier_chromium.h"
14 #include "net/quic/crypto/quic_server_info.h" 15 #include "net/quic/crypto/quic_server_info.h"
15 #include "net/quic/quic_protocol.h" 16 #include "net/quic/quic_protocol.h"
16 #include "net/quic/quic_session.h" 17 #include "net/quic/quic_session.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 416 }
416 417
417 int QuicCryptoClientStream::DoLoadQuicServerInfo( 418 int QuicCryptoClientStream::DoLoadQuicServerInfo(
418 QuicCryptoClientConfig::CachedState* cached) { 419 QuicCryptoClientConfig::CachedState* cached) {
419 next_state_ = STATE_SEND_CHLO; 420 next_state_ = STATE_SEND_CHLO;
420 QuicServerInfo* quic_server_info = cached->quic_server_info(); 421 QuicServerInfo* quic_server_info = cached->quic_server_info();
421 if (!quic_server_info) { 422 if (!quic_server_info) {
422 return OK; 423 return OK;
423 } 424 }
424 425
426 read_start_time_ = base::TimeTicks::Now();
425 generation_counter_ = cached->generation_counter(); 427 generation_counter_ = cached->generation_counter();
426 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE; 428 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE;
427 429
428 // TODO(rtenneti): If multiple tabs load the same URL, all requests except for 430 // TODO(rtenneti): Use host:port to access QUIC server information from disk
429 // the first request send InchoateClientHello. Fix the code to handle multiple 431 // cache. If multiple tabs load URLs with same hostname but different
430 // requests. A possible solution is to wait for the first request to finish 432 // ports, all requests except for the first request send InchoateClientHello.
431 // and use the data from the disk cache for all requests. 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
435 // all requests.
432 // We may need to call quic_server_info->Persist later. 436 // We may need to call quic_server_info->Persist later.
433 // quic_server_info->Persist requires quic_server_info to be ready, so we 437 // quic_server_info->Persist requires quic_server_info to be ready, so we
434 // always call WaitForDataReady, even though we might have initialized 438 // always call WaitForDataReady, even though we might have initialized
435 // |cached| config from the cached state for a canonical hostname. 439 // |cached| config from the cached state for a canonical hostname.
436 int rv = quic_server_info->WaitForDataReady( 440 int rv = quic_server_info->WaitForDataReady(
437 base::Bind(&QuicCryptoClientStream::OnIOComplete, 441 base::Bind(&QuicCryptoClientStream::OnIOComplete,
438 weak_factory_.GetWeakPtr())); 442 weak_factory_.GetWeakPtr()));
439 443
440 if (rv != ERR_IO_PENDING) { 444 if (rv != ERR_IO_PENDING) {
441 disk_cache_load_result_ = rv; 445 disk_cache_load_result_ = rv;
(...skipping 12 matching lines...) Expand all
454 QuicCryptoClientConfig::CachedState* cached) { 458 QuicCryptoClientConfig::CachedState* cached) {
455 next_state_ = STATE_SEND_CHLO; 459 next_state_ = STATE_SEND_CHLO;
456 460
457 // 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
458 // 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
459 // cached->IsEmpty() is true), we still want to load from QuicServerInfo. 463 // cached->IsEmpty() is true), we still want to load from QuicServerInfo.
460 if (!cached->IsEmpty()) { 464 if (!cached->IsEmpty()) {
461 return; 465 return;
462 } 466 }
463 467
468 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheReadTime",
469 base::TimeTicks::Now() - read_start_time_);
470
464 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo( 471 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo(
465 session()->connection()->clock()->WallNow())) { 472 session()->connection()->clock()->WallNow())) {
466 // 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
467 // from the disk cache. 474 // from the disk cache.
468 DCHECK(cached->IsEmpty()); 475 DCHECK(cached->IsEmpty());
469 DVLOG(1) << "Empty server_config"; 476 DVLOG(1) << "Empty server_config";
470 return; 477 return;
471 } 478 }
472 479
473 ProofVerifier* verifier = crypto_config_->proof_verifier(); 480 ProofVerifier* verifier = crypto_config_->proof_verifier();
474 if (!verifier) { 481 if (!verifier) {
475 // 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.
476 cached->SetProofValid(); 483 cached->SetProofValid();
477 } else if (!cached->signature().empty()) { 484 } else if (!cached->signature().empty()) {
478 next_state_ = STATE_VERIFY_PROOF; 485 next_state_ = STATE_VERIFY_PROOF;
479 } 486 }
480 } 487 }
481 488
482 } // namespace net 489 } // namespace net
OLDNEW
« net/quic/quic_crypto_client_stream.h ('K') | « net/quic/quic_crypto_client_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698