Chromium Code Reviews| Index: content/browser/blob_storage/blob_dispatcher_host.cc |
| diff --git a/content/browser/blob_storage/blob_dispatcher_host.cc b/content/browser/blob_storage/blob_dispatcher_host.cc |
| index ba15620d8fec4d289beb2801fbf18baa2a56dbd9..1225398a93e9df201509ddd7a2708eb31db4bcaa 100644 |
| --- a/content/browser/blob_storage/blob_dispatcher_host.cc |
| +++ b/content/browser/blob_storage/blob_dispatcher_host.cc |
| @@ -7,6 +7,7 @@ |
| #include <algorithm> |
| #include "base/bind.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "content/browser/bad_message.h" |
| #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| #include "content/common/fileapi/webblob_messages.h" |
| @@ -24,6 +25,14 @@ using storage::BlobTransportResult; |
| using storage::IPCBlobCreationCancelCode; |
| namespace content { |
| +namespace { |
|
Mark P
2016/04/20 21:55:02
Add some blank lines in/around this new code.
dmurph
2016/04/20 22:04:51
Done.
|
| +// These are used for UMA stats, don't change. |
| +enum RefcountOperation { |
| + BDH_DECREMENT = 0, |
| + BDH_INCREMENT, |
| + BDH_TRACING_ENUM_LAST |
| +}; |
| +} |
| BlobDispatcherHost::BlobDispatcherHost( |
| ChromeBlobStorageContext* blob_storage_context) |
| @@ -209,6 +218,8 @@ void BlobDispatcherHost::OnIncrementBlobRefCount(const std::string& uuid) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| BlobStorageContext* context = this->context(); |
| if (uuid.empty() || !context->registry().HasEntry(uuid)) { |
| + UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidReference", BDH_INCREMENT, |
| + BDH_TRACING_ENUM_LAST); |
| bad_message::ReceivedBadMessage( |
| this, bad_message::BDH_INVALID_REFCOUNT_OPERATION); |
| return; |
| @@ -220,6 +231,8 @@ void BlobDispatcherHost::OnIncrementBlobRefCount(const std::string& uuid) { |
| void BlobDispatcherHost::OnDecrementBlobRefCount(const std::string& uuid) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| if (uuid.empty() || !IsInUseInHost(uuid)) { |
| + UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidReference", BDH_DECREMENT, |
| + BDH_TRACING_ENUM_LAST); |
| bad_message::ReceivedBadMessage( |
| this, bad_message::BDH_INVALID_REFCOUNT_OPERATION); |
| return; |
| @@ -249,6 +262,8 @@ void BlobDispatcherHost::OnRegisterPublicBlobURL(const GURL& public_url, |
| BlobStorageContext* context = this->context(); |
| if (uuid.empty() || !IsInUseInHost(uuid) || |
| context->registry().IsURLMapped(public_url)) { |
| + UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_INCREMENT, |
| + BDH_TRACING_ENUM_LAST); |
| bad_message::ReceivedBadMessage(this, |
| bad_message::BDH_INVALID_URL_OPERATION); |
| return; |
| @@ -260,6 +275,8 @@ void BlobDispatcherHost::OnRegisterPublicBlobURL(const GURL& public_url, |
| void BlobDispatcherHost::OnRevokePublicBlobURL(const GURL& public_url) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| if (!IsUrlRegisteredInHost(public_url)) { |
| + UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_DECREMENT, |
| + BDH_TRACING_ENUM_LAST); |
| bad_message::ReceivedBadMessage(this, |
| bad_message::BDH_INVALID_URL_OPERATION); |
| return; |