Index: net/quic/chromium/properties_based_quic_server_info.cc |
diff --git a/net/quic/chromium/properties_based_quic_server_info.cc b/net/quic/chromium/properties_based_quic_server_info.cc |
index 54d1b6da93f0b4efbd13261fdf0d7ea33d742427..e90331fd7c179cedb44037cf440c18b1e31cedf3 100644 |
--- a/net/quic/chromium/properties_based_quic_server_info.cc |
+++ b/net/quic/chromium/properties_based_quic_server_info.cc |
@@ -13,6 +13,13 @@ |
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( |
@@ -34,33 +41,74 @@ |
PropertiesBasedQuicServerInfo::~PropertiesBasedQuicServerInfo() {} |
-bool PropertiesBasedQuicServerInfo::Load() { |
+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) { |
RecordQuicServerInfoFailure(PARSE_NO_DATA_FAILURE); |
- return false; |
+ return ERR_FAILED; |
} |
if (!base::Base64Decode(*data, &decoded)) { |
RecordQuicServerInfoFailure(PARSE_DATA_DECODE_FAILURE); |
- return false; |
+ return ERR_FAILED; |
} |
+ RecordQuicServerInfoStatus(QUIC_SERVER_INFO_PARSE); |
if (!Parse(decoded)) { |
RecordQuicServerInfoFailure(PARSE_FAILURE); |
- return false; |
+ return ERR_FAILED; |
} |
+ return OK; |
+} |
+ |
+void PropertiesBasedQuicServerInfo::ResetWaitForDataReadyCallback() { |
+ RecordQuicServerInfoStatus(QUIC_SERVER_INFO_RESET_WAIT_FOR_DATA_READY); |
+} |
+ |
+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() { |
+ RecordQuicServerInfoStatus(QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT); |
} |
size_t PropertiesBasedQuicServerInfo::EstimateMemoryUsage() const { |
return 0; |
} |
+PropertiesBasedQuicServerInfoFactory::PropertiesBasedQuicServerInfoFactory( |
+ HttpServerProperties* http_server_properties) |
+ : http_server_properties_(http_server_properties) {} |
+ |
+PropertiesBasedQuicServerInfoFactory::~PropertiesBasedQuicServerInfoFactory() {} |
+ |
+std::unique_ptr<QuicServerInfo> |
+PropertiesBasedQuicServerInfoFactory::GetForServer( |
+ const QuicServerId& server_id) { |
+ return base::MakeUnique<PropertiesBasedQuicServerInfo>( |
+ server_id, http_server_properties_); |
+} |
+ |
} // namespace net |