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

Unified Diff: content/browser/appcache/appcache_response.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/appcache/appcache_response.cc
diff --git a/content/browser/appcache/appcache_response.cc b/content/browser/appcache/appcache_response.cc
index e85ea5fb2a77f91efc8445e1f9bb87d06c54c1d3..7a33785f283dc3516985156c21df3120c6ab643d 100644
--- a/content/browser/appcache/appcache_response.cc
+++ b/content/browser/appcache/appcache_response.cc
@@ -20,6 +20,7 @@
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
+#include "storage/common/storage_histograms.h"
namespace content {
@@ -80,8 +81,8 @@ HttpResponseInfoIOBuffer::~HttpResponseInfoIOBuffer() {}
// AppCacheDiskCacheInterface ----------------------------------------
-AppCacheDiskCacheInterface::AppCacheDiskCacheInterface()
- : weak_factory_(this) {}
+AppCacheDiskCacheInterface::AppCacheDiskCacheInterface(const char* uma_name)
+ : uma_name_(uma_name), weak_factory_(this) {}
base::WeakPtr<AppCacheDiskCacheInterface>
AppCacheDiskCacheInterface::GetWeakPtr() {
@@ -293,7 +294,10 @@ void AppCacheResponseReader::OnIOComplete(int result) {
read_position_ += result;
}
}
+ if (result > 0 && disk_cache_)
+ storage::RecordBytesRead(disk_cache_->uma_name(), result);
InvokeUserCompletionCallback(result);
+ // Note: |this| may have been deleted by the completion callback.
}
void AppCacheResponseReader::OnOpenEntryComplete() {
@@ -385,7 +389,10 @@ void AppCacheResponseWriter::OnIOComplete(int result) {
else
info_size_ = result;
}
+ if (result > 0 && disk_cache_)
+ storage::RecordBytesWritten(disk_cache_->uma_name(), result);
InvokeUserCompletionCallback(result);
+ // Note: |this| may have been deleted by the completion callback.
}
void AppCacheResponseWriter::CreateEntryIfNeededAndContinue() {
@@ -489,7 +496,10 @@ void AppCacheResponseMetadataWriter::OnOpenEntryComplete() {
void AppCacheResponseMetadataWriter::OnIOComplete(int result) {
DCHECK(result < 0 || write_amount_ == result);
+ if (result > 0 && disk_cache_)
+ storage::RecordBytesWritten(disk_cache_->uma_name(), result);
InvokeUserCompletionCallback(result);
+ // Note: |this| may have been deleted by the completion callback.
}
} // namespace content
« no previous file with comments | « content/browser/appcache/appcache_response.h ('k') | content/browser/cache_storage/cache_storage_blob_to_disk_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698