| Index: net/quic/core/crypto/properties_based_quic_server_info.cc
|
| diff --git a/net/quic/core/crypto/properties_based_quic_server_info.cc b/net/quic/core/crypto/properties_based_quic_server_info.cc
|
| index 6fd9b2418a43eac10c7fe989cc3fcb6fa194f01f..0ab4f6cef1a4c9f5709484eea4eb69052ee8ce0a 100644
|
| --- a/net/quic/core/crypto/properties_based_quic_server_info.cc
|
| +++ b/net/quic/core/crypto/properties_based_quic_server_info.cc
|
| @@ -5,11 +5,29 @@
|
| #include "net/quic/core/crypto/properties_based_quic_server_info.h"
|
|
|
| #include "base/base64.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/http/http_server_properties.h"
|
|
|
| using std::string;
|
|
|
| +namespace {
|
| +
|
| +void RecordQuicServerInfoStatus(
|
| + net::QuicServerInfo::QuicServerInfoAPICall call) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Net.QuicDiskCache.APICall.PropertiesBasedCache", call,
|
| + net::QuicServerInfo::QUIC_SERVER_INFO_NUM_OF_API_CALLS);
|
| +}
|
| +
|
| +void RecordQuicServerInfoFailure(net::QuicServerInfo::FailureReason failure) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Net.QuicDiskCache.FailureReason.PropertiesBasedCache", failure,
|
| + net::QuicServerInfo::NUM_OF_FAILURES);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace net {
|
|
|
| PropertiesBasedQuicServerInfo::PropertiesBasedQuicServerInfo(
|
| @@ -22,37 +40,58 @@ PropertiesBasedQuicServerInfo::PropertiesBasedQuicServerInfo(
|
|
|
| PropertiesBasedQuicServerInfo::~PropertiesBasedQuicServerInfo() {}
|
|
|
| -void PropertiesBasedQuicServerInfo::Start() {}
|
| +void PropertiesBasedQuicServerInfo::Start() {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_START);
|
| +}
|
|
|
| int PropertiesBasedQuicServerInfo::WaitForDataReady(
|
| const CompletionCallback& callback) {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_WAIT_FOR_DATA_READY);
|
| const string* data = http_server_properties_->GetQuicServerInfo(server_id_);
|
| string decoded;
|
| - if (!data || !base::Base64Decode(*data, &decoded) || !Parse(decoded)) {
|
| + if (!data) {
|
| + RecordQuicServerInfoFailure(PARSE_NO_DATA_FAILURE);
|
| + return ERR_FAILED;
|
| + }
|
| + if (!base::Base64Decode(*data, &decoded)) {
|
| + RecordQuicServerInfoFailure(PARSE_DATA_DECODE_FAILURE);
|
| + return ERR_FAILED;
|
| + }
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_PARSE);
|
| + if (!Parse(decoded)) {
|
| + RecordQuicServerInfoFailure(PARSE_FAILURE);
|
| return ERR_FAILED;
|
| }
|
| return OK;
|
| }
|
|
|
| -void PropertiesBasedQuicServerInfo::ResetWaitForDataReadyCallback() {}
|
| +void PropertiesBasedQuicServerInfo::ResetWaitForDataReadyCallback() {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_RESET_WAIT_FOR_DATA_READY);
|
| +}
|
|
|
| -void PropertiesBasedQuicServerInfo::CancelWaitForDataReadyCallback() {}
|
| +void PropertiesBasedQuicServerInfo::CancelWaitForDataReadyCallback() {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL);
|
| +}
|
|
|
| bool PropertiesBasedQuicServerInfo::IsDataReady() {
|
| return true;
|
| }
|
|
|
| bool PropertiesBasedQuicServerInfo::IsReadyToPersist() {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_READY_TO_PERSIST);
|
| return true;
|
| }
|
|
|
| void PropertiesBasedQuicServerInfo::Persist() {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_PERSIST);
|
| string encoded;
|
| base::Base64Encode(Serialize(), &encoded);
|
| http_server_properties_->SetQuicServerInfo(server_id_, encoded);
|
| }
|
|
|
| -void PropertiesBasedQuicServerInfo::OnExternalCacheHit() {}
|
| +void PropertiesBasedQuicServerInfo::OnExternalCacheHit() {
|
| + RecordQuicServerInfoStatus(QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT);
|
| +}
|
|
|
| PropertiesBasedQuicServerInfoFactory::PropertiesBasedQuicServerInfoFactory(
|
| HttpServerProperties* http_server_properties)
|
|
|