Index: net/http/disk_cache_based_quic_server_info.cc |
diff --git a/net/http/disk_cache_based_quic_server_info.cc b/net/http/disk_cache_based_quic_server_info.cc |
index 13c53b7f2679bad8478ae2ccf4aebe0f38740244..51943cdf61767739b72ae04612f8ed0a7d1e7986 100644 |
--- a/net/http/disk_cache_based_quic_server_info.cc |
+++ b/net/http/disk_cache_based_quic_server_info.cc |
@@ -7,6 +7,7 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
#include "base/logging.h" |
+#include "base/metrics/histogram.h" |
#include "net/base/completion_callback.h" |
#include "net/base/io_buffer.h" |
#include "net/base/net_errors.h" |
@@ -16,6 +17,18 @@ |
namespace net { |
+// Histogram for tracking down the state of disk_cache::Entry. |
+enum DiskCacheEntryState { |
+ DISK_CACHE_ENTRY_OPENED = 0, |
+ DISK_CACHE_ENTRY_CLOSED = 1, |
+ DISK_CACHE_ENTRY_NUM_STATES = 2, |
+}; |
+ |
+void RecordDiskCacheEntryState(DiskCacheEntryState entry_state) { |
+ UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.EntryState", entry_state, |
+ DISK_CACHE_ENTRY_NUM_STATES); |
+} |
+ |
// Some APIs inside disk_cache take a handle that the caller must keep alive |
// until the API has finished its asynchronous execution. |
// |
@@ -115,8 +128,10 @@ void DiskCacheBasedQuicServerInfo::Persist() { |
DiskCacheBasedQuicServerInfo::~DiskCacheBasedQuicServerInfo() { |
DCHECK(user_callback_.is_null()); |
- if (entry_) |
+ if (entry_) { |
entry_->Close(); |
+ RecordDiskCacheEntryState(DISK_CACHE_ENTRY_CLOSED); |
+ } |
} |
std::string DiskCacheBasedQuicServerInfo::key() const { |
@@ -197,6 +212,7 @@ int DiskCacheBasedQuicServerInfo::DoOpenComplete(int rv) { |
entry_ = data_shim_->entry; |
state_ = READ; |
found_entry_ = true; |
+ RecordDiskCacheEntryState(DISK_CACHE_ENTRY_OPENED); |
} else { |
state_ = WAIT_FOR_DATA_READY_DONE; |
} |
@@ -223,8 +239,11 @@ int DiskCacheBasedQuicServerInfo::DoCreateOrOpenComplete(int rv) { |
if (rv != OK) { |
state_ = SET_DONE; |
} else { |
- if (!entry_) |
+ if (!entry_) { |
entry_ = data_shim_->entry; |
+ RecordDiskCacheEntryState(DISK_CACHE_ENTRY_OPENED); |
+ } |
+ DCHECK(entry_); |
state_ = WRITE; |
} |
return OK; |
@@ -284,16 +303,20 @@ int DiskCacheBasedQuicServerInfo::DoWaitForDataReadyDone() { |
ready_ = true; |
// We close the entry because, if we shutdown before ::Persist is called, |
// then we might leak a cache reference, which causes a DCHECK on shutdown. |
- if (entry_) |
+ if (entry_) { |
entry_->Close(); |
+ RecordDiskCacheEntryState(DISK_CACHE_ENTRY_CLOSED); |
+ } |
entry_ = NULL; |
Parse(data_); |
return OK; |
} |
int DiskCacheBasedQuicServerInfo::DoSetDone() { |
- if (entry_) |
+ if (entry_) { |
entry_->Close(); |
+ RecordDiskCacheEntryState(DISK_CACHE_ENTRY_CLOSED); |
+ } |
entry_ = NULL; |
new_data_.clear(); |
state_ = NONE; |