IndexedDB: Migrate backend ObjectStore calls to use transaction id
authoralecflett@chromium.org <alecflett@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Jan 2013 20:42:38 +0000 (20:42 +0000)
committeralecflett@chromium.org <alecflett@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Jan 2013 20:42:38 +0000 (20:42 +0000)
commitff2c3d221896a46d80c90c530f47cee0585030be
tree445b4938804fe31195eb198fde88e119002c942f
parent69abe6f61e782f4a8620fe665bb80dc2babdce41
IndexedDB: Migrate backend ObjectStore calls to use transaction id
https://bugs.webkit.org/show_bug.cgi?id=102741

Reviewed by Tony Chang.

Source/WebCore:

Fully migrate 8 core data calls (get, put, setIndexKeys, setIndexesReady,
openCursor, count, deleteRange, and clear) into IDBDatabaseBackendImpl,
combining common code from IDBObjectStoreBackendImpl and IDBIndexBackendImpl
in order to simplify the backend interface. These calls are now
implemented in terms of an int64_t-based transactionId rather than
an IDBTransactionBackendInterface, which simplifies the ownership model
between the frontend and the backend.

In addition, remove references to IDBObjectStoreBackend* from IDBIndex,
as it is no longer needed.

A few duplicate IDB_TRACE methods have been removed from wrapper methods
that call another method that already have IDB_TRACE's.

Finally, IDBCursorBackendImpl now no longer holds onto an
IDBObjectStoreBackendImpl*, so its destruction and member variables are
simplified, and reordered to match proper destruction order.

* Modules/indexeddb/IDBCursorBackendImpl.cpp: Reordered to account for proper destruction.
(WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl):
(WebCore::IDBCursorBackendImpl::~IDBCursorBackendImpl):
(WebCore::IDBCursorBackendImpl::deleteFunction):
* Modules/indexeddb/IDBCursorBackendImpl.h:
(WebCore::IDBCursorBackendImpl::create):
(IDBCursorBackendImpl):
* Modules/indexeddb/IDBDatabase.h:
(WebCore::IDBDatabase::backend):
(IDBDatabase):
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(GetOperation): Combined from IDBObjectStoreBackendImpl/IDBIndexBackendImpl::*RetrievalOperation
(WebCore::GetOperation::create):
(WebCore::GetOperation::GetOperation):
(WebCore):
(PutOperation): Combined from IDBObjectStoreBackendImpl/IDBIndexBackendImpl::*StorageOperation.
(WebCore::PutOperation::create):
(WebCore::PutOperation::PutOperation):
(SetIndexesReadyOperation): Moved from IDBObjectStoreBackendImpl::IndexesReadyOperation
(WebCore::SetIndexesReadyOperation::create):
(WebCore::SetIndexesReadyOperation::SetIndexesReadyOperation):
(OpenCursorOperation): Combined from IDBObjectStoreBackendImpl/IDBIndexBackendImpl::Open*CursorOperation
(WebCore::OpenCursorOperation::create):
(WebCore::OpenCursorOperation::OpenCursorOperation):
(CountOperation): Combined from IDBObjectStoreBackendImpl/IDBIndexBackendImpl::CountOperation
(WebCore::CountOperation::create):
(WebCore::CountOperation::CountOperation):
(DeleteRangeOperation): Moved from IDBObjectStoreBackendImpl::DeleteOperation
(WebCore::DeleteRangeOperation::create):
(WebCore::DeleteRangeOperation::DeleteRangeOperation):
(ClearOperation): Moved from IDBObjectStoreBackendImpl::ClearOperation
(WebCore::ClearOperation::create):
(WebCore::ClearOperation::ClearOperation):
(WebCore::IDBDatabaseBackendImpl::get): Combined from IDBObjectStoreBackendImpl/IDBIndexBackendImpl::get*
(WebCore::GetOperation::perform):
(WebCore::IDBDatabaseBackendImpl::put): Moved from IDBObjectStoreBackendImpl::put
(WebCore::PutOperation::perform):
(WebCore::IDBDatabaseBackendImpl::setIndexKeys): Moved from IDBObjectStoreBackendImpl::setIndexKeys
(WebCore::IDBDatabaseBackendImpl::setIndexesReady):
(WebCore::SetIndexesReadyOperation::perform):
(WebCore::IDBDatabaseBackendImpl::openCursor):
(WebCore::IDBDatabaseBackendImpl::count):
(WebCore::CountOperation::perform):
(WebCore::IDBDatabaseBackendImpl::deleteRange):
(WebCore::DeleteRangeOperation::perform):
(WebCore::IDBDatabaseBackendImpl::clear):
(WebCore::ClearOperation::perform):
(WebCore::OpenCursorOperation::perform):
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::IDBIndex):
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::count):
(WebCore::IDBIndex::openKeyCursor):
(WebCore::IDBIndex::get):
(WebCore::IDBIndex::getKey):
(WebCore::IDBIndex::backendDB):
(WebCore):
* Modules/indexeddb/IDBIndex.h:
(WebCore::IDBIndex::create):
(IDBIndex):
* Modules/indexeddb/IDBIndexBackendImpl.cpp:
(WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl):
* Modules/indexeddb/IDBIndexBackendImpl.h:
(WebCore::IDBIndexBackendImpl::create):
(WebCore::IDBIndexBackendImpl::openCursor):
(WebCore::IDBIndexBackendImpl::count):
(WebCore::IDBIndexBackendImpl::openKeyCursor):
(WebCore::IDBIndexBackendImpl::get):
(WebCore::IDBIndexBackendImpl::getKey):
(IDBIndexBackendImpl):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::put):
(WebCore::IDBObjectStore::deleteFunction):
(WebCore::IDBObjectStore::clear):
(WebCore):
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::index):
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::count):
(WebCore::IDBObjectStore::backendDB):
* Modules/indexeddb/IDBObjectStore.h:
(WebCore::IDBObjectStore::id):
(IDBObjectStore):
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::createIndex):
(WebCore::IDBObjectStoreBackendImpl::loadIndexes):
(WebCore::IDBObjectStoreBackendImpl::generateKey):
(WebCore::IDBObjectStoreBackendImpl::updateKeyGenerator):
* Modules/indexeddb/IDBObjectStoreBackendImpl.h:
(WebCore::IDBObjectStoreBackendImpl::get):
(WebCore::IDBObjectStoreBackendImpl::put):
(WebCore::IDBObjectStoreBackendImpl::deleteFunction):
(WebCore::IDBObjectStoreBackendImpl::clear):
(WebCore::IDBObjectStoreBackendImpl::setIndexKeys):
(WebCore::IDBObjectStoreBackendImpl::setIndexesReady):
(WebCore::IDBObjectStoreBackendImpl::openCursor):
(WebCore::IDBObjectStoreBackendImpl::count):
(IDBObjectStoreBackendImpl):
* Modules/indexeddb/IDBTransactionBackendImpl.h:
(WebCore::IDBTransactionBackendImpl::database):
(IDBTransactionBackendImpl):

Source/WebKit/chromium:

Fix a bug where an array was initialized with a large empty buffer,
clean up whitespace, and update to match signatures that changed
in WebCore.

* public/WebIDBDatabase.h:
(WebKit::WebIDBDatabase::clear):
* src/WebIDBDatabaseImpl.cpp:
(WebKit::WebIDBDatabaseImpl::put):
* src/WebIDBIndexImpl.cpp:
* tests/IDBDatabaseBackendTest.cpp:

LayoutTests:

Add additional count() tests for multi-entry indexes, not previously
covered.

* storage/indexeddb/index-multientry-expected.txt:
* storage/indexeddb/resources/index-multientry.js:
(.transaction.oncomplete):
(verifyCount.request.onsuccess.request.onsuccess):
(verifyCount.request.onsuccess):
(verifyCount):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/index-multientry-expected.txt
LayoutTests/storage/indexeddb/resources/index-multientry.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBDatabase.h
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBIndex.cpp
Source/WebCore/Modules/indexeddb/IDBIndex.h
Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
Source/WebCore/Modules/indexeddb/IDBTransaction.h
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebIDBDatabase.h
Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
Source/WebKit/chromium/src/WebIDBIndexImpl.cpp
Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp