Changeset 195508 in webkit
- Timestamp:
- Jan 23, 2016 12:19:12 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r195507 r195508 1 2016-01-23 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Implement clearing object stores and opening cursors in the SQLite backend. 4 https://bugs.webkit.org/show_bug.cgi?id=153396 5 6 Reviewed by Alex Christensen. 7 8 * platform/mac-wk1/TestExpectations: 9 1 10 2016-01-22 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r195499 r195508 557 557 storage/indexeddb/queued-commands.html [ Failure ] 558 558 storage/indexeddb/readonly.html [ Failure ] 559 storage/indexeddb/request-continue-abort.html [ Failure ]560 559 storage/indexeddb/structured-clone.html [ Failure ] 561 560 storage/indexeddb/transaction-active-flag.html [ Failure ] … … 563 562 storage/indexeddb/transaction-basics.html [ Failure ] 564 563 storage/indexeddb/transaction-error.html [ Failure ] 565 storage/indexeddb/transaction-read-only.html [ Failure ]566 564 storage/indexeddb/transaction-rollback.html [ Failure ] 567 565 storage/indexeddb/value-undefined.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r195507 r195508 1 2016-01-23 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Implement clearing object stores and opening cursors in the SQLite backend. 4 https://bugs.webkit.org/show_bug.cgi?id=153396 5 6 Reviewed by Alex Christensen. 7 8 No new tests (Some failing tests now pass, others improved). 9 10 Copy more LegacyIDB SQLite backend code over to the new SQLite backend. 11 12 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 13 (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): 14 (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor): 15 (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor): 16 1 17 2016-01-22 Commit Queue <commit-queue@webkit.org> 2 18 -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r195495 r195508 32 32 #include "IDBBindingUtilities.h" 33 33 #include "IDBDatabaseException.h" 34 #include "IDBGetResult.h" 34 35 #include "IDBKeyData.h" 35 36 #include "IDBSerialization.h" … … 640 641 } 641 642 642 IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier&, uint64_t) 643 { 644 return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") }; 643 IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID) 644 { 645 ASSERT(m_sqliteDB); 646 ASSERT(m_sqliteDB->isOpen()); 647 648 auto* transaction = m_transactions.get(transactionIdentifier); 649 if (!transaction || !transaction->inProgress()) { 650 LOG_ERROR("Attempt to clear an object store without an in-progress transaction"); 651 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to clear an object store without an in-progress transaction") }; 652 } 653 if (transaction->mode() == IndexedDB::TransactionMode::ReadOnly) { 654 LOG_ERROR("Attempt to clear an object store in a read-only transaction"); 655 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to clear an object store in a read-only transaction") }; 656 } 657 658 { 659 SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM Records WHERE objectStoreID = ?;")); 660 if (sql.prepare() != SQLITE_OK 661 || sql.bindInt64(1, objectStoreID) != SQLITE_OK 662 || sql.step() != SQLITE_DONE) { 663 LOG_ERROR("Could not clear records from object store id %" PRIi64 " (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg()); 664 return { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to clear object store") }; 665 } 666 } 667 668 { 669 SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("DELETE FROM IndexRecords WHERE objectStoreID = ?;")); 670 if (sql.prepare() != SQLITE_OK 671 || sql.bindInt64(1, objectStoreID) != SQLITE_OK 672 || sql.step() != SQLITE_DONE) { 673 LOG_ERROR("Could not delete records from index record store id %" PRIi64 " (%i) - %s", objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg()); 674 return { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to delete index records while clearing object store") }; 675 } 676 } 677 678 return { }; 645 679 } 646 680 … … 914 948 } 915 949 916 IDBError SQLiteIDBBackingStore::openCursor(const IDBResourceIdentifier&, const IDBCursorInfo&, IDBGetResult&) 917 { 918 return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") }; 919 } 920 921 IDBError SQLiteIDBBackingStore::iterateCursor(const IDBResourceIdentifier&, const IDBResourceIdentifier&, const IDBKeyData&, uint32_t, IDBGetResult&) 922 { 923 return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") }; 950 IDBError SQLiteIDBBackingStore::openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo& info, IDBGetResult& result) 951 { 952 ASSERT(m_sqliteDB); 953 ASSERT(m_sqliteDB->isOpen()); 954 955 auto* transaction = m_transactions.get(transactionIdentifier); 956 if (!transaction || !transaction->inProgress()) { 957 LOG_ERROR("Attempt to open a cursor in database without an in-progress transaction"); 958 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to open a cursor in database without an in-progress transaction") }; 959 } 960 961 auto* cursor = transaction->maybeOpenCursor(info); 962 if (!cursor) { 963 LOG_ERROR("Unable to open cursor"); 964 return { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to open cursor") }; 965 } 966 967 m_cursors.set(cursor->identifier(), cursor); 968 969 result = { cursor->currentKey(), cursor->currentPrimaryKey(), ThreadSafeDataBuffer::copyVector(cursor->currentValueBuffer()) }; 970 return { }; 971 } 972 973 IDBError SQLiteIDBBackingStore::iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBKeyData& key, uint32_t count, IDBGetResult& result) 974 { 975 ASSERT(m_sqliteDB); 976 ASSERT(m_sqliteDB->isOpen()); 977 978 auto* cursor = m_cursors.get(cursorIdentifier); 979 if (!cursor) { 980 LOG_ERROR("Attempt to iterate a cursor that doesn't exist"); 981 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to iterate a cursor that doesn't exist") }; 982 } 983 984 ASSERT_UNUSED(transactionIdentifier, cursor->transaction()->transactionIdentifier() == transactionIdentifier); 985 986 if (!cursor->transaction() || !cursor->transaction()->inProgress()) { 987 LOG_ERROR("Attempt to iterate a cursor without an in-progress transaction"); 988 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to iterate a cursor without an in-progress transaction") }; 989 } 990 991 if (key.isValid()) { 992 if (!cursor->iterate(key)) { 993 LOG_ERROR("Attempt to iterate cursor failed"); 994 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to iterate cursor failed") }; 995 } 996 } else { 997 if (!count) 998 count = 1; 999 if (!cursor->advance(count)) { 1000 LOG_ERROR("Attempt to advance cursor failed"); 1001 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to advance cursor failed") }; 1002 } 1003 } 1004 1005 result = { cursor->currentKey(), cursor->currentPrimaryKey(), ThreadSafeDataBuffer::copyVector(cursor->currentValueBuffer()) }; 1006 return { }; 924 1007 } 925 1008
Note: See TracChangeset
for help on using the changeset viewer.