Changeset 145441 in webkit


Ignore:
Timestamp:
Mar 11, 2013 5:16:50 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r145435.
http://trac.webkit.org/changeset/145435
https://bugs.webkit.org/show_bug.cgi?id=112082

Still does not compile (Requested by jamesr on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-03-11

Source/WebCore:

  • Modules/indexeddb/IDBBackingStore.cpp:

(WebCore::IDBBackingStore::getObjectStores):
(WebCore::IDBBackingStore::createObjectStore):
(WebCore::IDBBackingStore::deleteObjectStore):
(WebCore::IDBBackingStore::getRecord):
(WebCore::IDBBackingStore::putRecord):
(WebCore::IDBBackingStore::clearObjectStore):
(WebCore::IDBBackingStore::deleteRecord):
(WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber):
(WebCore::IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber):
(WebCore::IDBBackingStore::keyExistsInObjectStore):
(WebCore::IDBBackingStore::getIndexes):
(WebCore::IDBBackingStore::createIndex):
(WebCore::IDBBackingStore::deleteIndex):
(WebCore::IDBBackingStore::putIndexDataForRecord):
(WebCore::IDBBackingStore::findKeyInIndex):
(WebCore::IDBBackingStore::getPrimaryKeyViaIndex):
(WebCore::IDBBackingStore::keyExistsInIndex):
(WebCore::indexCursorOptions):

  • Modules/indexeddb/IDBBackingStore.h:

(IDBBackingStore):

  • Modules/indexeddb/IDBDatabaseBackendImpl.cpp:

(WebCore::DeleteIndexOperation::create):
(WebCore::DeleteIndexOperation::DeleteIndexOperation):
(DeleteIndexOperation):
(WebCore::IDBDatabaseBackendImpl::openInternal):
(WebCore::IDBDatabaseBackendImpl::deleteIndex):
(WebCore::DeleteIndexOperation::perform):
(WebCore::DeleteRangeOperation::perform):
(WebCore::ClearOperation::perform):

  • Modules/indexeddb/IDBLevelDBCoding.cpp:

(WebCore::IDBLevelDBCoding::KeyPrefix::KeyPrefix):
(WebCore::IDBLevelDBCoding::KeyPrefix::encode):
(WebCore::IDBLevelDBCoding::SchemaVersionKey::encode):
(WebCore::IDBLevelDBCoding::MaxDatabaseIdKey::encode):
(WebCore::IDBLevelDBCoding::DataVersionKey::encode):
(WebCore::IDBLevelDBCoding::DatabaseFreeListKey::encode):
(WebCore::IDBLevelDBCoding::DatabaseNameKey::encode):
(WebCore::IDBLevelDBCoding::DatabaseMetaDataKey::encode):
(WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encode):
(WebCore::IDBLevelDBCoding::IndexMetaDataKey::encode):
(WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::encode):
(WebCore::IDBLevelDBCoding::IndexFreeListKey::encode):
(WebCore::IDBLevelDBCoding::ObjectStoreNamesKey::encode):
(WebCore::IDBLevelDBCoding::IndexNamesKey::encode):
(WebCore::IDBLevelDBCoding::ObjectStoreDataKey::encode):
(WebCore::IDBLevelDBCoding::ExistsEntryKey::encode):

  • Modules/indexeddb/IDBLevelDBCoding.h:

(IDBLevelDBCoding):
(KeyPrefix):

  • Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:

(WebCore::IDBObjectStoreBackendImpl::IndexWriter::writeIndexKeys):

Source/WebKit/chromium:

  • tests/IDBBackingStoreTest.cpp:

(WebCore::IDBBackingStoreTest::SetUp):
(IDBBackingStoreTest):
(WebCore::TEST_F):

  • tests/IDBFakeBackingStore.h:
  • tests/IDBLevelDBCodingTest.cpp:

(IDBLevelDBCoding):
(IDBLevelDBCoding::TEST):

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r145435 r145441  
     12013-03-11  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r145435.
     4        http://trac.webkit.org/changeset/145435
     5        https://bugs.webkit.org/show_bug.cgi?id=112082
     6
     7        Still does not compile (Requested by jamesr on #webkit).
     8
     9        * Modules/indexeddb/IDBBackingStore.cpp:
     10        (WebCore::IDBBackingStore::getObjectStores):
     11        (WebCore::IDBBackingStore::createObjectStore):
     12        (WebCore::IDBBackingStore::deleteObjectStore):
     13        (WebCore::IDBBackingStore::getRecord):
     14        (WebCore::IDBBackingStore::putRecord):
     15        (WebCore::IDBBackingStore::clearObjectStore):
     16        (WebCore::IDBBackingStore::deleteRecord):
     17        (WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber):
     18        (WebCore::IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber):
     19        (WebCore::IDBBackingStore::keyExistsInObjectStore):
     20        (WebCore::IDBBackingStore::getIndexes):
     21        (WebCore::IDBBackingStore::createIndex):
     22        (WebCore::IDBBackingStore::deleteIndex):
     23        (WebCore::IDBBackingStore::putIndexDataForRecord):
     24        (WebCore::IDBBackingStore::findKeyInIndex):
     25        (WebCore::IDBBackingStore::getPrimaryKeyViaIndex):
     26        (WebCore::IDBBackingStore::keyExistsInIndex):
     27        (WebCore::indexCursorOptions):
     28        * Modules/indexeddb/IDBBackingStore.h:
     29        (IDBBackingStore):
     30        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
     31        (WebCore::DeleteIndexOperation::create):
     32        (WebCore::DeleteIndexOperation::DeleteIndexOperation):
     33        (DeleteIndexOperation):
     34        (WebCore::IDBDatabaseBackendImpl::openInternal):
     35        (WebCore::IDBDatabaseBackendImpl::deleteIndex):
     36        (WebCore::DeleteIndexOperation::perform):
     37        (WebCore::DeleteRangeOperation::perform):
     38        (WebCore::ClearOperation::perform):
     39        * Modules/indexeddb/IDBLevelDBCoding.cpp:
     40        (WebCore::IDBLevelDBCoding::KeyPrefix::KeyPrefix):
     41        (WebCore::IDBLevelDBCoding::KeyPrefix::encode):
     42        (WebCore::IDBLevelDBCoding::SchemaVersionKey::encode):
     43        (WebCore::IDBLevelDBCoding::MaxDatabaseIdKey::encode):
     44        (WebCore::IDBLevelDBCoding::DataVersionKey::encode):
     45        (WebCore::IDBLevelDBCoding::DatabaseFreeListKey::encode):
     46        (WebCore::IDBLevelDBCoding::DatabaseNameKey::encode):
     47        (WebCore::IDBLevelDBCoding::DatabaseMetaDataKey::encode):
     48        (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encode):
     49        (WebCore::IDBLevelDBCoding::IndexMetaDataKey::encode):
     50        (WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::encode):
     51        (WebCore::IDBLevelDBCoding::IndexFreeListKey::encode):
     52        (WebCore::IDBLevelDBCoding::ObjectStoreNamesKey::encode):
     53        (WebCore::IDBLevelDBCoding::IndexNamesKey::encode):
     54        (WebCore::IDBLevelDBCoding::ObjectStoreDataKey::encode):
     55        (WebCore::IDBLevelDBCoding::ExistsEntryKey::encode):
     56        * Modules/indexeddb/IDBLevelDBCoding.h:
     57        (IDBLevelDBCoding):
     58        (KeyPrefix):
     59        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
     60        (WebCore::IDBObjectStoreBackendImpl::IndexWriter::writeIndexKeys):
     61
    1622013-03-11  Alec Flett  <alecflett@chromium.org>
    263
  • trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp

    r145435 r145441  
    637637
    638638// FIXME: This should do some error handling rather than plowing ahead when bad data is encountered.
    639 bool IDBBackingStore::getObjectStores(int64_t databaseId, IDBDatabaseMetadata::ObjectStoreMap* objectStores)
     639void IDBBackingStore::getObjectStores(int64_t databaseId, IDBDatabaseMetadata::ObjectStoreMap* objectStores)
    640640{
    641641    IDB_TRACE("IDBBackingStore::getObjectStores");
    642     if (!KeyPrefix::isValidDatabaseId(databaseId))
    643         return false;
    644642    const Vector<char> startKey = ObjectStoreMetaDataKey::encode(databaseId, 1, 0);
    645643    const Vector<char> stopKey = ObjectStoreMetaDataKey::encodeMaxKey(databaseId);
     
    727725
    728726        IDBObjectStoreMetadata metadata(objectStoreName, objectStoreId, keyPath, autoIncrement, maxIndexId);
    729         if (!getIndexes(databaseId, objectStoreId, &metadata.indexes))
    730             return false;
     727        getIndexes(databaseId, objectStoreId, &metadata.indexes);
    731728        objectStores->set(objectStoreId, metadata);
    732729    }
    733     return true;
    734730}
    735731
     
    755751{
    756752    IDB_TRACE("IDBBackingStore::createObjectStore");
    757     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    758         return false;
    759753    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    760754    if (!setMaxObjectStoreId(levelDBTransaction, databaseId, objectStoreId))
     
    786780{
    787781    IDB_TRACE("IDBBackingStore::deleteObjectStore");
    788     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    789         return false;
    790782    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    791783
     
    809801    deleteRange(levelDBTransaction, IndexMetaDataKey::encode(databaseId, objectStoreId, 0, 0), IndexMetaDataKey::encodeMaxKey(databaseId, objectStoreId));
    810802
    811     return clearObjectStore(transaction, databaseId, objectStoreId);
     803    clearObjectStore(transaction, databaseId, objectStoreId);
     804    return true;
    812805}
    813806
     
    815808{
    816809    IDB_TRACE("IDBBackingStore::getRecord");
    817     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    818         return false;
    819810    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    820811
     
    873864{
    874865    IDB_TRACE("IDBBackingStore::putRecord");
    875     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    876         return false;
    877866    ASSERT(key.isValid());
    878 
    879867    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    880868    int64_t version = -1;
     
    900888}
    901889
    902 bool IDBBackingStore::clearObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId)
     890void IDBBackingStore::clearObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId)
    903891{
    904892    IDB_TRACE("IDBBackingStore::clearObjectStore");
    905     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    906         return false;
    907893    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    908     const Vector<char> startKey = KeyPrefix(databaseId, objectStoreId).encode();
    909     const Vector<char> stopKey = KeyPrefix(databaseId, objectStoreId + 1).encode();
     894    const Vector<char> startKey = KeyPrefix(databaseId, objectStoreId, 0).encode();
     895    const Vector<char> stopKey = KeyPrefix(databaseId, objectStoreId + 1, 0).encode();
    910896
    911897    deleteRange(levelDBTransaction, startKey, stopKey);
    912     return true;
    913 }
    914 
    915 bool IDBBackingStore::deleteRecord(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier& recordIdentifier)
     898}
     899
     900void IDBBackingStore::deleteRecord(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier& recordIdentifier)
    916901{
    917902    IDB_TRACE("IDBBackingStore::deleteRecord");
    918     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    919         return false;
    920903    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    921904
     
    925908    const Vector<char> existsEntryKey = ExistsEntryKey::encode(databaseId, objectStoreId, recordIdentifier.primaryKey());
    926909    levelDBTransaction->remove(existsEntryKey);
    927     return true;
    928910}
    929911
     
    931913bool IDBBackingStore::getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t& keyGeneratorCurrentNumber)
    932914{
    933     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    934         return false;
    935915    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    936916
     
    981961bool IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent)
    982962{
    983     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    984         return false;
    985963    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    986964
     
    1002980{
    1003981    IDB_TRACE("IDBBackingStore::keyExistsInObjectStore");
    1004     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    1005         return false;
    1006982    found = false;
    1007983    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
     
    10421018
    10431019// FIXME: This should do some error handling rather than plowing ahead when bad data is encountered.
    1044 bool IDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreId, IDBObjectStoreMetadata::IndexMap* indexes)
     1020void IDBBackingStore::getIndexes(int64_t databaseId, int64_t objectStoreId, IDBObjectStoreMetadata::IndexMap* indexes)
    10451021{
    10461022    IDB_TRACE("IDBBackingStore::getIndexes");
    1047     if (!KeyPrefix::validIds(databaseId, objectStoreId))
    1048         return false;
    10491023    const Vector<char> startKey = IndexMetaDataKey::encode(databaseId, objectStoreId, 0, 0);
    10501024    const Vector<char> stopKey = IndexMetaDataKey::encode(databaseId, objectStoreId + 1, 0, 0);
     
    10951069        indexes->set(indexId, IDBIndexMetadata(indexName, indexId, keyPath, indexUnique, indexMultiEntry));
    10961070    }
    1097     return true;
    10981071}
    10991072
     
    11231096{
    11241097    IDB_TRACE("IDBBackingStore::createIndex");
    1125     if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId))
    1126         return false;
    11271098    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    11281099    if (!setMaxIndexId(levelDBTransaction, databaseId, objectStoreId, indexId))
     
    11411112}
    11421113
    1143 bool IDBBackingStore::deleteIndex(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId)
     1114void IDBBackingStore::deleteIndex(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    11441115{
    11451116    IDB_TRACE("IDBBackingStore::deleteIndex");
    1146     if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId))
    1147         return false;
    11481117    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
    11491118
     
    11551124    const Vector<char> indexDataEnd = IndexDataKey::encodeMaxKey(databaseId, objectStoreId, indexId);
    11561125    deleteRange(levelDBTransaction, indexDataStart, indexDataEnd);
    1157     return true;
    1158 }
    1159 
    1160 bool IDBBackingStore::putIndexDataForRecord(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const RecordIdentifier& recordIdentifier)
     1126}
     1127
     1128void IDBBackingStore::putIndexDataForRecord(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const RecordIdentifier& recordIdentifier)
    11611129{
    11621130    IDB_TRACE("IDBBackingStore::putIndexDataForRecord");
    11631131    ASSERT(key.isValid());
    1164     if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId))
    1165         return false;
     1132    ASSERT(indexId >= MinimumIndexId);
    11661133
    11671134    LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
     
    11731140
    11741141    levelDBTransaction->put(indexDataKey, data);
    1175     return true;
    11761142}
    11771143
     
    12241190{
    12251191    IDB_TRACE("IDBBackingStore::findKeyInIndex");
    1226     ASSERT(KeyPrefix::validIds(databaseId, objectStoreId, indexId));
    1227 
    12281192    ASSERT(foundEncodedPrimaryKey.isEmpty());
    12291193    found = false;
     
    12661230{
    12671231    IDB_TRACE("IDBBackingStore::getPrimaryKeyViaIndex");
    1268     if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId))
    1269         return false;
    12701232
    12711233    bool found = false;
     
    12871249{
    12881250    IDB_TRACE("IDBBackingStore::keyExistsInIndex");
    1289     if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId))
    1290         return false;
    12911251
    12921252    exists = false;
     
    18031763{
    18041764    ASSERT(transaction);
    1805     if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId))
    1806         return false;
    1807 
    18081765    bool lowerBound = range && range->lower();
    18091766    bool upperBound = range && range->upper();
  • trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h

    r145435 r145441  
    6969    virtual bool deleteDatabase(const String& name);
    7070
    71     bool getObjectStores(int64_t databaseId, IDBDatabaseMetadata::ObjectStoreMap*) WARN_UNUSED_RETURN;
     71    void getObjectStores(int64_t databaseId, IDBDatabaseMetadata::ObjectStoreMap*);
    7272    virtual bool createObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement);
    7373    virtual bool deleteObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId) WARN_UNUSED_RETURN;
     
    9090    virtual bool getRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, Vector<char>& record) WARN_UNUSED_RETURN;
    9191    virtual bool putRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, PassRefPtr<SharedBuffer> value, RecordIdentifier*) WARN_UNUSED_RETURN;
    92     virtual bool clearObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId) WARN_UNUSED_RETURN;
    93     virtual bool deleteRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&) WARN_UNUSED_RETURN;
     92    virtual void clearObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId);
     93    virtual void deleteRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&);
    9494    virtual bool getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t& currentNumber) WARN_UNUSED_RETURN;
    9595    virtual bool maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newState, bool checkCurrent) WARN_UNUSED_RETURN;
    9696    virtual bool keyExistsInObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier, bool& found) WARN_UNUSED_RETURN;
    9797
    98     virtual bool createIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry) WARN_UNUSED_RETURN;
    99     virtual bool deleteIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId) WARN_UNUSED_RETURN;
    100     virtual bool putIndexDataForRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const RecordIdentifier&) WARN_UNUSED_RETURN;
     98    virtual bool createIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry);
     99    virtual void deleteIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId);
     100    virtual void putIndexDataForRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const RecordIdentifier&);
    101101    virtual bool getPrimaryKeyViaIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, RefPtr<IDBKey>& primaryKey) WARN_UNUSED_RETURN;
    102102    virtual bool keyExistsInIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& indexKey, RefPtr<IDBKey>& foundPrimaryKey, bool& exists) WARN_UNUSED_RETURN;
     
    179179private:
    180180    bool findKeyInIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, Vector<char>& foundEncodedPrimaryKey, bool& found);
    181     bool getIndexes(int64_t databaseId, int64_t objectStoreId, IDBObjectStoreMetadata::IndexMap*) WARN_UNUSED_RETURN;
     181    void getIndexes(int64_t databaseId, int64_t objectStoreId, IDBObjectStoreMetadata::IndexMap*);
    182182
    183183    String m_identifier;
  • trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp

    r145435 r145441  
    180180class DeleteIndexOperation : public IDBTransactionBackendImpl::Operation {
    181181public:
    182     static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBBackingStore> backingStore, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
    183     {
    184         return adoptPtr(new DeleteIndexOperation(backingStore, objectStoreId, indexMetadata));
    185     }
    186     virtual void perform(IDBTransactionBackendImpl*);
    187 private:
    188     DeleteIndexOperation(PassRefPtr<IDBBackingStore> backingStore, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
     182    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBBackingStore> backingStore, int64_t objectStoreId, int64_t indexId)
     183    {
     184        return adoptPtr(new DeleteIndexOperation(backingStore, objectStoreId, indexId));
     185    }
     186    virtual void perform(IDBTransactionBackendImpl*);
     187private:
     188    DeleteIndexOperation(PassRefPtr<IDBBackingStore> backingStore, int64_t objectStoreId, int64_t indexId)
    189189        : m_backingStore(backingStore)
    190190        , m_objectStoreId(objectStoreId)
    191         , m_indexMetadata(indexMetadata)
     191        , m_indexId(indexId)
    192192    {
    193193    }
     
    195195    const RefPtr<IDBBackingStore> m_backingStore;
    196196    const int64_t m_objectStoreId;
    197     const IDBIndexMetadata m_indexMetadata;
     197    const int64_t m_indexId;
    198198};
    199199
     
    535535    if (!ok)
    536536        return false;
    537     if (success)
    538         return m_backingStore->getObjectStores(m_metadata.id, &m_metadata.objectStores);
    539 
     537    if (success) {
     538        m_backingStore->getObjectStores(m_metadata.id, &m_metadata.objectStores);
     539        return true;
     540    }
    540541    return m_backingStore->createIDBDatabaseMetaData(m_metadata.name, m_metadata.version, m_metadata.intVersion, m_metadata.id);
    541542}
     
    640641    const IDBIndexMetadata& indexMetadata = objectStore.indexes.get(indexId);
    641642
    642     transaction->scheduleTask(DeleteIndexOperation::create(m_backingStore, objectStoreId, indexMetadata), DeleteIndexAbortOperation::create(this, objectStoreId, indexMetadata));
     643    transaction->scheduleTask(DeleteIndexOperation::create(m_backingStore, objectStoreId, indexId), DeleteIndexAbortOperation::create(this, objectStoreId, indexMetadata));
    643644
    644645    removeIndex(objectStoreId, indexId);
     
    648649{
    649650    IDB_TRACE("DeleteIndexOperation");
    650     bool ok = m_backingStore->deleteIndex(transaction->backingStoreTransaction(), transaction->database()->id(), m_objectStoreId, m_indexMetadata.id);
    651     if (!ok) {
    652         RefPtr<IDBDatabaseError> error = IDBDatabaseError::create(IDBDatabaseException::UnknownError, String::format("Internal error deleting index '%s'.", m_indexMetadata.name.utf8().data()));
    653         transaction->abort(error);
    654     }
     651    m_backingStore->deleteIndex(transaction->backingStoreTransaction(), transaction->database()->id(), m_objectStoreId, m_indexId);
    655652}
    656653
     
    10271024    if (backingStoreCursor) {
    10281025        do {
    1029             if (!m_backingStore->deleteRecord(transaction->backingStoreTransaction(), m_databaseId, m_objectStoreId, backingStoreCursor->recordIdentifier())) {
    1030                 m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Error deleting data in range"));
    1031                 return;
    1032             }
     1026            m_backingStore->deleteRecord(transaction->backingStoreTransaction(), m_databaseId, m_objectStoreId, backingStoreCursor->recordIdentifier());
    10331027        } while (backingStoreCursor->continueFunction(0));
    10341028    }
     
    10511045{
    10521046    IDB_TRACE("ObjectStoreClearOperation");
    1053     if (!m_backingStore->clearObjectStore(transaction->backingStoreTransaction(), m_databaseId, m_objectStoreId)) {
    1054         m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Error clearing object store"));
    1055         return;
    1056     }
     1047    m_backingStore->clearObjectStore(transaction->backingStoreTransaction(), m_databaseId, m_objectStoreId);
    10571048    m_callbacks->onSuccess();
    10581049}
  • trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp

    r145435 r145441  
    974974}
    975975
    976 KeyPrefix::KeyPrefix(int64_t databaseId)
    977     : m_databaseId(databaseId)
    978     , m_objectStoreId(0)
    979     , m_indexId(0)
    980 {
    981     ASSERT(KeyPrefix::isValidDatabaseId(databaseId));
    982 }
    983 
    984 KeyPrefix::KeyPrefix(int64_t databaseId, int64_t objectStoreId)
    985     : m_databaseId(databaseId)
    986     , m_objectStoreId(objectStoreId)
    987     , m_indexId(0)
    988 {
    989     ASSERT(KeyPrefix::isValidDatabaseId(databaseId));
    990     ASSERT(KeyPrefix::isValidObjectStoreId(objectStoreId));
    991 }
    992 
    993976KeyPrefix::KeyPrefix(int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    994977    : m_databaseId(databaseId)
     
    996979    , m_indexId(indexId)
    997980{
    998     ASSERT(KeyPrefix::isValidDatabaseId(databaseId));
    999     ASSERT(KeyPrefix::isValidObjectStoreId(objectStoreId));
    1000     ASSERT(KeyPrefix::isValidIndexId(indexId));
    1001 }
    1002 
    1003 KeyPrefix::KeyPrefix(Type type, int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    1004     : m_databaseId(databaseId)
    1005     , m_objectStoreId(objectStoreId)
    1006     , m_indexId(indexId)
    1007 {
    1008     ASSERT(type == InvalidType);
    1009     ASSERT(KeyPrefix::isValidDatabaseId(databaseId));
    1010     ASSERT(KeyPrefix::isValidObjectStoreId(objectStoreId));
    1011 }
    1012 
    1013 
    1014 KeyPrefix KeyPrefix::createWithSpecialIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    1015 {
    1016     ASSERT(KeyPrefix::isValidDatabaseId(databaseId));
    1017     ASSERT(KeyPrefix::isValidObjectStoreId(objectStoreId));
    1018     ASSERT(indexId);
    1019     return KeyPrefix(InvalidType, databaseId, objectStoreId, indexId);
    1020 }
    1021 
    1022 
    1023 bool KeyPrefix::isValidDatabaseId(int64_t databaseId)
    1024 {
    1025     return (databaseId > 0) && (databaseId < KeyPrefix::kMaxDatabaseId);
    1026 }
    1027 
    1028 bool KeyPrefix::isValidObjectStoreId(int64_t objectStoreId)
    1029 {
    1030     return (objectStoreId > 0) && (objectStoreId < KeyPrefix::kMaxObjectStoreId);
    1031 }
    1032 
    1033 bool KeyPrefix::isValidIndexId(int64_t indexId)
    1034 {
    1035     return (indexId >= MinimumIndexId) && (indexId < KeyPrefix::kMaxIndexId);
    1036981}
    1037982
     
    10601005}
    10611006
    1062 Vector<char> KeyPrefix::encodeEmpty()
    1063 {
    1064     const Vector<char, 4> result(4, 0);
    1065     ASSERT(encodeInternal(0, 0, 0) == Vector<char>(4, 0));
    1066     return result;
    1067 }
    1068 
    10691007Vector<char> KeyPrefix::encode() const
    10701008{
     
    10721010    ASSERT(m_objectStoreId != InvalidId);
    10731011    ASSERT(m_indexId != InvalidId);
    1074     return encodeInternal(m_databaseId, m_objectStoreId, m_indexId);
    1075 }
    1076 
    1077 Vector<char> KeyPrefix::encodeInternal(int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    1078 {
    1079     Vector<char> databaseIdString = encodeIntSafely(databaseId, kMaxDatabaseId);
    1080     Vector<char> objectStoreIdString = encodeIntSafely(objectStoreId, kMaxObjectStoreId);
    1081     Vector<char> indexIdString = encodeIntSafely(indexId, kMaxIndexId);
    1082 
    1083     ASSERT(databaseIdString.size() <= kMaxDatabaseIdSizeBytes);
    1084     ASSERT(objectStoreIdString.size() <= kMaxObjectStoreIdSizeBytes);
    1085     ASSERT(indexIdString.size() <= kMaxIndexIdSizeBytes);
    1086 
    1087     unsigned char firstByte = (databaseIdString.size() - 1) << (kMaxObjectStoreIdSizeBits + kMaxIndexIdSizeBits) | (objectStoreIdString.size() - 1) << kMaxIndexIdSizeBits | (indexIdString.size() - 1);
    1088     COMPILE_ASSERT(kMaxDatabaseIdSizeBits + kMaxObjectStoreIdSizeBits + kMaxIndexIdSizeBits == sizeof(firstByte) * 8, CANT_ENCODE_IDS);
     1012
     1013    Vector<char> databaseIdString = encodeInt(m_databaseId);
     1014    Vector<char> objectStoreIdString = encodeInt(m_objectStoreId);
     1015    Vector<char> indexIdString = encodeInt(m_indexId);
     1016
     1017    ASSERT(databaseIdString.size() <= 8);
     1018    ASSERT(objectStoreIdString.size() <= 8);
     1019    ASSERT(indexIdString.size() <= 4);
     1020
     1021
     1022    unsigned char firstByte = (databaseIdString.size() - 1) << 5 | (objectStoreIdString.size() - 1) << 2 | (indexIdString.size() - 1);
    10891023    Vector<char, DefaultInlineBufferSize> ret;
    10901024    ret.append(firstByte);
     
    11351069Vector<char> SchemaVersionKey::encode()
    11361070{
    1137     Vector<char> ret = KeyPrefix::encodeEmpty();
     1071    KeyPrefix prefix(0, 0, 0);
     1072    Vector<char> ret = prefix.encode();
    11381073    ret.append(encodeByte(SchemaVersionTypeByte));
    11391074    return ret;
     
    11421077Vector<char> MaxDatabaseIdKey::encode()
    11431078{
    1144     Vector<char> ret = KeyPrefix::encodeEmpty();
     1079    KeyPrefix prefix(0, 0, 0);
     1080    Vector<char> ret = prefix.encode();
    11451081    ret.append(encodeByte(MaxDatabaseIdTypeByte));
    11461082    return ret;
     
    11491085Vector<char> DataVersionKey::encode()
    11501086{
    1151     Vector<char> ret = KeyPrefix::encodeEmpty();
     1087    KeyPrefix prefix(0, 0, 0);
     1088    Vector<char> ret = prefix.encode();
    11521089    ret.append(encodeByte(DataVersionTypeByte));
    11531090    return ret;
     
    11801117Vector<char> DatabaseFreeListKey::encode(int64_t databaseId)
    11811118{
    1182     Vector<char> ret = KeyPrefix::encodeEmpty();
     1119    KeyPrefix prefix(0, 0, 0);
     1120    Vector<char> ret = prefix.encode();
    11831121    ret.append(encodeByte(DatabaseFreeListTypeByte));
    11841122    ret.append(encodeVarInt(databaseId));
     
    12271165Vector<char> DatabaseNameKey::encode(const String& origin, const String& databaseName)
    12281166{
    1229     Vector<char> ret = KeyPrefix::encodeEmpty();
     1167    KeyPrefix prefix(0, 0, 0);
     1168    Vector<char> ret = prefix.encode();
    12301169    ret.append(encodeByte(DatabaseNameTypeByte));
    12311170    ret.append(encodeStringWithLength(origin));
     
    12541193Vector<char> DatabaseMetaDataKey::encode(int64_t databaseId, MetaDataType metaDataType)
    12551194{
    1256     KeyPrefix prefix(databaseId);
     1195    KeyPrefix prefix(databaseId, 0, 0);
    12571196    Vector<char> ret = prefix.encode();
    12581197    ret.append(encodeByte(metaDataType));
     
    12931232Vector<char> ObjectStoreMetaDataKey::encode(int64_t databaseId, int64_t objectStoreId, unsigned char metaDataType)
    12941233{
    1295     KeyPrefix prefix(databaseId);
     1234    KeyPrefix prefix(databaseId, 0, 0);
    12961235    Vector<char> ret = prefix.encode();
    12971236    ret.append(encodeByte(ObjectStoreMetaDataTypeByte));
     
    13681307Vector<char> IndexMetaDataKey::encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId, unsigned char metaDataType)
    13691308{
    1370     KeyPrefix prefix(databaseId);
     1309    KeyPrefix prefix(databaseId, 0, 0);
    13711310    Vector<char> ret = prefix.encode();
    13721311    ret.append(encodeByte(IndexMetaDataTypeByte));
     
    14311370Vector<char> ObjectStoreFreeListKey::encode(int64_t databaseId, int64_t objectStoreId)
    14321371{
    1433     KeyPrefix prefix(databaseId);
     1372    KeyPrefix prefix(databaseId, 0, 0);
    14341373    Vector<char> ret = prefix.encode();
    14351374    ret.append(encodeByte(ObjectStoreFreeListTypeByte));
     
    14881427Vector<char> IndexFreeListKey::encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    14891428{
    1490     KeyPrefix prefix(databaseId);
     1429    KeyPrefix prefix(databaseId, 0, 0);
    14911430    Vector<char> ret = prefix.encode();
    14921431    ret.append(encodeByte(IndexFreeListTypeByte));
     
    15441483Vector<char> ObjectStoreNamesKey::encode(int64_t databaseId, const String& objectStoreName)
    15451484{
    1546     KeyPrefix prefix(databaseId);
     1485    KeyPrefix prefix(databaseId, 0, 0);
    15471486    Vector<char> ret = prefix.encode();
    15481487    ret.append(encodeByte(ObjectStoreNamesTypeByte));
     
    15871526Vector<char> IndexNamesKey::encode(int64_t databaseId, int64_t objectStoreId, const String& indexName)
    15881527{
    1589     KeyPrefix prefix(databaseId);
     1528    KeyPrefix prefix(databaseId, 0, 0);
    15901529    Vector<char> ret = prefix.encode();
    15911530    ret.append(encodeByte(IndexNamesKeyTypeByte));
     
    16191558Vector<char> ObjectStoreDataKey::encode(int64_t databaseId, int64_t objectStoreId, const Vector<char> encodedUserKey)
    16201559{
    1621     KeyPrefix prefix(KeyPrefix::createWithSpecialIndex(databaseId, objectStoreId, SpecialIndexNumber));
     1560    KeyPrefix prefix(databaseId, objectStoreId, SpecialIndexNumber);
    16221561    Vector<char> ret = prefix.encode();
    16231562    ret.append(encodedUserKey);
     
    16611600Vector<char> ExistsEntryKey::encode(int64_t databaseId, int64_t objectStoreId, const Vector<char>& encodedKey)
    16621601{
    1663     KeyPrefix prefix(KeyPrefix::createWithSpecialIndex(databaseId, objectStoreId, SpecialIndexNumber));
     1602    KeyPrefix prefix(databaseId, objectStoreId, SpecialIndexNumber);
    16641603    Vector<char> ret = prefix.encode();
    16651604    ret.append(encodedKey);
  • trunk/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.h

    r145435 r145441  
    5555bool decodeBool(const char* begin, const char* end);
    5656Vector<char> encodeInt(int64_t);
    57 inline Vector<char> encodeIntSafely(int64_t nParam, size_t max)
    58 {
    59     ASSERT(static_cast<size_t>(nParam) <= max);
    60     return encodeInt(nParam);
    61 }
    6257int64_t decodeInt(const char* begin, const char* end);
    6358Vector<char> encodeVarInt(int64_t);
     
    8378public:
    8479    KeyPrefix();
    85     explicit KeyPrefix(int64_t databaseId);
    86     KeyPrefix(int64_t databaseId, int64_t objectStoreId);
    8780    KeyPrefix(int64_t databaseId, int64_t objectStoreId, int64_t indexId);
    88     static KeyPrefix createWithSpecialIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId);
    8981
    9082    static const char* decode(const char* start, const char* limit, KeyPrefix* result);
    9183    Vector<char> encode() const;
    92     static Vector<char> encodeEmpty();
    9384    int compare(const KeyPrefix& other) const;
    9485
     
    10293    };
    10394
    104     static const size_t kMaxDatabaseIdSizeBits = 3;
    105     static const size_t kMaxObjectStoreIdSizeBits = 3;
    106     static const size_t kMaxIndexIdSizeBits = 2;
    107 
    108     static const size_t kMaxDatabaseIdSizeBytes = 1ULL << kMaxDatabaseIdSizeBits; // 8
    109     static const size_t kMaxObjectStoreIdSizeBytes = 1ULL << kMaxObjectStoreIdSizeBits; // 8
    110     static const size_t kMaxIndexIdSizeBytes = 1ULL << kMaxIndexIdSizeBits; // 4
    111 
    112     static const size_t kMaxDatabaseIdBits = kMaxDatabaseIdSizeBytes * 8 - 1; // 63
    113     static const size_t kMaxObjectStoreIdBits = kMaxObjectStoreIdSizeBytes * 8 - 1; // 63
    114     static const size_t kMaxIndexIdBits = kMaxIndexIdSizeBytes * 8 - 1; // 31
    115 
    116     static const int64_t kMaxDatabaseId = (1ULL << kMaxDatabaseIdBits) - 1; // max signed int64_t
    117     static const int64_t kMaxObjectStoreId = (1ULL << kMaxObjectStoreIdBits) - 1; // max signed int64_t
    118     static const int64_t kMaxIndexId = (1ULL << kMaxIndexIdBits) - 1; // max signed int32_t
    119 
    120     static bool isValidDatabaseId(int64_t databaseId);
    121     static bool isValidObjectStoreId(int64_t indexId);
    122     static bool isValidIndexId(int64_t indexId);
    123     static bool validIds(int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    124     {
    125         return isValidDatabaseId(databaseId) && isValidObjectStoreId(objectStoreId) && isValidIndexId(indexId);
    126     }
    127     static bool validIds(int64_t databaseId, int64_t objectStoreId)
    128     {
    129         return isValidDatabaseId(databaseId) && isValidObjectStoreId(objectStoreId);
    130     }
    131 
    13295    Type type() const;
    13396
     
    137100
    138101    static const int64_t InvalidId = -1;
    139 
    140 private:
    141     static Vector<char> encodeInternal(int64_t databaseId, int64_t objectStoreId, int64_t indexId);
    142     // Special constructor for createWithSpecialIndex()
    143     KeyPrefix(Type, int64_t databaseId, int64_t objectStoreId, int64_t indexId);
    144102};
    145103
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp

    r145435 r145441  
    6565    int64_t indexId = m_indexMetadata.id;
    6666    for (size_t i = 0; i < m_indexKeys.size(); ++i) {
    67         bool ok = backingStore.putIndexDataForRecord(transaction, databaseId, objectStoreId, indexId, *(m_indexKeys)[i].get(), recordIdentifier);
    68         // This should have already been verified as a valid write during verifyIndexKeys.
    69         ASSERT_UNUSED(ok, ok);
     67        backingStore.putIndexDataForRecord(transaction, databaseId, objectStoreId, indexId, *(m_indexKeys)[i].get(), recordIdentifier);
    7068    }
    7169}
  • trunk/Source/WebKit/chromium/ChangeLog

    r145435 r145441  
     12013-03-11  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r145435.
     4        http://trac.webkit.org/changeset/145435
     5        https://bugs.webkit.org/show_bug.cgi?id=112082
     6
     7        Still does not compile (Requested by jamesr on #webkit).
     8
     9        * tests/IDBBackingStoreTest.cpp:
     10        (WebCore::IDBBackingStoreTest::SetUp):
     11        (IDBBackingStoreTest):
     12        (WebCore::TEST_F):
     13        * tests/IDBFakeBackingStore.h:
     14        * tests/IDBLevelDBCodingTest.cpp:
     15        (IDBLevelDBCoding):
     16        (IDBLevelDBCoding::TEST):
     17
    1182013-03-11  Alec Flett  <alecflett@chromium.org>
    219
  • trunk/Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp

    r145435 r145441  
    2929
    3030#include "IDBFactoryBackendImpl.h"
    31 #include "IDBLevelDBCoding.h"
    3231#include "SharedBuffer.h"
    3332
     
    3837
    3938using namespace WebCore;
    40 using IDBLevelDBCoding::KeyPrefix;
    4139
    4240namespace {
     
    5654        const char rawValue1[] = "value1";
    5755        const char rawValue2[] = "value2";
    58         const char rawValue3[] = "value3";
    5956        m_value1.append(rawValue1, sizeof(rawValue1));
    6057        m_value2.append(rawValue2, sizeof(rawValue2));
    61         m_value3.append(rawValue3, sizeof(rawValue3));
    6258        m_key1 = IDBKey::createNumber(99);
    6359        m_key2 = IDBKey::createString("key2");
    64         m_key3 = IDBKey::createString("key3");
    6560    }
    6661
     
    7166    RefPtr<IDBKey> m_key1;
    7267    RefPtr<IDBKey> m_key2;
    73     RefPtr<IDBKey> m_key3;
    7468    Vector<char> m_value1;
    7569    Vector<char> m_value2;
    76     Vector<char> m_value3;
    7770};
    7871
     
    10497    const int64_t highDatabaseId = 1ULL << 35;
    10598    const int64_t highObjectStoreId = 1ULL << 39;
    106     // indexIds are capped at 32 bits for storage purposes.
    107     const int64_t highIndexId = 1ULL << 29;
    108 
    109     const int64_t invalidHighIndexId = 1ULL << 37;
    110 
    111     const RefPtr<IDBKey> indexKey = m_key2;
    112     Vector<char> indexKeyRaw = IDBLevelDBCoding::encodeIDBKey(*indexKey);
    11399    {
    114100        IDBBackingStore::Transaction transaction1(m_backingStore.get());
     
    117103        bool ok = m_backingStore->putRecord(&transaction1, highDatabaseId, highObjectStoreId, *m_key1.get(), SharedBuffer::create(m_value1.data(), m_value1.size()), &record);
    118104        EXPECT_TRUE(ok);
    119 
    120         ok = m_backingStore->putIndexDataForRecord(&transaction1, highDatabaseId, highObjectStoreId, invalidHighIndexId, *indexKey, record);
    121         EXPECT_FALSE(ok);
    122 
    123         ok = m_backingStore->putIndexDataForRecord(&transaction1, highDatabaseId, highObjectStoreId, highIndexId, *indexKey, record);
    124         EXPECT_TRUE(ok);
    125 
    126105        ok = transaction1.commit();
    127106        EXPECT_TRUE(ok);
     
    134113        bool ok = m_backingStore->getRecord(&transaction2, highDatabaseId, highObjectStoreId, *m_key1.get(), resultValue);
    135114        EXPECT_TRUE(ok);
     115        ok = transaction2.commit();
     116        EXPECT_TRUE(ok);
    136117        EXPECT_EQ(m_value1, resultValue);
    137 
    138         RefPtr<IDBKey> newPrimaryKey;
    139         ok = m_backingStore->getPrimaryKeyViaIndex(&transaction2, highDatabaseId, highObjectStoreId, invalidHighIndexId, *indexKey, newPrimaryKey);
    140         EXPECT_FALSE(ok);
    141 
    142         ok = m_backingStore->getPrimaryKeyViaIndex(&transaction2, highDatabaseId, highObjectStoreId, highIndexId, *indexKey, newPrimaryKey);
    143         EXPECT_TRUE(ok);
    144         EXPECT_TRUE(newPrimaryKey->isEqual(m_key1.get()));
    145 
    146         ok = transaction2.commit();
    147         EXPECT_TRUE(ok);
    148     }
    149 }
    150 
    151 // Make sure that other invalid ids do not crash.
    152 TEST_F(IDBBackingStoreTest, InvalidIds)
    153 {
    154     // valid ids for use when testing invalid ids
    155     const int64_t databaseId = 1;
    156     const int64_t objectStoreId = 1;
    157     const int64_t indexId = IDBLevelDBCoding::MinimumIndexId;
    158     const int64_t invalidLowIndexId = 19; // indexIds must be > IDBLevelDBCoding::MinimumIndexId
    159 
    160     const RefPtr<SharedBuffer> value = SharedBuffer::create(m_value1.data(), m_value1.size());
    161     Vector<char> resultValue;
    162 
    163     IDBBackingStore::Transaction transaction1(m_backingStore.get());
    164     transaction1.begin();
    165 
    166     IDBBackingStore::RecordIdentifier record;
    167     bool ok = m_backingStore->putRecord(&transaction1, databaseId, KeyPrefix::InvalidId, *m_key1.get(), value, &record);
    168     EXPECT_FALSE(ok);
    169     ok = m_backingStore->putRecord(&transaction1, databaseId, 0, *m_key1.get(), value, &record);
    170     EXPECT_FALSE(ok);
    171     ok = m_backingStore->putRecord(&transaction1, KeyPrefix::InvalidId, objectStoreId, *m_key1.get(), value, &record);
    172     EXPECT_FALSE(ok);
    173     ok = m_backingStore->putRecord(&transaction1, 0, objectStoreId, *m_key1.get(), value, &record);
    174     EXPECT_FALSE(ok);
    175 
    176     ok = m_backingStore->getRecord(&transaction1, databaseId, KeyPrefix::InvalidId, *m_key1.get(), resultValue);
    177     EXPECT_FALSE(ok);
    178     ok = m_backingStore->getRecord(&transaction1, databaseId, 0, *m_key1.get(), resultValue);
    179     EXPECT_FALSE(ok);
    180     ok = m_backingStore->getRecord(&transaction1, KeyPrefix::InvalidId, objectStoreId, *m_key1.get(), resultValue);
    181     EXPECT_FALSE(ok);
    182     ok = m_backingStore->getRecord(&transaction1, 0, objectStoreId, *m_key1.get(), resultValue);
    183     EXPECT_FALSE(ok);
    184 
    185     RefPtr<IDBKey> newPrimaryKey;
    186     ok = m_backingStore->getPrimaryKeyViaIndex(&transaction1, databaseId, objectStoreId, KeyPrefix::InvalidId, *m_key1, newPrimaryKey);
    187     EXPECT_FALSE(ok);
    188     ok = m_backingStore->getPrimaryKeyViaIndex(&transaction1, databaseId, objectStoreId, invalidLowIndexId, *m_key1, newPrimaryKey);
    189     EXPECT_FALSE(ok);
    190     ok = m_backingStore->getPrimaryKeyViaIndex(&transaction1, databaseId, objectStoreId, 0, *m_key1, newPrimaryKey);
    191     EXPECT_FALSE(ok);
    192 
    193     ok = m_backingStore->getPrimaryKeyViaIndex(&transaction1, KeyPrefix::InvalidId, objectStoreId, indexId, *m_key1, newPrimaryKey);
    194     EXPECT_FALSE(ok);
    195     ok = m_backingStore->getPrimaryKeyViaIndex(&transaction1, databaseId, KeyPrefix::InvalidId, indexId, *m_key1, newPrimaryKey);
    196     EXPECT_FALSE(ok);
     118    }
    197119}
    198120
     
    245167        EXPECT_EQ(databaseId, database.id);
    246168
    247         ok = m_backingStore->getObjectStores(database.id, &database.objectStores);
    248         EXPECT_TRUE(ok);
     169        m_backingStore->getObjectStores(database.id, &database.objectStores);
    249170
    250171        EXPECT_EQ(1, database.objectStores.size());
  • trunk/Source/WebKit/chromium/tests/IDBFakeBackingStore.h

    r145435 r145441  
    4242    virtual bool createObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const String& name, const IDBKeyPath&, bool autoIncrement) OVERRIDE { return false; };
    4343
    44     virtual bool clearObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { return false; }
    45     virtual bool deleteRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&) OVERRIDE { return false; }
     44    virtual void clearObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { }
     45    virtual void deleteRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&) OVERRIDE { }
    4646    virtual bool getKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t& currentNumber) OVERRIDE { return true; }
    4747    virtual bool maybeUpdateKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) OVERRIDE { return true; }
     
    4949
    5050    virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry) OVERRIDE { return false; };
    51     virtual bool deleteIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId) OVERRIDE { return false; }
    52     virtual bool putIndexDataForRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const RecordIdentifier&) OVERRIDE { return false; }
     51    virtual void deleteIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId) OVERRIDE { }
     52    virtual void putIndexDataForRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const RecordIdentifier&) OVERRIDE { }
    5353
    5454    virtual PassRefPtr<Cursor> openObjectStoreKeyCursor(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKeyRange*, IndexedDB::CursorDirection) OVERRIDE { return PassRefPtr<Cursor>(); }
  • trunk/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp

    r145435 r145441  
    102102    }
    103103}
    104 
     104   
    105105TEST(IDBLevelDBCodingTest, EncodeBool)
    106106{
     
    712712    keys.append(IndexDataKey::encode(1, 1, 31, minIDBKey(), minIDBKey(), 0));
    713713    keys.append(IndexDataKey::encode(1, 2, 30, minIDBKey(), minIDBKey(), 0));
    714     keys.append(IndexDataKey::encodeMaxKey(1, 2, INT32_MAX - 1));
     714    keys.append(IndexDataKey::encodeMaxKey(1, 2, INT32_MAX));
    715715
    716716    for (size_t i = 0; i < keys.size(); ++i) {
Note: See TracChangeset for help on using the changeset viewer.