Title: [136497] trunk/Source/WebCore
Revision
136497
Author
[email protected]
Date
2012-12-04 03:04:48 -0800 (Tue, 04 Dec 2012)

Log Message

IndexedDB: Make leveldb histogram entries more fine-grained
https://bugs.webkit.org/show_bug.cgi?id=103688

Reviewed by Tony Chang.

Allow us better insight into which functions the IO errors originate
from.

* Modules/indexeddb/IDBBackingStore.cpp:
(WebCore::setUpMetadata):
(WebCore::IDBBackingStore::getIDBDatabaseMetaData):
(WebCore::IDBBackingStore::getObjectStores):
(WebCore::IDBBackingStore::getRecord):
(WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber):
(WebCore::IDBBackingStore::keyExistsInObjectStore):
(WebCore::IDBBackingStore::getIndexes):
(WebCore::IDBBackingStore::findKeyInIndex):
(WebCore::ObjectStoreKeyCursorImpl::loadCurrentRow):
(WebCore::ObjectStoreCursorImpl::loadCurrentRow):
(WebCore::IndexKeyCursorImpl::loadCurrentRow):
(WebCore::IndexCursorImpl::loadCurrentRow):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136496 => 136497)


--- trunk/Source/WebCore/ChangeLog	2012-12-04 10:49:31 UTC (rev 136496)
+++ trunk/Source/WebCore/ChangeLog	2012-12-04 11:04:48 UTC (rev 136497)
@@ -1,3 +1,27 @@
+2012-12-04  David Grogan  <[email protected]>
+
+        IndexedDB: Make leveldb histogram entries more fine-grained
+        https://bugs.webkit.org/show_bug.cgi?id=103688
+
+        Reviewed by Tony Chang.
+
+        Allow us better insight into which functions the IO errors originate
+        from.
+
+        * Modules/indexeddb/IDBBackingStore.cpp:
+        (WebCore::setUpMetadata):
+        (WebCore::IDBBackingStore::getIDBDatabaseMetaData):
+        (WebCore::IDBBackingStore::getObjectStores):
+        (WebCore::IDBBackingStore::getRecord):
+        (WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber):
+        (WebCore::IDBBackingStore::keyExistsInObjectStore):
+        (WebCore::IDBBackingStore::getIndexes):
+        (WebCore::IDBBackingStore::findKeyInIndex):
+        (WebCore::ObjectStoreKeyCursorImpl::loadCurrentRow):
+        (WebCore::ObjectStoreCursorImpl::loadCurrentRow):
+        (WebCore::IndexKeyCursorImpl::loadCurrentRow):
+        (WebCore::IndexCursorImpl::loadCurrentRow):
+
 2012-12-04  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Avoid unnecessary heap allocations during drag and drop operations

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp (136496 => 136497)


--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp	2012-12-04 10:49:31 UTC (rev 136496)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp	2012-12-04 11:04:48 UTC (rev 136497)
@@ -55,6 +55,15 @@
     IDBLevelDBBackingStoreReadError,
     IDBLevelDBBackingStoreWriteError,
     IDBLevelDBBackingStoreConsistencyError,
+    IDBLevelDBBackingStoreReadErrorFindKeyInIndex,
+    IDBLevelDBBackingStoreReadErrorGetIDBDatabaseMetaData,
+    IDBLevelDBBackingStoreReadErrorGetIndexes,
+    IDBLevelDBBackingStoreReadErrorGetKeyGeneratorCurrentNumber,
+    IDBLevelDBBackingStoreReadErrorGetObjectStores,
+    IDBLevelDBBackingStoreReadErrorGetRecord,
+    IDBLevelDBBackingStoreReadErrorKeyExistsInObjectStore,
+    IDBLevelDBBackingStoreReadErrorLoadCurrentRow,
+    IDBLevelDBBackingStoreReadErrorSetupMetadata,
     IDBLevelDBBackingStoreInternalErrorMax,
 };
 static inline void recordInternalError(IDBLevelDBBackingStoreInternalErrorType type)
@@ -198,7 +207,7 @@
             for (it->seek(startKey); it->isValid() && compareKeys(it->key(), stopKey) < 0; it->next()) {
                 int64_t databaseId = 0;
                 if (!getInt(transaction.get(), it->key(), databaseId)) {
-                    InternalError(IDBLevelDBBackingStoreReadError);
+                    InternalError(IDBLevelDBBackingStoreReadErrorSetupMetadata);
                     return false;
                 }
                 Vector<char> intVersionKey = DatabaseMetaDataKey::encode(databaseId, DatabaseMetaDataKey::UserIntVersion);
@@ -362,13 +371,13 @@
 
     ok = getString(m_db.get(), DatabaseMetaDataKey::encode(metadata->id, DatabaseMetaDataKey::UserVersion), metadata->version);
     if (!ok) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorGetIDBDatabaseMetaData);
         return false;
     }
 
     ok = getVarInt(m_db.get(), DatabaseMetaDataKey::encode(metadata->id, DatabaseMetaDataKey::UserIntVersion), metadata->intVersion);
     if (!ok) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorGetIDBDatabaseMetaData);
         return false;
     }
     if (metadata->intVersion == IDBDatabaseMetadata::DefaultIntVersion)
@@ -494,7 +503,7 @@
         p = ObjectStoreMetaDataKey::decode(p, limit, &metaDataKey);
         ASSERT(p);
         if (metaDataKey.metaDataType() != ObjectStoreMetaDataKey::Name) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
             // Possible stale metadata, but don't fail the load.
             it->next();
             continue;
@@ -507,33 +516,33 @@
 
         it->next();
         if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::KeyPath)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
             break;
         }
         IDBKeyPath keyPath = decodeIDBKeyPath(it->value().begin(), it->value().end());
 
         it->next();
         if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::AutoIncrement)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
             break;
         }
         bool autoIncrement = decodeBool(it->value().begin(), it->value().end());
 
         it->next(); // Is evicatble.
         if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::Evictable)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
             break;
         }
 
         it->next(); // Last version.
         if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::LastVersion)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
             break;
         }
 
         it->next(); // Maximum index id allocated.
         if (!checkObjectStoreAndMetaDataType(it.get(), stopKey, objectStoreId, ObjectStoreMetaDataKey::MaxIndexId)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
             break;
         }
         int64_t maxIndexId = decodeInt(it->value().begin(), it->value().end());
@@ -546,7 +555,7 @@
             // (2) Later, null vs. string vs. array was stored in the keyPath itself.
             // So this check is only relevant for string-type keyPaths.
             if (!hasKeyPath && (keyPath.type() == IDBKeyPath::StringType && !keyPath.string().isEmpty())) {
-                InternalError(IDBLevelDBBackingStoreReadError);
+                InternalError(IDBLevelDBBackingStoreReadErrorGetObjectStores);
                 break;
             }
             if (!hasKeyPath)
@@ -642,7 +651,7 @@
     int64_t version;
     const char* p = decodeVarInt(data.begin(), data.end(), version);
     if (!p) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorGetRecord);
         return String();
     }
     (void) version;
@@ -723,7 +732,7 @@
     bool found = false;
     bool ok = levelDBTransaction->safeGet(keyGeneratorCurrentNumberKey, data, found);
     if (!ok) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorGetKeyGeneratorCurrentNumber);
         return false;
     }
     if (found)
@@ -787,7 +796,7 @@
 
     bool ok = levelDBTransaction->safeGet(leveldbKey, data, found);
     if (!ok) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorKeyExistsInObjectStore);
         return false;
     }
     if (!found)
@@ -836,7 +845,7 @@
         p = IndexMetaDataKey::decode(p, limit, &metaDataKey);
         ASSERT(p);
         if (metaDataKey.metaDataType() != IndexMetaDataKey::Name) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetIndexes);
             // Possible stale metadata due to http://webkit.org/b/85557 but don't fail the load.
             it->next();
             continue;
@@ -848,14 +857,14 @@
 
         it->next(); // unique flag
         if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::Unique)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetIndexes);
             break;
         }
         bool indexUnique = decodeBool(it->value().begin(), it->value().end());
 
         it->next(); // keyPath
         if (!checkIndexAndMetaDataKey(it.get(), stopKey, indexId, IndexMetaDataKey::KeyPath)) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorGetIndexes);
             break;
         }
         IDBKeyPath keyPath = decodeIDBKeyPath(it->value().begin(), it->value().end());
@@ -995,7 +1004,7 @@
         int64_t version;
         const char* p = decodeVarInt(it->value().begin(), it->value().end(), version);
         if (!p) {
-            InternalError(IDBLevelDBBackingStoreReadError);
+            InternalError(IDBLevelDBBackingStoreReadErrorFindKeyInIndex);
             return false;
         }
         foundEncodedPrimaryKey.append(p, it->value().end() - p);
@@ -1228,7 +1237,7 @@
     ObjectStoreDataKey objectStoreDataKey;
     keyPosition = ObjectStoreDataKey::decode(keyPosition, keyLimit, &objectStoreDataKey);
     if (!keyPosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1237,7 +1246,7 @@
     int64_t version;
     const char* valuePosition = decodeVarInt(m_iterator->value().begin(), m_iterator->value().end(), version);
     if (!valuePosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1286,7 +1295,7 @@
     ObjectStoreDataKey objectStoreDataKey;
     keyPosition = ObjectStoreDataKey::decode(keyPosition, keyLimit, &objectStoreDataKey);
     if (!keyPosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1295,7 +1304,7 @@
     int64_t version;
     const char* valuePosition = decodeVarInt(m_iterator->value().begin(), m_iterator->value().end(), version);
     if (!valuePosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1353,13 +1362,13 @@
     int64_t indexDataVersion;
     const char* valuePosition = decodeVarInt(m_iterator->value().begin(), m_iterator->value().end(), indexDataVersion);
     if (!valuePosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
     valuePosition = decodeIDBKey(valuePosition, m_iterator->value().end(), m_primaryKey);
     if (!valuePosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1374,7 +1383,7 @@
     int64_t objectStoreDataVersion;
     const char* t = decodeVarInt(result.begin(), result.end(), objectStoreDataVersion);
     if (!t) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1439,12 +1448,12 @@
     int64_t indexDataVersion;
     valuePosition = decodeVarInt(valuePosition, valueLimit, indexDataVersion);
     if (!valuePosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
     valuePosition = decodeIDBKey(valuePosition, valueLimit, m_primaryKey);
     if (!valuePosition) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
@@ -1459,7 +1468,7 @@
     int64_t objectStoreDataVersion;
     const char* t = decodeVarInt(result.begin(), result.end(), objectStoreDataVersion);
     if (!t) {
-        InternalError(IDBLevelDBBackingStoreReadError);
+        InternalError(IDBLevelDBBackingStoreReadErrorLoadCurrentRow);
         return false;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to