Changeset 209168 in webkit


Ignore:
Timestamp:
Nov 30, 2016 6:42:28 PM (7 years ago)
Author:
beidson@apple.com
Message:

IndexedDB: When doing puts, don't "updateAllIndexesForAddRecord" if there are no indexes.
https://bugs.webkit.org/show_bug.cgi?id=165215

Reviewed by Alex Christensen.

No new tests (No observable behavior change).

  • Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:

(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Don't "updateAllIndexesForAddRecord" if there are no indexes.

Avoiding this saved us some IDBKey serialization and Javascript object manipulation.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209167 r209168  
     12016-11-30  Brady Eidson  <beidson@apple.com>
     2
     3        IndexedDB: When doing puts, don't "updateAllIndexesForAddRecord" if there are no indexes.
     4        https://bugs.webkit.org/show_bug.cgi?id=165215
     5
     6        Reviewed by Alex Christensen.
     7
     8        No new tests (No observable behavior change).
     9
     10        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
     11        (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Don't "updateAllIndexesForAddRecord" if there are no indexes.
     12          Avoiding this saved us some IDBKey serialization and Javascript object manipulation.
     13
    1142016-11-30  Antoine Quint  <graouts@apple.com>
    215
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp

    r209160 r209168  
    16611661    }
    16621662
    1663     auto error = updateAllIndexesForAddRecord(objectStoreInfo, keyData, value.data());
    1664 
    1665     if (!error.isNull()) {
    1666         auto* sql = cachedStatement(SQL::DeleteObjectStoreRecord, ASCIILiteral("DELETE FROM Records WHERE objectStoreID = ? AND key = CAST(? AS TEXT);"));
    1667         if (!sql
    1668             || sql->bindInt64(1, objectStoreInfo.identifier()) != SQLITE_OK
    1669             || sql->bindBlob(2, keyBuffer->data(), keyBuffer->size()) != SQLITE_OK
    1670             || sql->step() != SQLITE_DONE) {
    1671             LOG_ERROR("Indexing new object store record failed, but unable to remove the object store record itself");
    1672             return { IDBDatabaseException::UnknownError, ASCIILiteral("Indexing new object store record failed, but unable to remove the object store record itself") };
    1673         }
    1674 
    1675         return error;
     1663    if (!objectStoreInfo.indexMap().isEmpty()) {
     1664        auto error = updateAllIndexesForAddRecord(objectStoreInfo, keyData, value.data());
     1665
     1666        if (!error.isNull()) {
     1667            auto* sql = cachedStatement(SQL::DeleteObjectStoreRecord, ASCIILiteral("DELETE FROM Records WHERE objectStoreID = ? AND key = CAST(? AS TEXT);"));
     1668            if (!sql
     1669                || sql->bindInt64(1, objectStoreInfo.identifier()) != SQLITE_OK
     1670                || sql->bindBlob(2, keyBuffer->data(), keyBuffer->size()) != SQLITE_OK
     1671                || sql->step() != SQLITE_DONE) {
     1672                LOG_ERROR("Indexing new object store record failed, but unable to remove the object store record itself");
     1673                return { IDBDatabaseException::UnknownError, ASCIILiteral("Indexing new object store record failed, but unable to remove the object store record itself") };
     1674            }
     1675
     1676            return error;
     1677        }
    16761678    }
    16771679
     
    17291731    transaction->notifyCursorsOfChanges(objectStoreInfo.identifier());
    17301732
    1731     return error;
     1733    return { };
    17321734}
    17331735
Note: See TracChangeset for help on using the changeset viewer.