Title: [138670] trunk/Source
Revision
138670
Author
dgro...@chromium.org
Date
2013-01-02 15:55:40 -0800 (Wed, 02 Jan 2013)

Log Message

IndexedDB: Surface a few more leveldb errors.
https://bugs.webkit.org/show_bug.cgi?id=105670

Reviewed by Tony Chang.

Two calls to old LevelDBTransaction::get slipped through the cracks.

* Modules/indexeddb/IDBBackingStore.cpp:
(WebCore::IndexKeyCursorImpl::loadCurrentRow):
(WebCore::IndexCursorImpl::loadCurrentRow):
  Make these two functions use safeGet instead of get.

* platform/leveldb/LevelDBTransaction.cpp:
* platform/leveldb/LevelDBTransaction.h:
  Remove get now that it is unused.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138669 => 138670)


--- trunk/Source/WebCore/ChangeLog	2013-01-02 23:54:42 UTC (rev 138669)
+++ trunk/Source/WebCore/ChangeLog	2013-01-02 23:55:40 UTC (rev 138670)
@@ -1,3 +1,21 @@
+2013-01-02  David Grogan  <dgro...@chromium.org>
+
+        IndexedDB: Surface a few more leveldb errors.
+        https://bugs.webkit.org/show_bug.cgi?id=105670
+
+        Reviewed by Tony Chang.
+
+        Two calls to old LevelDBTransaction::get slipped through the cracks.
+
+        * Modules/indexeddb/IDBBackingStore.cpp:
+        (WebCore::IndexKeyCursorImpl::loadCurrentRow):
+        (WebCore::IndexCursorImpl::loadCurrentRow):
+          Make these two functions use safeGet instead of get.
+
+        * platform/leveldb/LevelDBTransaction.cpp:
+        * platform/leveldb/LevelDBTransaction.h:
+          Remove get now that it is unused.
+
 2013-01-02  Bem Jones-Bey  <bjone...@adobe.com>
 
         When a block's height is determined by min-height/max-height, children with percentage heights are sized incorrectly

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp (138669 => 138670)


--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp	2013-01-02 23:54:42 UTC (rev 138669)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp	2013-01-02 23:55:40 UTC (rev 138670)
@@ -1556,7 +1556,13 @@
     Vector<char> primaryLevelDBKey = ObjectStoreDataKey::encode(indexDataKey.databaseId(), indexDataKey.objectStoreId(), *m_primaryKey);
 
     Vector<char> result;
-    if (!m_transaction->get(primaryLevelDBKey, result)) {
+    bool found = false;
+    bool ok = m_transaction->safeGet(primaryLevelDBKey, result, found);
+    if (!ok) {
+        INTERNAL_READ_ERROR(LoadCurrentRow);
+        return false;
+    }
+    if (!found) {
         m_transaction->remove(m_iterator->key());
         return false;
     }
@@ -1641,7 +1647,13 @@
     m_primaryLevelDBKey = ObjectStoreDataKey::encode(indexDataKey.databaseId(), indexDataKey.objectStoreId(), *m_primaryKey);
 
     Vector<char> result;
-    if (!m_transaction->get(m_primaryLevelDBKey, result)) {
+    bool found = false;
+    bool ok = m_transaction->safeGet(m_primaryLevelDBKey, result, found);
+    if (!ok) {
+        INTERNAL_READ_ERROR(LoadCurrentRow);
+        return false;
+    }
+    if (!found) {
         m_transaction->remove(m_iterator->key());
         return false;
     }

Modified: trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp (138669 => 138670)


--- trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp	2013-01-02 23:54:42 UTC (rev 138669)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp	2013-01-02 23:55:40 UTC (rev 138670)
@@ -130,17 +130,6 @@
     return true;
 }
 
-bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value)
-{
-    bool found = false;
-    bool ok = safeGet(key, value, found);
-    if (!ok) {
-        ASSERT(!found);
-        ASSERT_NOT_REACHED();
-    }
-    return ok && found;
-}
-
 bool LevelDBTransaction::commit()
 {
     ASSERT(!m_finished);

Modified: trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h (138669 => 138670)


--- trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h	2013-01-02 23:54:42 UTC (rev 138669)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h	2013-01-02 23:55:40 UTC (rev 138670)
@@ -54,9 +54,8 @@
     ~LevelDBTransaction();
     void put(const LevelDBSlice& key, const Vector<char>& value);
     void remove(const LevelDBSlice& key);
+    // FIXME: Rename safeGet to get.
     bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found);
-    // FIXME: Convert all callers of get to safeGet then remove get.
-    bool get(const LevelDBSlice& key, Vector<char>& value);
     bool commit();
     void rollback();
 

Modified: trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp (138669 => 138670)


--- trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp	2013-01-02 23:54:42 UTC (rev 138669)
+++ trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp	2013-01-02 23:55:40 UTC (rev 138670)
@@ -128,11 +128,13 @@
     success = leveldb->put(key, newValue);
     EXPECT_TRUE(success);
 
-    success = transaction->get(key, gotValue);
+    bool found = false;
+    success = transaction->safeGet(key, gotValue, found);
     EXPECT_TRUE(success);
+    EXPECT_TRUE(found);
     EXPECT_EQ(comparator.compare(gotValue, oldValue), 0);
 
-    bool found = false;
+    found = false;
     success = leveldb->safeGet(key, gotValue, found);
     EXPECT_TRUE(success);
     EXPECT_TRUE(found);
@@ -148,8 +150,9 @@
     EXPECT_TRUE(found);
     EXPECT_EQ(comparator.compare(gotValue, addedValue), 0);
 
-    success = transaction->get(addedKey, gotValue);
-    EXPECT_FALSE(success);
+    success = transaction->safeGet(addedKey, gotValue, found);
+    EXPECT_TRUE(success);
+    EXPECT_FALSE(found);
 }
 
 TEST(LevelDBDatabaseTest, TransactionIterator)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to