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

Unified Diff: content/browser/indexed_db/indexed_db_transaction.cc

Issue 2903133002: [IndexedDB] Adding uma for transaction aborts (Closed)
Patch Set: comment 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
« no previous file with comments | « no previous file | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_transaction.cc
diff --git a/content/browser/indexed_db/indexed_db_transaction.cc b/content/browser/indexed_db/indexed_db_transaction.cc
index 904a284651a5220be85d53d13c6958292ac8756c..5fe8767263d41b14e068827d163a39eb32e1d5d1 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -8,6 +8,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -36,6 +37,41 @@ void CommitUnused(base::WeakPtr<IndexedDBTransaction> transaction) {
DCHECK(status.ok());
}
+// Used for UMA metrics - do not change values.
+enum UmaIDBException {
+ UmaIDBExceptionUnknownError = 0,
+ UmaIDBExceptionConstraintError = 1,
+ UmaIDBExceptionDataError = 2,
+ UmaIDBExceptionVersionError = 3,
+ UmaIDBExceptionAbortError = 4,
+ UmaIDBExceptionQuotaError = 5,
+ UmaIDBExceptionTimeoutError = 6,
+ UmaIDBExceptionExclusiveMaxValue = 7
+};
+
+// Used for UMA metrics - do not change mappings.
+UmaIDBException ExceptionCodeToUmaEnum(uint16_t code) {
+ switch (code) {
+ case blink::kWebIDBDatabaseExceptionUnknownError:
+ return UmaIDBExceptionUnknownError;
+ case blink::kWebIDBDatabaseExceptionConstraintError:
+ return UmaIDBExceptionConstraintError;
+ case blink::kWebIDBDatabaseExceptionDataError:
+ return UmaIDBExceptionDataError;
+ case blink::kWebIDBDatabaseExceptionVersionError:
+ return UmaIDBExceptionVersionError;
+ case blink::kWebIDBDatabaseExceptionAbortError:
+ return UmaIDBExceptionAbortError;
+ case blink::kWebIDBDatabaseExceptionQuotaError:
+ return UmaIDBExceptionQuotaError;
+ case blink::kWebIDBDatabaseExceptionTimeoutError:
+ return UmaIDBExceptionTimeoutError;
+ default:
+ NOTREACHED();
+ }
+ return UmaIDBExceptionUnknownError;
+}
+
} // namespace
IndexedDBTransaction::TaskQueue::TaskQueue() {}
@@ -152,6 +188,10 @@ void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) {
if (state_ == FINISHED)
return;
+ UMA_HISTOGRAM_ENUMERATION("WebCore.IndexedDB.TransactionAbortReason",
+ ExceptionCodeToUmaEnum(error.code()),
+ UmaIDBExceptionExclusiveMaxValue);
+
timeout_timer_.Stop();
state_ = FINISHED;
« no previous file with comments | « no previous file | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698