Changeset 195527 in webkit


Ignore:
Timestamp:
Jan 24, 2016 11:55:17 PM (8 years ago)
Author:
beidson@apple.com
Message:

Modern IDB: Implement deleteIndex and getCount for the SQLite backing store.
https://bugs.webkit.org/show_bug.cgi?id=153415

Reviewed by Darin Adler.

Source/WebCore:

No new tests (Handful of tests now pass, improvements on a handful of others).

  • Modules/indexeddb/server/IDBBackingStore.h:
  • Modules/indexeddb/server/MemoryIDBBackingStore.cpp:

(WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):

  • Modules/indexeddb/server/MemoryIDBBackingStore.h:
  • Modules/indexeddb/server/MemoryObjectStore.cpp:

(WebCore::IDBServer::MemoryObjectStore::takeIndexByIdentifier):
(WebCore::IDBServer::MemoryObjectStore::deleteIndex):
(WebCore::IDBServer::MemoryObjectStore::deleteAllIndexes):
(WebCore::IDBServer::MemoryObjectStore::takeIndexByName): Deleted.

  • Modules/indexeddb/server/MemoryObjectStore.h:
  • Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:

(WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::getCount):

  • Modules/indexeddb/server/SQLiteIDBBackingStore.h:
  • Modules/indexeddb/server/SQLiteIDBCursor.cpp:

(WebCore::IDBServer::SQLiteIDBCursor::maybeCreateBackingStoreCursor):
(WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):

  • Modules/indexeddb/server/SQLiteIDBCursor.h:
  • Modules/indexeddb/server/SQLiteIDBTransaction.cpp:

(WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor):

  • Modules/indexeddb/server/SQLiteIDBTransaction.h:
  • Modules/indexeddb/server/UniqueIDBDatabase.cpp:

(WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
(WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteIndex):

  • Modules/indexeddb/server/UniqueIDBDatabase.h:
  • Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:

(WebCore::IDBObjectStoreInfo::deleteIndex):

  • Modules/indexeddb/shared/IDBObjectStoreInfo.h:

LayoutTests:

  • platform/mac-wk1/TestExpectations:
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r195521 r195527  
     12016-01-24  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: Implement deleteIndex and getCount for the SQLite backing store.
     4        https://bugs.webkit.org/show_bug.cgi?id=153415
     5
     6        Reviewed by Darin Adler.
     7
     8        * platform/mac-wk1/TestExpectations:
     9
    1102016-01-24  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r195517 r195527  
    495495storage/indexeddb/modern/idbobjectstore-clear-1.html [ Failure ]
    496496storage/indexeddb/modern/idbobjectstore-clear-2.html [ Failure ]
    497 storage/indexeddb/modern/idbobjectstore-count-1.html [ Failure ]
    498497storage/indexeddb/modern/idbobjectstore-delete-1.html [ Failure ]
    499498storage/indexeddb/modern/index-1.html [ Failure ]
     
    505504storage/indexeddb/modern/index-cursor-3.html [ Failure ]
    506505storage/indexeddb/modern/index-get-count-basic.html [ Failure ]
    507 storage/indexeddb/modern/index-get-count-failures.html [ Failure ]
    508506storage/indexeddb/modern/objectstore-cursor-advance-failures.html [ Failure ]
    509507storage/indexeddb/modern/objectstore-cursor-continue-failures.html [ Failure ]
     
    531529storage/indexeddb/objectstore-basics.html [ Failure ]
    532530storage/indexeddb/objectstore-clear.html [ Failure ]
    533 storage/indexeddb/objectstore-count.html [ Failure ]
    534531storage/indexeddb/objectstore-cursor.html [ Failure ]
    535532storage/indexeddb/open-cursor.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r195525 r195527  
     12016-01-24  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: Implement deleteIndex and getCount for the SQLite backing store.
     4        https://bugs.webkit.org/show_bug.cgi?id=153415
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests (Handful of tests now pass, improvements on a handful of others).
     9
     10        * Modules/indexeddb/server/IDBBackingStore.h:
     11       
     12        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
     13        (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):
     14        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
     15       
     16        * Modules/indexeddb/server/MemoryObjectStore.cpp:
     17        (WebCore::IDBServer::MemoryObjectStore::takeIndexByIdentifier):
     18        (WebCore::IDBServer::MemoryObjectStore::deleteIndex):
     19        (WebCore::IDBServer::MemoryObjectStore::deleteAllIndexes):
     20        (WebCore::IDBServer::MemoryObjectStore::takeIndexByName): Deleted.
     21        * Modules/indexeddb/server/MemoryObjectStore.h:
     22       
     23        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
     24        (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
     25        (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
     26        (WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
     27        * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
     28       
     29        * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
     30        (WebCore::IDBServer::SQLiteIDBCursor::maybeCreateBackingStoreCursor):
     31        (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
     32        * Modules/indexeddb/server/SQLiteIDBCursor.h:
     33       
     34        * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
     35        (WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor):
     36        * Modules/indexeddb/server/SQLiteIDBTransaction.h:
     37       
     38        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
     39        (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
     40        (WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex):
     41        (WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteIndex):
     42        * Modules/indexeddb/server/UniqueIDBDatabase.h:
     43       
     44        * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
     45        (WebCore::IDBObjectStoreInfo::deleteIndex):
     46        * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
     47
    1482016-01-24  Brady Eidson  <beidson@apple.com>
    249
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h

    r195499 r195527  
    6565    virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
    6666    virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) = 0;
    67     virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) = 0;
     67    virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) = 0;
    6868    virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0;
    6969    virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0;
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp

    r195467 r195527  
    205205}
    206206
    207 IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName)
     207IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier)
    208208{
    209209    LOG(IndexedDB, "MemoryIDBBackingStore::deleteIndex");
     
    217217        return IDBError(IDBDatabaseException::ConstraintError);
    218218
    219     return objectStore->deleteIndex(*rawTransaction, indexName);
     219    return objectStore->deleteIndex(*rawTransaction, indexIdentifier);
    220220}
    221221
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h

    r195499 r195527  
    5757    virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
    5858    virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) override final;
    59     virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) override final;
     59    virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) override final;
    6060    virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
    6161    virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp

    r194857 r195527  
    125125}
    126126
    127 RefPtr<MemoryIndex> MemoryObjectStore::takeIndexByName(const String& name)
    128 {
    129     auto indexByName = m_indexesByName.take(name);
    130     if (!indexByName)
     127RefPtr<MemoryIndex> MemoryObjectStore::takeIndexByIdentifier(uint64_t indexIdentifier)
     128{
     129    auto indexByIdentifier = m_indexesByIdentifier.take(indexIdentifier);
     130    if (!indexByIdentifier)
    131131        return nullptr;
    132132
    133     auto index = m_indexesByIdentifier.take(indexByName->info().identifier());
     133    auto index = m_indexesByName.take(indexByIdentifier->info().name());
    134134    ASSERT(index);
    135135
     
    137137}
    138138
    139 IDBError MemoryObjectStore::deleteIndex(MemoryBackingStoreTransaction& transaction, const String& indexName)
     139IDBError MemoryObjectStore::deleteIndex(MemoryBackingStoreTransaction& transaction, uint64_t indexIdentifier)
    140140{
    141141    LOG(IndexedDB, "MemoryObjectStore::deleteIndex");
     
    144144        return IDBError(IDBDatabaseException::ConstraintError);
    145145   
    146     auto index = takeIndexByName(indexName);
     146    auto index = takeIndexByIdentifier(indexIdentifier);
    147147    ASSERT(index);
    148148    if (!index)
    149149        return IDBError(IDBDatabaseException::ConstraintError);
    150150
    151     m_info.deleteIndex(indexName);
     151    m_info.deleteIndex(indexIdentifier);
    152152    transaction.indexDeleted(*index);
    153153
     
    157157void MemoryObjectStore::deleteAllIndexes(MemoryBackingStoreTransaction& transaction)
    158158{
    159     Vector<String> indexNames;
    160     indexNames.reserveInitialCapacity(m_indexesByName.size());
    161 
    162     for (auto& name : m_indexesByName.keys())
    163         indexNames.uncheckedAppend(name);
    164 
    165     for (auto& name : indexNames)
    166         deleteIndex(transaction, name);
     159    Vector<uint64_t> indexIdentifiers;
     160    indexIdentifiers.reserveInitialCapacity(m_indexesByName.size());
     161
     162    for (auto& index : m_indexesByName.values())
     163        indexIdentifiers.uncheckedAppend(index->info().identifier());
     164
     165    for (auto identifier : indexIdentifiers)
     166        deleteIndex(transaction, identifier);
    167167}
    168168
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h

    r194857 r195527  
    6767
    6868    IDBError createIndex(MemoryBackingStoreTransaction&, const IDBIndexInfo&);
    69     IDBError deleteIndex(MemoryBackingStoreTransaction&, const String& indexName);
     69    IDBError deleteIndex(MemoryBackingStoreTransaction&, uint64_t indexIdentifier);
    7070    void deleteAllIndexes(MemoryBackingStoreTransaction&);
    7171    void registerIndex(Ref<MemoryIndex>&&);
     
    109109    void updateCursorsForDeleteRecord(const IDBKeyData&);
    110110
    111     RefPtr<MemoryIndex> takeIndexByName(const String& name);
     111    RefPtr<MemoryIndex> takeIndexByIdentifier(uint64_t indexIdentifier);
    112112
    113113    IDBObjectStoreInfo m_info;
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp

    r195525 r195527  
    721721    // Write index records for any records that already exist in this object store.
    722722
    723     auto cursor = transaction->maybeOpenBackingStoreCursor(info.objectStoreIdentifier());
     723    auto cursor = transaction->maybeOpenBackingStoreCursor(info.objectStoreIdentifier(), 0, IDBKeyRangeData::allKeys());
    724724
    725725    if (!cursor) {
     
    850850
    851851
    852 IDBError SQLiteIDBBackingStore::deleteIndex(const IDBResourceIdentifier&, uint64_t, const String&)
    853 {
    854     return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
     852IDBError SQLiteIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier)
     853{
     854    LOG(IndexedDB, "SQLiteIDBBackingStore::deleteIndex - object store %" PRIu64, objectStoreIdentifier);
     855
     856    ASSERT(m_sqliteDB);
     857    ASSERT(m_sqliteDB->isOpen());
     858
     859    auto* transaction = m_transactions.get(transactionIdentifier);
     860    if (!transaction || !transaction->inProgress()) {
     861        LOG_ERROR("Attempt to delete index without an in-progress transaction");
     862        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index without an in-progress transaction") };
     863    }
     864
     865    if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
     866        LOG_ERROR("Attempt to delete index during a non-version-change transaction");
     867        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index during a non-version-change transaction") };
     868    }
     869
     870    {
     871        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM IndexInfo WHERE id = ? AND objectStoreID = ?;"));
     872        if (sql.prepare() != SQLITE_OK
     873            || sql.bindInt64(1, indexIdentifier) != SQLITE_OK
     874            || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK
     875            || sql.step() != SQLITE_DONE) {
     876            LOG_ERROR("Could not delete index id %" PRIi64 " from IndexInfo table (%i) - %s", objectStoreIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     877            return { IDBDatabaseException::UnknownError, ASCIILiteral("Error deleting index from database") };
     878        }
     879    }
     880
     881    {
     882        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM IndexRecords WHERE indexID = ? AND objectStoreID = ?;"));
     883        if (sql.prepare() != SQLITE_OK
     884            || sql.bindInt64(1, indexIdentifier) != SQLITE_OK
     885            || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK
     886            || sql.step() != SQLITE_DONE) {
     887            LOG_ERROR("Could not delete index records for index id %" PRIi64 " from IndexRecords table (%i) - %s", indexIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     888            return { IDBDatabaseException::UnknownError, ASCIILiteral("Error deleting index records from database") };
     889        }
     890    }
     891
     892    return { };
    855893}
    856894
     
    10941132}
    10951133
    1096 IDBError SQLiteIDBBackingStore::getCount(const IDBResourceIdentifier&, uint64_t, uint64_t, const IDBKeyRangeData&, uint64_t&)
    1097 {
    1098     return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
     1134IDBError SQLiteIDBBackingStore::getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, uint64_t& outCount)
     1135{
     1136    LOG(IndexedDB, "SQLiteIDBBackingStore::getCount - object store %" PRIu64, objectStoreIdentifier);
     1137    ASSERT(m_sqliteDB);
     1138    ASSERT(m_sqliteDB->isOpen());
     1139
     1140    outCount = 0;
     1141
     1142    auto* transaction = m_transactions.get(transactionIdentifier);
     1143    if (!transaction || !transaction->inProgress()) {
     1144        LOG_ERROR("Attempt to get count from database without an in-progress transaction");
     1145        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to get count from database without an in-progress transaction") };
     1146    }
     1147
     1148    auto cursor = transaction->maybeOpenBackingStoreCursor(objectStoreIdentifier, indexIdentifier, range);
     1149    if (!cursor) {
     1150        LOG_ERROR("Cannot open cursor to populate indexes in database");
     1151        return { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to populate indexes in database") };
     1152    }
     1153
     1154    while (cursor->advance(1))
     1155        ++outCount;
     1156
     1157    return { };
    10991158}
    11001159
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h

    r195517 r195527  
    6060    virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
    6161    virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) override final;
    62     virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) override final;
     62    virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) override final;
    6363    virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
    6464    virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp

    r195517 r195527  
    5252}
    5353
    54 std::unique_ptr<SQLiteIDBCursor> SQLiteIDBCursor::maybeCreateBackingStoreCursor(SQLiteIDBTransaction& transaction, const uint64_t objectStoreIdentifier)
    55 {
    56     auto cursor = std::make_unique<SQLiteIDBCursor>(transaction, objectStoreIdentifier);
     54std::unique_ptr<SQLiteIDBCursor> SQLiteIDBCursor::maybeCreateBackingStoreCursor(SQLiteIDBTransaction& transaction, const uint64_t objectStoreID, const uint64_t indexID, const IDBKeyRangeData& range)
     55{
     56    auto cursor = std::make_unique<SQLiteIDBCursor>(transaction, objectStoreID, indexID, range);
    5757
    5858    if (!cursor->establishStatement())
     
    7676}
    7777
    78 SQLiteIDBCursor::SQLiteIDBCursor(SQLiteIDBTransaction& transaction, uint64_t objectStoreID)
     78SQLiteIDBCursor::SQLiteIDBCursor(SQLiteIDBTransaction& transaction, const uint64_t objectStoreID, const uint64_t indexID, const IDBKeyRangeData& range)
    7979    : m_transaction(&transaction)
    8080    , m_cursorIdentifier(transaction.transactionIdentifier())
    8181    , m_objectStoreID(objectStoreID)
     82    , m_indexID(indexID ? indexID : IDBIndexMetadata::InvalidId)
    8283    , m_cursorDirection(IndexedDB::CursorDirection::Next)
     84    , m_keyRange(range)
    8385{
    8486    ASSERT(m_objectStoreID);
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h

    r195517 r195527  
    4747public:
    4848    static std::unique_ptr<SQLiteIDBCursor> maybeCreate(SQLiteIDBTransaction&, const IDBCursorInfo&);
    49     static std::unique_ptr<SQLiteIDBCursor> maybeCreateBackingStoreCursor(SQLiteIDBTransaction&, const uint64_t objectStoreIdentifier);
     49    static std::unique_ptr<SQLiteIDBCursor> maybeCreateBackingStoreCursor(SQLiteIDBTransaction&, const uint64_t objectStoreIdentifier, const uint64_t indexIdentifier, const IDBKeyRangeData&);
    5050
    5151    SQLiteIDBCursor(SQLiteIDBTransaction&, const IDBCursorInfo&);
    52     SQLiteIDBCursor(SQLiteIDBTransaction&, uint64_t objectStoreID);
     52    SQLiteIDBCursor(SQLiteIDBTransaction&, uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData&);
    5353
    5454    const IDBResourceIdentifier& identifier() const { return m_cursorIdentifier; }
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.cpp

    r195517 r195527  
    100100}
    101101
    102 std::unique_ptr<SQLiteIDBCursor> SQLiteIDBTransaction::maybeOpenBackingStoreCursor(uint64_t objectStoreID)
     102std::unique_ptr<SQLiteIDBCursor> SQLiteIDBTransaction::maybeOpenBackingStoreCursor(uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData& range)
    103103{
    104104    ASSERT(m_sqliteTransaction);
    105105    ASSERT(m_sqliteTransaction->inProgress());
    106106
    107     return SQLiteIDBCursor::maybeCreateBackingStoreCursor(*this, objectStoreID);
     107    return SQLiteIDBCursor::maybeCreateBackingStoreCursor(*this, objectStoreID, indexID, range);
    108108}
    109109
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBTransaction.h

    r195517 r195527  
    6060    IDBError abort();
    6161
    62     std::unique_ptr<SQLiteIDBCursor> maybeOpenBackingStoreCursor(uint64_t objectStoreID);
     62    std::unique_ptr<SQLiteIDBCursor> maybeOpenBackingStoreCursor(uint64_t objectStoreID, uint64_t indexID, const IDBKeyRangeData&);
    6363    SQLiteIDBCursor* maybeOpenCursor(const IDBCursorInfo&);
    6464
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp

    r195499 r195527  
    608608
    609609    uint64_t callbackID = storeCallback(callback);
    610     m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteIndex, callbackID, transaction.info().identifier(), objectStoreIdentifier, indexName));
    611 }
    612 
    613 void UniqueIDBDatabase::performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName)
     610
     611    auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
     612    if (!objectStoreInfo) {
     613        performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete index from non-existant object store") });
     614        return;
     615    }
     616
     617    auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexName);
     618    if (!indexInfo) {
     619        performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to delete non-existant index") });
     620        return;
     621    }
     622
     623    m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteIndex, callbackID, transaction.info().identifier(), objectStoreIdentifier, indexInfo->identifier()));
     624}
     625
     626void UniqueIDBDatabase::performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const uint64_t indexIdentifier)
    614627{
    615628    ASSERT(!isMainThread());
     
    617630
    618631    ASSERT(m_backingStore);
    619     m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexName);
     632    m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier);
    620633
    621634    IDBError error;
    622     m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteIndex, callbackIdentifier, error, objectStoreIdentifier, indexName));
    623 }
    624 
    625 void UniqueIDBDatabase::didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, const String& indexName)
     635    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteIndex, callbackIdentifier, error, objectStoreIdentifier, indexIdentifier));
     636}
     637
     638void UniqueIDBDatabase::didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, uint64_t indexIdentifier)
    626639{
    627640    ASSERT(isMainThread());
     
    631644        auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
    632645        if (objectStoreInfo)
    633             objectStoreInfo->deleteIndex(indexName);
     646            objectStoreInfo->deleteIndex(indexIdentifier);
    634647    }
    635648
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h

    r195499 r195527  
    135135    void performClearObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
    136136    void performCreateIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&);
    137     void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName);
     137    void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier);
    138138    void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
    139139    void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
     
    152152    void didPerformClearObjectStore(uint64_t callbackIdentifier, const IDBError&);
    153153    void didPerformCreateIndex(uint64_t callbackIdentifier, const IDBError&, const IDBIndexInfo&);
    154     void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, const String& indexName);
     154    void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier);
    155155    void didPerformPutOrAdd(uint64_t callbackIdentifier, const IDBError&, const IDBKeyData&);
    156156    void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&, const IDBGetResult&);
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp

    r192645 r195527  
    114114}
    115115
     116void IDBObjectStoreInfo::deleteIndex(uint64_t indexIdentifier)
     117{
     118    m_indexMap.remove(indexIdentifier);
     119}
     120
    116121#ifndef NDEBUG
    117122String IDBObjectStoreInfo::loggingString(int indent) const
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h

    r195467 r195527  
    6060
    6161    void deleteIndex(const String& indexName);
     62    void deleteIndex(uint64_t indexIdentifier);
    6263
    6364#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.