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

Unified Diff: content/browser/cache_storage/cache_storage_cache.cc

Issue 2858133002: Add uma stats to help evaluate the impact of changes to the quota allocation logic. (Closed)
Patch Set: macros Created 3 years, 7 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
Index: content/browser/cache_storage/cache_storage_cache.cc
diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc
index 9a4a02e6d224190a8c369e2aee3a28709ca1bc34..a120339b5d9c1bccf7d60979c248d805a032b29f 100644
--- a/content/browser/cache_storage/cache_storage_cache.cc
+++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -38,6 +38,7 @@
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/blob/blob_url_request_job_factory.h"
#include "storage/browser/quota/quota_manager_proxy.h"
+#include "storage/common/storage_histograms.h"
#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerResponseType.h"
namespace content {
@@ -47,6 +48,8 @@ namespace {
const size_t kMaxQueryCacheResultBytes =
1024 * 1024 * 10; // 10MB query cache limit
+const char kRecordBytesLabel[] = "DiskCache.CacheStorage";
+
// This class ensures that the cache and the entry have a lifetime as long as
// the blob that is created to contain them.
class CacheStorageCacheDataHandle
@@ -185,6 +188,9 @@ void ReadMetadataDidReadMetadata(disk_cache::Entry* entry,
return;
}
+ if (rv > 0)
+ storage::RecordBytesRead(kRecordBytesLabel, rv);
+
std::unique_ptr<proto::CacheMetadata> metadata(new proto::CacheMetadata());
if (!metadata->ParseFromArray(buffer->data(), buffer->size())) {
@@ -1002,6 +1008,9 @@ void CacheStorageCache::WriteSideDataDidWrite(const ErrorCallback& callback,
return;
}
+ if (rv > 0)
+ storage::RecordBytesWritten(kRecordBytesLabel, rv);
+
UpdateCacheSize(base::Bind(callback, CACHE_STORAGE_OK));
}
@@ -1173,6 +1182,9 @@ void CacheStorageCache::PutDidWriteHeaders(
return;
}
+ if (rv > 0)
+ storage::RecordBytesWritten(kRecordBytesLabel, rv);
+
// The metadata is written, now for the response content. The data is streamed
// from the blob into the cache entry.

Powered by Google App Engine
This is Rietveld 408576698