Changeset 138670 in webkit


Ignore:
Timestamp:
Jan 2, 2013, 3:55:40 PM (13 years ago)
Author:
dgrogan@chromium.org
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.
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r138668 r138670  
     12013-01-02  David Grogan  <dgrogan@chromium.org>
     2
     3        IndexedDB: Surface a few more leveldb errors.
     4        https://bugs.webkit.org/show_bug.cgi?id=105670
     5
     6        Reviewed by Tony Chang.
     7
     8        Two calls to old LevelDBTransaction::get slipped through the cracks.
     9
     10        * Modules/indexeddb/IDBBackingStore.cpp:
     11        (WebCore::IndexKeyCursorImpl::loadCurrentRow):
     12        (WebCore::IndexCursorImpl::loadCurrentRow):
     13          Make these two functions use safeGet instead of get.
     14
     15        * platform/leveldb/LevelDBTransaction.cpp:
     16        * platform/leveldb/LevelDBTransaction.h:
     17          Remove get now that it is unused.
     18
    1192013-01-02  Bem Jones-Bey  <bjonesbe@adobe.com>
    220
  • trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp

    r138072 r138670  
    15571557
    15581558    Vector<char> result;
    1559     if (!m_transaction->get(primaryLevelDBKey, result)) {
     1559    bool found = false;
     1560    bool ok = m_transaction->safeGet(primaryLevelDBKey, result, found);
     1561    if (!ok) {
     1562        INTERNAL_READ_ERROR(LoadCurrentRow);
     1563        return false;
     1564    }
     1565    if (!found) {
    15601566        m_transaction->remove(m_iterator->key());
    15611567        return false;
     
    16421648
    16431649    Vector<char> result;
    1644     if (!m_transaction->get(m_primaryLevelDBKey, result)) {
     1650    bool found = false;
     1651    bool ok = m_transaction->safeGet(m_primaryLevelDBKey, result, found);
     1652    if (!ok) {
     1653        INTERNAL_READ_ERROR(LoadCurrentRow);
     1654        return false;
     1655    }
     1656    if (!found) {
    16451657        m_transaction->remove(m_iterator->key());
    16461658        return false;
  • trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp

    r136194 r138670  
    131131}
    132132
    133 bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value)
    134 {
    135     bool found = false;
    136     bool ok = safeGet(key, value, found);
    137     if (!ok) {
    138         ASSERT(!found);
    139         ASSERT_NOT_REACHED();
    140     }
    141     return ok && found;
    142 }
    143 
    144133bool LevelDBTransaction::commit()
    145134{
  • trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h

    r136194 r138670  
    5555    void put(const LevelDBSlice& key, const Vector<char>& value);
    5656    void remove(const LevelDBSlice& key);
     57    // FIXME: Rename safeGet to get.
    5758    bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found);
    58     // FIXME: Convert all callers of get to safeGet then remove get.
    59     bool get(const LevelDBSlice& key, Vector<char>& value);
    6059    bool commit();
    6160    void rollback();
  • trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp

    r136194 r138670  
    129129    EXPECT_TRUE(success);
    130130
    131     success = transaction->get(key, gotValue);
    132     EXPECT_TRUE(success);
     131    bool found = false;
     132    success = transaction->safeGet(key, gotValue, found);
     133    EXPECT_TRUE(success);
     134    EXPECT_TRUE(found);
    133135    EXPECT_EQ(comparator.compare(gotValue, oldValue), 0);
    134136
    135     bool found = false;
     137    found = false;
    136138    success = leveldb->safeGet(key, gotValue, found);
    137139    EXPECT_TRUE(success);
     
    149151    EXPECT_EQ(comparator.compare(gotValue, addedValue), 0);
    150152
    151     success = transaction->get(addedKey, gotValue);
    152     EXPECT_FALSE(success);
     153    success = transaction->safeGet(addedKey, gotValue, found);
     154    EXPECT_TRUE(success);
     155    EXPECT_FALSE(found);
    153156}
    154157
Note: See TracChangeset for help on using the changeset viewer.