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

Unified Diff: Source/WebCore/platform/leveldb/LevelDBDatabase.cpp

Issue 13171005: Merge 146950 "IndexedDB: Histogram cause of LevelDB write errors" (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1453/
Patch Set: Created 7 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/leveldb/LevelDBDatabase.cpp
===================================================================
--- Source/WebCore/platform/leveldb/LevelDBDatabase.cpp (revision 147257)
+++ Source/WebCore/platform/leveldb/LevelDBDatabase.cpp (working copy)
@@ -159,6 +159,26 @@
#endif
}
+static void histogramLevelDBError(const char* histogramName, const leveldb::Status& s)
+{
+ ASSERT(!s.ok());
+ enum {
+ LevelDBNotFound,
+ LevelDBCorruption,
+ LevelDBIOError,
+ LevelDBOther,
+ LevelDBMaxError
+ };
+ int levelDBError = LevelDBOther;
+ if (s.IsNotFound())
+ levelDBError = LevelDBNotFound;
+ else if (s.IsCorruption())
+ levelDBError = LevelDBCorruption;
+ else if (s.IsIOError())
+ levelDBError = LevelDBIOError;
+ HistogramSupport::histogramEnumeration(histogramName, levelDBError, LevelDBMaxError);
+}
+
PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const LevelDBComparator* comparator)
{
OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter(comparator));
@@ -167,22 +187,7 @@
const leveldb::Status s = openDB(comparatorAdapter.get(), leveldb::IDBEnv(), fileName, &db);
if (!s.ok()) {
- enum {
- LevelDBNotFound,
- LevelDBCorruption,
- LevelDBIOError,
- LevelDBOther,
- LevelDBMaxError
- };
- int levelDBError = LevelDBOther;
- if (s.IsNotFound())
- levelDBError = LevelDBNotFound;
- else if (s.IsCorruption())
- levelDBError = LevelDBCorruption;
- else if (s.IsIOError())
- levelDBError = LevelDBIOError;
- HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDBOpenErrors", levelDBError, LevelDBMaxError);
-
+ histogramLevelDBError("WebCore.IndexedDB.LevelDBOpenErrors", s);
histogramFreeSpace("Failure", fileName);
LOG_ERROR("Failed to open LevelDB database from %s: %s", fileName.ascii().data(), s.ToString().c_str());
@@ -276,6 +281,7 @@
const leveldb::Status s = m_db->Write(writeOptions, writeBatch.m_writeBatch.get());
if (s.ok())
return true;
+ histogramLevelDBError("WebCore.IndexedDB.LevelDBWriteErrors", s);
LOG_ERROR("LevelDB write failed: %s", s.ToString().c_str());
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698