Title: [90135] trunk/Source/WebCore
Revision
90135
Author
[email protected]
Date
2011-06-30 11:16:31 -0700 (Thu, 30 Jun 2011)

Log Message

2011-06-28  Hans Wennborg  <[email protected]>

        Reviewed by Tony Chang.

        IndexedDB: Support for deleteIndex with LevelDB backing store
        https://bugs.webkit.org/show_bug.cgi?id=63539

        Covered by storage/indexeddb/mozilla/remove-index.html.

        * storage/IDBLevelDBBackingStore.cpp:
        (WebCore::IDBLevelDBBackingStore::deleteIndex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90134 => 90135)


--- trunk/Source/WebCore/ChangeLog	2011-06-30 17:57:47 UTC (rev 90134)
+++ trunk/Source/WebCore/ChangeLog	2011-06-30 18:16:31 UTC (rev 90135)
@@ -1,3 +1,15 @@
+2011-06-28  Hans Wennborg  <[email protected]>
+
+        Reviewed by Tony Chang.
+
+        IndexedDB: Support for deleteIndex with LevelDB backing store
+        https://bugs.webkit.org/show_bug.cgi?id=63539
+
+        Covered by storage/indexeddb/mozilla/remove-index.html.
+
+        * storage/IDBLevelDBBackingStore.cpp:
+        (WebCore::IDBLevelDBBackingStore::deleteIndex):
+
 2011-06-30  Abhishek Arya  <[email protected]>
 
         Reviewed by Ryosuke Niwa.

Modified: trunk/Source/WebCore/storage/IDBLevelDBBackingStore.cpp (90134 => 90135)


--- trunk/Source/WebCore/storage/IDBLevelDBBackingStore.cpp	2011-06-30 17:57:47 UTC (rev 90134)
+++ trunk/Source/WebCore/storage/IDBLevelDBBackingStore.cpp	2011-06-30 18:16:31 UTC (rev 90135)
@@ -697,10 +697,40 @@
     return true;
 }
 
-void IDBLevelDBBackingStore::deleteIndex(int64_t, int64_t, int64_t)
+void IDBLevelDBBackingStore::deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId)
 {
-    ASSERT_NOT_REACHED(); // FIXME: Implement and add layout test.
-    return;
+    ASSERT(m_currentTransaction);
+
+    const Vector<char> nameKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, 0);
+    const Vector<char> uniqueKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, 1);
+    const Vector<char> keyPathKey = IndexMetaDataKey::encode(databaseId, objectStoreId, indexId, 2);
+
+    if (!m_currentTransaction->remove(nameKey)) {
+        LOG_ERROR("Internal Indexed DB error.");
+        return;
+    }
+    if (!m_currentTransaction->remove(uniqueKey)) {
+        LOG_ERROR("Internal Indexed DB error.");
+        return;
+    }
+    if (!m_currentTransaction->remove(keyPathKey)) {
+        LOG_ERROR("Internal Indexed DB error.");
+        return;
+    }
+
+    const Vector<char> indexDataStart = IndexDataKey::encode(databaseId, objectStoreId, indexId, minIDBKey(), 0);
+    const Vector<char> indexDataEnd = IndexDataKey::encode(databaseId, objectStoreId, indexId, maxIDBKey(), 0);
+
+    if (!deleteRange(m_currentTransaction.get(), indexDataStart, indexDataEnd)) {
+        LOG_ERROR("Internal Indexed DB error.");
+        return;
+    }
+
+    const Vector<char> freeListKey = IndexFreeListKey::encode(databaseId, objectStoreId, indexId);
+    if (!putInt(m_currentTransaction.get(), freeListKey, 0)) {
+        LOG_ERROR("Internal Indexed DB error.");
+        return;
+    }
 }
 
 bool IDBLevelDBBackingStore::putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const ObjectStoreRecordIdentifier* recordIdentifier)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to