Chromium Code Reviews| 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..1921cd609025985b021849f21f9183a915378fb5 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, |
|
jsbell
2017/05/25 17:08:58
Give all of these explicit values since they are u
dmurph
2017/05/25 17:33:08
Done.
|
| + UmaIDBExceptionDataError, |
| + UmaIDBExceptionVersionError, |
| + UmaIDBExceptionAbortError, |
| + UmaIDBExceptionQuotaError, |
| + UmaIDBExceptionTimeoutError, |
| + UmaIDBExceptionExclusiveMaxValue |
| +}; |
| + |
| +// Used for UMA metrics - do not change mappings. |
| +UmaIDBException TranslateExceptionCodeToUmaEnum(uint16_t code) { |
|
jsbell
2017/05/25 17:08:58
Could drop 'Translate' from the name here, but it'
dmurph
2017/05/25 17:33:08
Done.
|
| + 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", |
| + TranslateExceptionCodeToUmaEnum(error.code()), |
| + UmaIDBExceptionExclusiveMaxValue); |
| + |
| timeout_timer_.Stop(); |
| state_ = FINISHED; |