Chromium Code Reviews| Index: webkit/dom_storage/session_storage_database.cc |
| diff --git a/webkit/dom_storage/session_storage_database.cc b/webkit/dom_storage/session_storage_database.cc |
| index b22ea30296bd01e45593eb5e10f440c027ead4f8..ba4c021768504d170f6e12ab83edbe930762cded 100644 |
| --- a/webkit/dom_storage/session_storage_database.cc |
| +++ b/webkit/dom_storage/session_storage_database.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/file_util.h" |
| #include "base/logging.h" |
| +#include "base/metrics/histogram.h" |
| #include "base/stringprintf.h" |
| #include "base/string_number_conversions.h" |
| #include "base/utf_string_conversions.h" |
| @@ -16,6 +17,17 @@ |
| #include "third_party/leveldatabase/src/include/leveldb/options.h" |
| #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" |
| +namespace { |
| + |
|
michaeln
2013/02/27 00:31:57
Can you define a constant for histogram name value
marja
2013/02/27 08:48:25
Done. I just #define'd it, because we cannot have
michaeln
2013/02/27 20:31:48
I would expect compilers to optimize the multiple
|
| +enum SessionStorageUMA { |
| + SESSION_STORAGE_UMA_SUCCESS, |
| + SESSION_STORAGE_UMA_RECREATED, |
| + SESSION_STORAGE_UMA_FAIL, |
| + SESSION_STORAGE_UMA_MAX |
| +}; |
| + |
| +} // namespace |
| + |
| // Layout of the database: |
| // | key | value | |
| // ----------------------------------------------------------------------- |
| @@ -286,10 +298,20 @@ bool SessionStorageDatabase::LazyOpen(bool create_if_needed) { |
| if (!s.ok()) { |
| LOG(WARNING) << "Failed to open leveldb in " << file_path_.value() |
| << ", error: " << s.ToString(); |
| + UMA_HISTOGRAM_ENUMERATION("SessionStorageDatabase.Open", |
| + SESSION_STORAGE_UMA_FAIL, |
| + SESSION_STORAGE_UMA_MAX); |
| DCHECK(db == NULL); |
| db_error_ = true; |
| return false; |
| } |
| + UMA_HISTOGRAM_ENUMERATION("SessionStorageDatabase.Open", |
| + SESSION_STORAGE_UMA_RECREATED, |
| + SESSION_STORAGE_UMA_MAX); |
| + } else { |
| + UMA_HISTOGRAM_ENUMERATION("SessionStorageDatabase.Open", |
| + SESSION_STORAGE_UMA_SUCCESS, |
| + SESSION_STORAGE_UMA_MAX); |
| } |
| db_.reset(db); |
| return true; |