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

Unified Diff: net/http/disk_based_cert_cache.cc

Issue 356953003: Adding DiskBasedCertCache to HttpCache (+UMA). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@current
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_cache.h » ('j') | net/http/http_cache.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/disk_based_cert_cache.cc
diff --git a/net/http/disk_based_cert_cache.cc b/net/http/disk_based_cert_cache.cc
index b6c5b7e2731b5ede6215fefe0f2ffceba679f5e6..62e77aae15ada0841ffeb14abfd679826565af09 100644
--- a/net/http/disk_based_cert_cache.cc
+++ b/net/http/disk_based_cert_cache.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/memory/ref_counted.h"
+#include "base/metrics/histogram.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "net/base/io_buffer.h"
@@ -19,9 +20,17 @@ namespace net {
namespace {
+// TODO(brandonsalmon): remove when more data no longer needed.
+void RecordHistogram(int rv) {
+ bool already_existed = (rv < 0);
+ UMA_HISTOGRAM_BOOLEAN(
+ "DiskBasedCertCache.WritePreviouslyExisted", already_existed);
Ryan Sleevi 2014/06/26 19:56:02 You will need to update histograms.xml to ad this
brandonsalmon 2014/06/26 22:04:42 What do I need to do to update this? I tried and g
+}
+
// Used to obtain a unique cache key for a certificate in the form of
// "cert:<hash>".
-std::string GetCacheKeyToCert(const X509Certificate::OSCertHandle cert_handle) {
+std::string GetCacheKeyToCert(
+ const X509Certificate::OSCertHandle cert_handle) {
Ryan Sleevi 2014/06/26 19:56:02 Seems like this fit before - why the change?
SHA1HashValue fingerprint =
X509Certificate::CalculateFingerprint(cert_handle);
@@ -29,7 +38,7 @@ std::string GetCacheKeyToCert(const X509Certificate::OSCertHandle cert_handle) {
base::HexEncode(fingerprint.data, arraysize(fingerprint.data));
}
-} // namespace
+} // namespace
Ryan Sleevi 2014/06/26 19:56:02 This was correct the way it was before (two spaces
// WriteWorkers represent pending Set jobs in the DiskBasedCertCache. Each
// certificate requested to be cached is assigned a Writeworker on a one-to-one
@@ -191,6 +200,7 @@ int DiskBasedCertCache::WriteWorker::DoCreateComplete(int rv) {
// An error here usually signifies that the entry already exists.
// If this occurs, it is necessary to instead open the previously
// existing entry.
+ RecordHistogram(rv);
Ryan Sleevi 2014/06/26 19:56:02 Sanity check: What would you expect to use this in
brandonsalmon 2014/06/26 22:04:42 I added this because it seemed important to gather
if (rv < 0) {
state_ = STATE_OPEN;
return OK;
« no previous file with comments | « no previous file | net/http/http_cache.h » ('j') | net/http/http_cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698