Commit a0037979 authored by dmurph's avatar dmurph Committed by Commit bot

[Blob] Added error reporting metrics to invalid message errors.

This helps us get to the bottom of where the invalid blob refcount
and url calls are. It's unclear whether these are new or if they've
always occurred, as we used to ignore these messages.

R=kinuko@chromium.org, mpearson@chromium.org
BUG=602443

Review URL: https://codereview.chromium.org/1893293006

Cr-Commit-Position: refs/heads/master@{#388626}
parent c3143813
......@@ -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,16 @@ using storage::BlobTransportResult;
using storage::IPCBlobCreationCancelCode;
namespace content {
namespace {
// These are used for UMA stats, don't change.
enum RefcountOperation {
BDH_DECREMENT = 0,
BDH_INCREMENT,
BDH_TRACING_ENUM_LAST
};
} // namespace
BlobDispatcherHost::BlobDispatcherHost(
ChromeBlobStorageContext* blob_storage_context)
......@@ -209,6 +220,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 +233,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 +264,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 +277,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;
......
......@@ -51639,6 +51639,24 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
<histogram name="Storage.Blob.InvalidReference" enum="RefcountOperation">
<owner>dmurph@chromium.org</owner>
<summary>
Counts the number of times we have an invalid refcount operation. An invalid
increment means the blob didn't exist, and an invalid decrement means we
don't have any record of the blob in our host.
</summary>
</histogram>
<histogram name="Storage.Blob.InvalidURLRegister" enum="RefcountOperation">
<owner>dmurph@chromium.org</owner>
<summary>
Counts the number of times we have an invalid url registration operation. An
invalid increment means the blob isn't in use by the host yet or the url is
already mapped. An invalid decrement means the url isn't registered.
</summary>
</histogram>
<histogram name="Storage.Blob.ItemCount" units="Blob Items">
<owner>dmurph@chromium.org</owner>
<summary>
......@@ -82017,6 +82035,11 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="9" label="DownloadError"/>
</enum>
<enum name="RefcountOperation" type="int">
<int value="0" label="Decrement"/>
<int value="1" label="Increment"/>
</enum>
<enum name="RemotePlaybackDeviceType" type="int">
<int value="0" label="Cast Generic Media Player"/>
<int value="1" label="Cast YouTube Player"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment