IndexedDB: Replace use of ScriptExecutionContext::Task (Part 2)
authorjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2012 17:06:27 +0000 (17:06 +0000)
committerjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2012 17:06:27 +0000 (17:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103931

Reviewed by Tony Chang.

Source/WebCore:

Actually drop use of ScriptExecutionContext::Task and remove incorrect usage of
ThreadSafeRefCounted<>. Define a new IDBTransactionBackendImpl::Operation base class
for operations; storage of per-operation data becomes explicit.

No new tests - just a refactor.

* Modules/indexeddb/IDBCallbacks.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBCursorBackendImpl.cpp:
(WebCore::IDBCursorBackendImpl::CursorIterationOperation::create):
(IDBCursorBackendImpl::CursorIterationOperation):
(WebCore::IDBCursorBackendImpl::CursorIterationOperation::CursorIterationOperation):
(WebCore::IDBCursorBackendImpl::CursorAdvanceOperation::create):
(IDBCursorBackendImpl::CursorAdvanceOperation):
(WebCore::IDBCursorBackendImpl::CursorAdvanceOperation::CursorAdvanceOperation):
(WebCore::IDBCursorBackendImpl::CursorPrefetchIterationOperation::create):
(IDBCursorBackendImpl::CursorPrefetchIterationOperation):
(WebCore::IDBCursorBackendImpl::CursorPrefetchIterationOperation::CursorPrefetchIterationOperation):
(WebCore::IDBCursorBackendImpl::CursorAdvanceOperation::perform):
(WebCore::IDBCursorBackendImpl::CursorIterationOperation::perform):
(WebCore::IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform):
* Modules/indexeddb/IDBCursorBackendInterface.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBDatabase.cpp:
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::CreateObjectStoreOperation::create):
(IDBDatabaseBackendImpl::CreateObjectStoreOperation):
(WebCore::IDBDatabaseBackendImpl::CreateObjectStoreOperation::CreateObjectStoreOperation):
(WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreOperation::create):
(IDBDatabaseBackendImpl::DeleteObjectStoreOperation):
(WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreOperation::DeleteObjectStoreOperation):
(WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::create):
(IDBDatabaseBackendImpl::VersionChangeOperation):
(WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::VersionChangeOperation):
(WebCore::IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::create):
(IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation):
(WebCore::IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::CreateObjectStoreAbortOperation):
(WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::create):
(IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation):
(WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::DeleteObjectStoreAbortOperation):
(WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::create):
(IDBDatabaseBackendImpl::VersionChangeAbortOperation):
(WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::VersionChangeAbortOperation):
(WebCore::IDBDatabaseBackendImpl::createObjectStore):
(WebCore::IDBDatabaseBackendImpl::CreateObjectStoreOperation::perform):
(WebCore::IDBDatabaseBackendImpl::deleteObjectStore):
(WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreOperation::perform):
(WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::perform):
(WebCore::IDBDatabaseBackendImpl::runIntVersionChangeTransaction):
(WebCore::IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::perform):
(WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::perform):
(WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform):
* Modules/indexeddb/IDBDatabaseBackendInterface.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBDatabaseCallbacks.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBFactoryBackendImpl.cpp:
* Modules/indexeddb/IDBFactoryBackendInterface.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBIndexBackendImpl.cpp:
(WebCore::IDBIndexBackendImpl::OpenIndexCursorOperation::create):
(IDBIndexBackendImpl::OpenIndexCursorOperation):
(WebCore::IDBIndexBackendImpl::OpenIndexCursorOperation::OpenIndexCursorOperation):
(WebCore::IDBIndexBackendImpl::IndexCountOperation::create):
(IDBIndexBackendImpl::IndexCountOperation):
(WebCore::IDBIndexBackendImpl::IndexCountOperation::IndexCountOperation):
(WebCore::IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::create):
(IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation):
(WebCore::IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::IndexReferencedValueRetrievalOperation):
(WebCore::IDBIndexBackendImpl::IndexValueRetrievalOperation::create):
(IDBIndexBackendImpl::IndexValueRetrievalOperation):
(WebCore::IDBIndexBackendImpl::IndexValueRetrievalOperation::IndexValueRetrievalOperation):
(WebCore::IDBIndexBackendImpl::OpenIndexCursorOperation::perform):
(WebCore::IDBIndexBackendImpl::openCursor):
(WebCore::IDBIndexBackendImpl::openKeyCursor):
(WebCore::IDBIndexBackendImpl::IndexCountOperation::perform):
(WebCore::IDBIndexBackendImpl::count):
(WebCore::IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::perform):
(WebCore::IDBIndexBackendImpl::IndexValueRetrievalOperation::perform):
(WebCore::IDBIndexBackendImpl::get):
(WebCore::IDBIndexBackendImpl::getKey):
* Modules/indexeddb/IDBIndexBackendInterface.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBKey.h: Remove bogus "ThreadSafe"
(IDBKey):
* Modules/indexeddb/IDBKeyRange.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::create):
(IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::ObjectStoreRetrievalOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::create):
(IDBObjectStoreBackendImpl::ObjectStoreStorageOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::ObjectStoreStorageOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::create):
(IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::ObjectStoreIndexesReadyOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::create):
(IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::ObjectStoreDeletionOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreClearOperation::create):
(IDBObjectStoreBackendImpl::ObjectStoreClearOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreClearOperation::ObjectStoreClearOperation):
(WebCore::IDBObjectStoreBackendImpl::CreateIndexOperation::create):
(IDBObjectStoreBackendImpl::CreateIndexOperation):
(WebCore::IDBObjectStoreBackendImpl::CreateIndexOperation::CreateIndexOperation):
(WebCore::IDBObjectStoreBackendImpl::DeleteIndexOperation::create):
(IDBObjectStoreBackendImpl::DeleteIndexOperation):
(WebCore::IDBObjectStoreBackendImpl::DeleteIndexOperation::DeleteIndexOperation):
(WebCore::IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::create):
(IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation):
(WebCore::IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::OpenObjectStoreCursorOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreCountOperation::create):
(IDBObjectStoreBackendImpl::ObjectStoreCountOperation):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreCountOperation::ObjectStoreCountOperation):
(WebCore::IDBObjectStoreBackendImpl::CreateIndexAbortOperation::create):
(IDBObjectStoreBackendImpl::CreateIndexAbortOperation):
(WebCore::IDBObjectStoreBackendImpl::CreateIndexAbortOperation::CreateIndexAbortOperation):
(WebCore::IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::create):
(IDBObjectStoreBackendImpl::DeleteIndexAbortOperation):
(WebCore::IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::DeleteIndexAbortOperation):
(WebCore::IDBObjectStoreBackendImpl::get):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::put):
(WebCore):
(WebCore::IDBObjectStoreBackendImpl::setIndexesReady):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::deleteFunction):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::clear):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreClearOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::createIndex):
(WebCore::IDBObjectStoreBackendImpl::CreateIndexOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::deleteIndex):
(WebCore::IDBObjectStoreBackendImpl::DeleteIndexOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::openCursor):
(WebCore::IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::count):
(WebCore::IDBObjectStoreBackendImpl::ObjectStoreCountOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::CreateIndexAbortOperation::perform):
(WebCore::IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::perform):
* Modules/indexeddb/IDBObjectStoreBackendInterface.h: Remove bogus "ThreadSafe"
* Modules/indexeddb/IDBRequest.h: Remove bogus "ThreadSafe"
(IDBRequest):
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl): Appease RefPtr<> adoption strictness.
(WebCore::IDBTransactionBackendImpl::scheduleTask):
(WebCore::IDBTransactionBackendImpl::abort):
(WebCore::IDBTransactionBackendImpl::taskTimerFired):
* Modules/indexeddb/IDBTransactionBackendImpl.h:
(Operation):
(WebCore::IDBTransactionBackendImpl::Operation::~Operation):
(IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::scheduleTask):
* Modules/indexeddb/IDBTransactionBackendInterface.h: Remove bogus "ThreadSafe"

Source/WebKit/chromium:

Now that IDBCallbacks uses real RefPtr<> a mock class needs to be heap allocated.

* tests/IDBAbortOnCorruptTest.cpp:
(WebCore::MockIDBCallbacks::create):
(WebCore::MockIDBCallbacks::MockIDBCallbacks):
(MockIDBCallbacks):
(WebCore::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136696 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBCallbacks.h
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h
Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBIndexBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBKey.h
Source/WebCore/Modules/indexeddb/IDBKeyRange.h
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBRequest.h
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBTransactionCoordinator.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp

index e85c367..0446458 100644 (file)
@@ -1,3 +1,160 @@
+2012-12-05  Joshua Bell  <jsbell@chromium.org>
+
+        IndexedDB: Replace use of ScriptExecutionContext::Task (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=103931
+
+        Reviewed by Tony Chang.
+
+        Actually drop use of ScriptExecutionContext::Task and remove incorrect usage of
+        ThreadSafeRefCounted<>. Define a new IDBTransactionBackendImpl::Operation base class
+        for operations; storage of per-operation data becomes explicit.
+
+        No new tests - just a refactor.
+
+        * Modules/indexeddb/IDBCallbacks.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBCursorBackendImpl.cpp:
+        (WebCore::IDBCursorBackendImpl::CursorIterationOperation::create):
+        (IDBCursorBackendImpl::CursorIterationOperation):
+        (WebCore::IDBCursorBackendImpl::CursorIterationOperation::CursorIterationOperation):
+        (WebCore::IDBCursorBackendImpl::CursorAdvanceOperation::create):
+        (IDBCursorBackendImpl::CursorAdvanceOperation):
+        (WebCore::IDBCursorBackendImpl::CursorAdvanceOperation::CursorAdvanceOperation):
+        (WebCore::IDBCursorBackendImpl::CursorPrefetchIterationOperation::create):
+        (IDBCursorBackendImpl::CursorPrefetchIterationOperation):
+        (WebCore::IDBCursorBackendImpl::CursorPrefetchIterationOperation::CursorPrefetchIterationOperation):
+        (WebCore::IDBCursorBackendImpl::CursorAdvanceOperation::perform):
+        (WebCore::IDBCursorBackendImpl::CursorIterationOperation::perform):
+        (WebCore::IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform):
+        * Modules/indexeddb/IDBCursorBackendInterface.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBDatabase.cpp:
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::CreateObjectStoreOperation::create):
+        (IDBDatabaseBackendImpl::CreateObjectStoreOperation):
+        (WebCore::IDBDatabaseBackendImpl::CreateObjectStoreOperation::CreateObjectStoreOperation):
+        (WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreOperation::create):
+        (IDBDatabaseBackendImpl::DeleteObjectStoreOperation):
+        (WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreOperation::DeleteObjectStoreOperation):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::create):
+        (IDBDatabaseBackendImpl::VersionChangeOperation):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::VersionChangeOperation):
+        (WebCore::IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::create):
+        (IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation):
+        (WebCore::IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::CreateObjectStoreAbortOperation):
+        (WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::create):
+        (IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation):
+        (WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::DeleteObjectStoreAbortOperation):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::create):
+        (IDBDatabaseBackendImpl::VersionChangeAbortOperation):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::VersionChangeAbortOperation):
+        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+        (WebCore::IDBDatabaseBackendImpl::CreateObjectStoreOperation::perform):
+        (WebCore::IDBDatabaseBackendImpl::deleteObjectStore):
+        (WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreOperation::perform):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::perform):
+        (WebCore::IDBDatabaseBackendImpl::runIntVersionChangeTransaction):
+        (WebCore::IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::perform):
+        (WebCore::IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::perform):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform):
+        * Modules/indexeddb/IDBDatabaseBackendInterface.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBDatabaseCallbacks.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBFactoryBackendImpl.cpp:
+        * Modules/indexeddb/IDBFactoryBackendInterface.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBIndexBackendImpl.cpp:
+        (WebCore::IDBIndexBackendImpl::OpenIndexCursorOperation::create):
+        (IDBIndexBackendImpl::OpenIndexCursorOperation):
+        (WebCore::IDBIndexBackendImpl::OpenIndexCursorOperation::OpenIndexCursorOperation):
+        (WebCore::IDBIndexBackendImpl::IndexCountOperation::create):
+        (IDBIndexBackendImpl::IndexCountOperation):
+        (WebCore::IDBIndexBackendImpl::IndexCountOperation::IndexCountOperation):
+        (WebCore::IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::create):
+        (IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation):
+        (WebCore::IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::IndexReferencedValueRetrievalOperation):
+        (WebCore::IDBIndexBackendImpl::IndexValueRetrievalOperation::create):
+        (IDBIndexBackendImpl::IndexValueRetrievalOperation):
+        (WebCore::IDBIndexBackendImpl::IndexValueRetrievalOperation::IndexValueRetrievalOperation):
+        (WebCore::IDBIndexBackendImpl::OpenIndexCursorOperation::perform):
+        (WebCore::IDBIndexBackendImpl::openCursor):
+        (WebCore::IDBIndexBackendImpl::openKeyCursor):
+        (WebCore::IDBIndexBackendImpl::IndexCountOperation::perform):
+        (WebCore::IDBIndexBackendImpl::count):
+        (WebCore::IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::perform):
+        (WebCore::IDBIndexBackendImpl::IndexValueRetrievalOperation::perform):
+        (WebCore::IDBIndexBackendImpl::get):
+        (WebCore::IDBIndexBackendImpl::getKey):
+        * Modules/indexeddb/IDBIndexBackendInterface.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBKey.h: Remove bogus "ThreadSafe"
+        (IDBKey):
+        * Modules/indexeddb/IDBKeyRange.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::create):
+        (IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::ObjectStoreRetrievalOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::create):
+        (IDBObjectStoreBackendImpl::ObjectStoreStorageOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::ObjectStoreStorageOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::create):
+        (IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::ObjectStoreIndexesReadyOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::create):
+        (IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::ObjectStoreDeletionOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreClearOperation::create):
+        (IDBObjectStoreBackendImpl::ObjectStoreClearOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreClearOperation::ObjectStoreClearOperation):
+        (WebCore::IDBObjectStoreBackendImpl::CreateIndexOperation::create):
+        (IDBObjectStoreBackendImpl::CreateIndexOperation):
+        (WebCore::IDBObjectStoreBackendImpl::CreateIndexOperation::CreateIndexOperation):
+        (WebCore::IDBObjectStoreBackendImpl::DeleteIndexOperation::create):
+        (IDBObjectStoreBackendImpl::DeleteIndexOperation):
+        (WebCore::IDBObjectStoreBackendImpl::DeleteIndexOperation::DeleteIndexOperation):
+        (WebCore::IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::create):
+        (IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation):
+        (WebCore::IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::OpenObjectStoreCursorOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreCountOperation::create):
+        (IDBObjectStoreBackendImpl::ObjectStoreCountOperation):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreCountOperation::ObjectStoreCountOperation):
+        (WebCore::IDBObjectStoreBackendImpl::CreateIndexAbortOperation::create):
+        (IDBObjectStoreBackendImpl::CreateIndexAbortOperation):
+        (WebCore::IDBObjectStoreBackendImpl::CreateIndexAbortOperation::CreateIndexAbortOperation):
+        (WebCore::IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::create):
+        (IDBObjectStoreBackendImpl::DeleteIndexAbortOperation):
+        (WebCore::IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::DeleteIndexAbortOperation):
+        (WebCore::IDBObjectStoreBackendImpl::get):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::put):
+        (WebCore):
+        (WebCore::IDBObjectStoreBackendImpl::setIndexesReady):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::deleteFunction):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::clear):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreClearOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::createIndex):
+        (WebCore::IDBObjectStoreBackendImpl::CreateIndexOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::deleteIndex):
+        (WebCore::IDBObjectStoreBackendImpl::DeleteIndexOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::openCursor):
+        (WebCore::IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::count):
+        (WebCore::IDBObjectStoreBackendImpl::ObjectStoreCountOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::CreateIndexAbortOperation::perform):
+        (WebCore::IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::perform):
+        * Modules/indexeddb/IDBObjectStoreBackendInterface.h: Remove bogus "ThreadSafe"
+        * Modules/indexeddb/IDBRequest.h: Remove bogus "ThreadSafe"
+        (IDBRequest):
+        * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+        (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl): Appease RefPtr<> adoption strictness.
+        (WebCore::IDBTransactionBackendImpl::scheduleTask):
+        (WebCore::IDBTransactionBackendImpl::abort):
+        (WebCore::IDBTransactionBackendImpl::taskTimerFired):
+        * Modules/indexeddb/IDBTransactionBackendImpl.h:
+        (Operation):
+        (WebCore::IDBTransactionBackendImpl::Operation::~Operation):
+        (IDBTransactionBackendImpl):
+        (WebCore::IDBTransactionBackendImpl::scheduleTask):
+        * Modules/indexeddb/IDBTransactionBackendInterface.h: Remove bogus "ThreadSafe"
+
 2012-12-05  Noel Gordon  <noel.gordon@gmail.com>
 
         ENABLE(IMAGE_DECODER_DOWN_SAMPLING): Don't swizzle decode down sampled images
index b88b0cd..1cf4b7b 100644 (file)
@@ -35,7 +35,7 @@
 #include "IDBKeyPath.h"
 #include "IDBTransactionBackendInterface.h"
 #include "SerializedScriptValue.h"
-#include <wtf/Threading.h>
+#include <wtf/RefCounted.h>
 
 #if ENABLE(INDEXED_DATABASE)
 
@@ -44,8 +44,7 @@ class DOMStringList;
 class IDBCursorBackendInterface;
 class IDBObjectStoreBackendInterface;
 
-// FIXME: All child classes need to be made threadsafe.
-class IDBCallbacks : public ThreadSafeRefCounted<IDBCallbacks> {
+class IDBCallbacks : public RefCounted<IDBCallbacks> {
 public:
     virtual ~IDBCallbacks() { }
 
index 864e9fa..d275883 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
-#include "CrossThreadTask.h"
 #include "IDBBackingStore.h"
 #include "IDBCallbacks.h"
 #include "IDBDatabaseError.h"
 
 namespace WebCore {
 
-class IDBCursorBackendImpl::CursorIterationOperation {
+class IDBCursorBackendImpl::CursorIterationOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&CursorIterationOperation::perform, cursor, key, callbacks);
+        return adoptPtr(new CursorIterationOperation(cursor, key, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
+    CursorIterationOperation(PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+        : m_cursor(cursor)
+        , m_key(key)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBCursorBackendImpl> m_cursor;
+    RefPtr<IDBKey> m_key;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBCursorBackendImpl::CursorAdvanceOperation {
+class IDBCursorBackendImpl::CursorAdvanceOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBCursorBackendImpl> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBCursorBackendImpl> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&CursorAdvanceOperation::perform, cursor, count, callbacks);
+        return adoptPtr(new CursorAdvanceOperation(cursor, count, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, unsigned long count, PassRefPtr<IDBCallbacks>);
+    CursorAdvanceOperation(PassRefPtr<IDBCursorBackendImpl> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
+        : m_cursor(cursor)
+        , m_count(count)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBCursorBackendImpl> m_cursor;
+    unsigned long m_count;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBCursorBackendImpl::CursorPrefetchIterationOperation {
+class IDBCursorBackendImpl::CursorPrefetchIterationOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBCursorBackendImpl> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBCursorBackendImpl> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&CursorPrefetchIterationOperation::perform, cursor, numberToFetch, callbacks);
+        return adoptPtr(new CursorPrefetchIterationOperation(cursor, numberToFetch, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl>, int numberToFetch, PassRefPtr<IDBCallbacks>);
+    CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackendImpl> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
+        : m_cursor(cursor)
+        , m_numberToFetch(numberToFetch)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBCursorBackendImpl> m_cursor;
+    int m_numberToFetch;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
 IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStore::Cursor> cursor, CursorType cursorType, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendImpl* transaction, IDBObjectStoreBackendImpl* objectStore)
@@ -111,29 +140,28 @@ void IDBCursorBackendImpl::advance(unsigned long count, PassRefPtr<IDBCallbacks>
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBCursorBackendImpl::CursorAdvanceOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl> prpCursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
+void IDBCursorBackendImpl::CursorAdvanceOperation::perform(IDBTransactionBackendImpl*)
 {
     IDB_TRACE("CursorAdvanceOperation");
-    RefPtr<IDBCursorBackendImpl> cursor = prpCursor;
-    if (!cursor->m_cursor || !cursor->m_cursor->advance(count)) {
-        cursor->m_cursor = 0;
-        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
+    if (!m_cursor->m_cursor || !m_cursor->m_cursor->advance(m_count)) {
+        m_cursor->m_cursor = 0;
+        m_callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
-    callbacks->onSuccess(cursor->key(), cursor->primaryKey(), cursor->value());
+    m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
 }
 
-void IDBCursorBackendImpl::CursorIterationOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+void IDBCursorBackendImpl::CursorIterationOperation::perform(IDBTransactionBackendImpl*)
 {
     IDB_TRACE("CursorIterationOperation");
-    if (!cursor->m_cursor || !cursor->m_cursor->continueFunction(key.get())) {
-        cursor->m_cursor = 0;
-        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
+    if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(m_key.get())) {
+        m_cursor->m_cursor = 0;
+        m_callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
-    callbacks->onSuccess(cursor->key(), cursor->primaryKey(), cursor->value());
+    m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
 }
 
 void IDBCursorBackendImpl::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&)
@@ -157,50 +185,49 @@ void IDBCursorBackendImpl::prefetchContinue(int numberToFetch, PassRefPtr<IDBCal
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl> prpCursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
+void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform(IDBTransactionBackendImpl*)
 {
     IDB_TRACE("CursorPrefetchIterationOperation");
-    RefPtr<IDBCursorBackendImpl> cursor = prpCursor;
 
     Vector<RefPtr<IDBKey> > foundKeys;
     Vector<RefPtr<IDBKey> > foundPrimaryKeys;
     Vector<RefPtr<SerializedScriptValue> > foundValues;
 
-    if (cursor->m_cursor)
-        cursor->m_savedCursor = cursor->m_cursor->clone();
+    if (m_cursor->m_cursor)
+        m_cursor->m_savedCursor = m_cursor->m_cursor->clone();
 
     const size_t maxSizeEstimate = 10 * 1024 * 1024;
     size_t sizeEstimate = 0;
 
-    for (int i = 0; i < numberToFetch; ++i) {
-        if (!cursor->m_cursor || !cursor->m_cursor->continueFunction(0)) {
-            cursor->m_cursor = 0;
+    for (int i = 0; i < m_numberToFetch; ++i) {
+        if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(0)) {
+            m_cursor->m_cursor = 0;
             break;
         }
 
-        foundKeys.append(cursor->m_cursor->key());
-        foundPrimaryKeys.append(cursor->m_cursor->primaryKey());
+        foundKeys.append(m_cursor->m_cursor->key());
+        foundPrimaryKeys.append(m_cursor->m_cursor->primaryKey());
 
-        if (cursor->m_cursorType != IDBCursorBackendInterface::IndexKeyCursor)
-            foundValues.append(SerializedScriptValue::createFromWire(cursor->m_cursor->value()));
+        if (m_cursor->m_cursorType != IDBCursorBackendInterface::IndexKeyCursor)
+            foundValues.append(SerializedScriptValue::createFromWire(m_cursor->m_cursor->value()));
         else
             foundValues.append(SerializedScriptValue::create());
 
-        sizeEstimate += cursor->m_cursor->key()->sizeEstimate();
-        sizeEstimate += cursor->m_cursor->primaryKey()->sizeEstimate();
-        if (cursor->m_cursorType != IDBCursorBackendInterface::IndexKeyCursor)
-            sizeEstimate += cursor->m_cursor->value().length() * sizeof(UChar);
+        sizeEstimate += m_cursor->m_cursor->key()->sizeEstimate();
+        sizeEstimate += m_cursor->m_cursor->primaryKey()->sizeEstimate();
+        if (m_cursor->m_cursorType != IDBCursorBackendInterface::IndexKeyCursor)
+            sizeEstimate += m_cursor->m_cursor->value().length() * sizeof(UChar);
 
         if (sizeEstimate > maxSizeEstimate)
             break;
     }
 
     if (!foundKeys.size()) {
-        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
+        m_callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
-    callbacks->onSuccessWithPrefetch(foundKeys, foundPrimaryKeys, foundValues);
+    m_callbacks->onSuccessWithPrefetch(foundKeys, foundPrimaryKeys, foundValues);
 }
 
 void IDBCursorBackendImpl::prefetchReset(int usedPrefetches, int unusedPrefetches)
index 9b2d57b..3dc54f3 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
-#include <wtf/Threading.h>
 
 namespace WebCore {
 
@@ -42,7 +41,7 @@ class SerializedScriptValue;
 
 typedef int ExceptionCode;
 
-class IDBCursorBackendInterface : public ThreadSafeRefCounted<IDBCursorBackendInterface> {
+class IDBCursorBackendInterface : public RefCounted<IDBCursorBackendInterface> {
 public:
     virtual ~IDBCursorBackendInterface() {}
 
index a1aa9f7..49e50b4 100644 (file)
@@ -48,7 +48,6 @@
 #include "ScriptExecutionContext.h"
 #include <limits>
 #include <wtf/Atomics.h>
-#include <wtf/Threading.h>
 
 namespace WebCore {
 
index 4638877..dc2ee5f 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
-#include "CrossThreadTask.h"
 #include "IDBBackingStore.h"
 #include "IDBDatabaseException.h"
 #include "IDBFactoryBackendImpl.h"
 
 namespace WebCore {
 
-class IDBDatabaseBackendImpl::CreateObjectStoreOperation {
+class IDBDatabaseBackendImpl::CreateObjectStoreOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
     {
-        return createCallbackTask(&CreateObjectStoreOperation::perform, database, objectStore, transaction);
+        return adoptPtr(new CreateObjectStoreOperation(database, objectStore));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>);
+    CreateObjectStoreOperation(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+        : m_database(database)
+        , m_objectStore(objectStore)
+    {
+    }
+
+    RefPtr<IDBDatabaseBackendImpl> m_database;
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
 };
 
-class IDBDatabaseBackendImpl::DeleteObjectStoreOperation {
+class IDBDatabaseBackendImpl::DeleteObjectStoreOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
     {
-        return createCallbackTask(&DeleteObjectStoreOperation::perform, database, objectStore, transaction);
+        return adoptPtr(new DeleteObjectStoreOperation(database, objectStore));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>);
+    DeleteObjectStoreOperation(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+        : m_database(database)
+        , m_objectStore(objectStore)
+    {
+    }
+
+    RefPtr<IDBDatabaseBackendImpl> m_database;
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
 };
 
-class IDBDatabaseBackendImpl::VersionChangeOperation {
+class IDBDatabaseBackendImpl::VersionChangeOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBDatabaseBackendImpl> database, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBDatabaseBackendImpl> database, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
     {
-        return createCallbackTask(&VersionChangeOperation::perform, database, version, callbacks, databaseCallbacks, transaction);
+        return adoptPtr(new VersionChangeOperation(database, version, callbacks, databaseCallbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, int64_t version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    VersionChangeOperation(PassRefPtr<IDBDatabaseBackendImpl> database, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
+        : m_database(database)
+        , m_version(version)
+        , m_callbacks(callbacks)
+        , m_databaseCallbacks(databaseCallbacks)
+    {
+    }
+
+    RefPtr<IDBDatabaseBackendImpl> m_database;
+    int64_t m_version;
+    RefPtr<IDBCallbacks> m_callbacks;
+    RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks;
 };
 
-class IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation {
+class IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
     {
-        return createCallbackTask(&CreateObjectStoreAbortOperation::perform, database, objectStore);
+        return adoptPtr(new CreateObjectStoreAbortOperation(database, objectStore));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>);
+    CreateObjectStoreAbortOperation(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+        : m_database(database)
+        , m_objectStore(objectStore)
+    {
+    }
+
+    RefPtr<IDBDatabaseBackendImpl> m_database;
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
 };
 
-class IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation {
+class IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
     {
-        return createCallbackTask(&DeleteObjectStoreAbortOperation::perform, database, objectStore);
+        return adoptPtr(new DeleteObjectStoreAbortOperation(database, objectStore));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>);
+    DeleteObjectStoreAbortOperation(PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+        : m_database(database)
+        , m_objectStore(objectStore)
+    {
+    }
+
+    RefPtr<IDBDatabaseBackendImpl> m_database;
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
 };
 
-class IDBDatabaseBackendImpl::VersionChangeAbortOperation {
+class IDBDatabaseBackendImpl::VersionChangeAbortOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBDatabaseBackendImpl> database, const String& previousVersion, int64_t previousIntVersion)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBDatabaseBackendImpl> database, const String& previousVersion, int64_t previousIntVersion)
     {
-        return createCallbackTask(&VersionChangeAbortOperation::perform, database, previousVersion, previousIntVersion);
+        return adoptPtr(new VersionChangeAbortOperation(database, previousVersion, previousIntVersion));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& previousVersion, int64_t previousIntVersion);
+    VersionChangeAbortOperation(PassRefPtr<IDBDatabaseBackendImpl> database, const String& previousVersion, int64_t previousIntVersion)
+        : m_database(database)
+        , m_previousVersion(previousVersion)
+        , m_previousIntVersion(previousIntVersion)
+    {
+    }
+
+    RefPtr<IDBDatabaseBackendImpl> m_database;
+    String m_previousVersion;
+    int64_t m_previousIntVersion;
 };
 
 
@@ -224,7 +277,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectS
     ASSERT(id > m_metadata.maxObjectStoreId);
     m_metadata.maxObjectStoreId = id;
 
-    if (!transaction->scheduleTask(CreateObjectStoreOperation::create(this, objectStore, transaction), CreateObjectStoreAbortOperation::create(this, objectStore))) {
+    if (!transaction->scheduleTask(CreateObjectStoreOperation::create(this, objectStore), CreateObjectStoreAbortOperation::create(this, objectStore))) {
         ec = IDBDatabaseException::TransactionInactiveError;
         return 0;
     }
@@ -233,10 +286,10 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectS
     return objectStore.release();
 }
 
-void IDBDatabaseBackendImpl::CreateObjectStoreOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBDatabaseBackendImpl::CreateObjectStoreOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("CreateObjectStoreOperation");
-    if (!database->m_backingStore->createObjectStore(transaction->backingStoreTransaction(), database->id(), objectStore->id(), objectStore->name(), objectStore->keyPath(), objectStore->autoIncrement())) {
+    if (!m_database->m_backingStore->createObjectStore(transaction->backingStoreTransaction(), m_database->id(), m_objectStore->id(), m_objectStore->name(), m_objectStore->keyPath(), m_objectStore->autoIncrement())) {
         transaction->abort();
         return;
     }
@@ -255,36 +308,35 @@ void IDBDatabaseBackendImpl::deleteObjectStore(int64_t id, IDBTransactionBackend
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
     ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE);
 
-    if (!transaction->scheduleTask(DeleteObjectStoreOperation::create(this, objectStore, transaction), DeleteObjectStoreAbortOperation::create(this, objectStore))) {
+    if (!transaction->scheduleTask(DeleteObjectStoreOperation::create(this, objectStore), DeleteObjectStoreAbortOperation::create(this, objectStore))) {
         ec = IDBDatabaseException::TransactionInactiveError;
         return;
     }
     m_objectStores.remove(id);
 }
 
-void IDBDatabaseBackendImpl::DeleteObjectStoreOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBDatabaseBackendImpl::DeleteObjectStoreOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("DeleteObjectStoreOperation");
-    database->m_backingStore->deleteObjectStore(transaction->backingStoreTransaction(), database->id(), objectStore->id());
+    m_database->m_backingStore->deleteObjectStore(transaction->backingStoreTransaction(), m_database->id(), m_objectStore->id());
 }
 
-void IDBDatabaseBackendImpl::VersionChangeOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, int64_t version, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBDatabaseBackendImpl::VersionChangeOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("VersionChangeOperation");
-    RefPtr<IDBCallbacks> callbacks(prpCallbacks);
-    int64_t databaseId = database->id();
-    int64_t oldVersion = database->m_metadata.intVersion;
-    ASSERT(version > oldVersion);
-    database->m_metadata.intVersion = version;
-    if (!database->m_backingStore->updateIDBDatabaseIntVersion(transaction->backingStoreTransaction(), databaseId, database->m_metadata.intVersion)) {
+    int64_t databaseId = m_database->id();
+    int64_t oldVersion = m_database->m_metadata.intVersion;
+    ASSERT(m_version > oldVersion);
+    m_database->m_metadata.intVersion = m_version;
+    if (!m_database->m_backingStore->updateIDBDatabaseIntVersion(transaction->backingStoreTransaction(), databaseId, m_database->m_metadata.intVersion)) {
         RefPtr<IDBDatabaseError> error = IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Error writing data to stable storage.");
-        callbacks->onError(error);
+        m_callbacks->onError(error);
         transaction->abort(error);
         return;
     }
-    ASSERT(!database->m_pendingSecondHalfOpenWithVersion);
-    database->m_pendingSecondHalfOpenWithVersion = PendingOpenWithVersionCall::create(callbacks, databaseCallbacks, version);
-    callbacks->onUpgradeNeeded(oldVersion, transaction, database);
+    ASSERT(!m_database->m_pendingSecondHalfOpenWithVersion);
+    m_database->m_pendingSecondHalfOpenWithVersion = PendingOpenWithVersionCall::create(m_callbacks, m_databaseCallbacks, m_version);
+    m_callbacks->onUpgradeNeeded(oldVersion, transaction, m_database);
 }
 
 void IDBDatabaseBackendImpl::transactionStarted(PassRefPtr<IDBTransactionBackendImpl> prpTransaction)
@@ -439,7 +491,7 @@ void IDBDatabaseBackendImpl::runIntVersionChangeTransaction(int64_t requestedVer
     RefPtr<IDBTransactionBackendInterface> transactionInterface = createTransaction(0, objectStoreIds, IDBTransaction::VERSION_CHANGE);
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionInterface.get());
 
-    if (!transaction->scheduleTask(VersionChangeOperation::create(this, requestedVersion, callbacks, databaseCallbacks, transaction), VersionChangeAbortOperation::create(this, m_metadata.version, m_metadata.intVersion))) {
+    if (!transaction->scheduleTask(VersionChangeOperation::create(this, requestedVersion, callbacks, databaseCallbacks), VersionChangeAbortOperation::create(this, m_metadata.version, m_metadata.intVersion))) {
         ASSERT_NOT_REACHED();
     }
     ASSERT(!m_pendingSecondHalfOpenWithVersion);
@@ -559,23 +611,25 @@ void IDBDatabaseBackendImpl::loadObjectStores()
         m_objectStores.set(objectStores[i].id, IDBObjectStoreBackendImpl::create(this, objectStores[i]));
 }
 
-void IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore)
+void IDBDatabaseBackendImpl::CreateObjectStoreAbortOperation::perform(IDBTransactionBackendImpl* transaction)
 {
-    ASSERT(database->m_objectStores.contains(objectStore->id()));
-    database->m_objectStores.remove(objectStore->id());
+    ASSERT(!transaction);
+    ASSERT(m_database->m_objectStores.contains(m_objectStore->id()));
+    m_database->m_objectStores.remove(m_objectStore->id());
 }
 
-void IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> prpObjectStore)
+void IDBDatabaseBackendImpl::DeleteObjectStoreAbortOperation::perform(IDBTransactionBackendImpl* transaction)
 {
-    RefPtr<IDBObjectStoreBackendImpl> objectStore = prpObjectStore;
-    ASSERT(!database->m_objectStores.contains(objectStore->id()));
-    database->m_objectStores.set(objectStore->id(), objectStore);
+    ASSERT(!transaction);
+    ASSERT(!m_database->m_objectStores.contains(m_objectStore->id()));
+    m_database->m_objectStores.set(m_objectStore->id(), m_objectStore);
 }
 
-void IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& previousVersion, int64_t previousIntVersion)
+void IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform(IDBTransactionBackendImpl* transaction)
 {
-    database->m_metadata.version = previousVersion;
-    database->m_metadata.intVersion = previousIntVersion;
+    ASSERT(!transaction);
+    m_database->m_metadata.version = m_previousVersion;
+    m_database->m_metadata.intVersion = m_previousIntVersion;
 }
 
 } // namespace WebCore
index 850062c..1095318 100644 (file)
@@ -27,7 +27,7 @@
 #define IDBDatabaseBackendInterface_h
 
 #include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(INDEXED_DATABASE)
@@ -47,7 +47,7 @@ typedef int ExceptionCode;
 // This is implemented by IDBDatabaseBackendImpl and optionally others (in order to proxy
 // calls across process barriers). All calls to these classes should be non-blocking and
 // trigger work on a background thread if necessary.
-class IDBDatabaseBackendInterface : public ThreadSafeRefCounted<IDBDatabaseBackendInterface> {
+class IDBDatabaseBackendInterface : public RefCounted<IDBDatabaseBackendInterface> {
 public:
     virtual ~IDBDatabaseBackendInterface() { }
 
index 4693e63..841ec0f 100644 (file)
@@ -34,9 +34,7 @@
 
 namespace WebCore {
 
-// FIXME: Uses ThreadSafeRefCounted for storage in ScriptExecutionContext::Task but
-// it is never actually used on multiple threads. http://webkit.org/b/101483
-class IDBDatabaseCallbacks : public ThreadSafeRefCounted<IDBDatabaseCallbacks> {
+class IDBDatabaseCallbacks : public RefCounted<IDBDatabaseCallbacks> {
 public:
     virtual ~IDBDatabaseCallbacks() { }
 
index 2d5842c..4738e35 100644 (file)
@@ -35,7 +35,6 @@
 #include "IDBDatabaseException.h"
 #include "IDBTransactionCoordinator.h"
 #include "SecurityOrigin.h"
-#include <wtf/Threading.h>
 #include <wtf/UnusedParam.h>
 
 #if ENABLE(INDEXED_DATABASE)
index bab219f..83a2857 100644 (file)
@@ -29,7 +29,7 @@
 #define IDBFactoryBackendInterface_h
 
 #include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(INDEXED_DATABASE)
@@ -48,7 +48,7 @@ typedef int ExceptionCode;
 // This is implemented by IDBFactoryBackendImpl and optionally others (in order to proxy
 // calls across process barriers). All calls to these classes should be non-blocking and
 // trigger work on a background thread if necessary.
-class IDBFactoryBackendInterface : public ThreadSafeRefCounted<IDBFactoryBackendInterface> {
+class IDBFactoryBackendInterface : public RefCounted<IDBFactoryBackendInterface> {
 public:
     static PassRefPtr<IDBFactoryBackendInterface> create();
     virtual ~IDBFactoryBackendInterface() { }
index 9f7c297..91ee8f0 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
-#include "CrossThreadTask.h"
 #include "IDBBackingStore.h"
 #include "IDBCallbacks.h"
 #include "IDBCursorBackendImpl.h"
 
 namespace WebCore {
 
-class IDBIndexBackendImpl::OpenIndexCursorOperation {
+class IDBIndexBackendImpl::OpenIndexCursorOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&OpenIndexCursorOperation::perform, index, keyRange, direction, cursorType, callbacks, transaction);
+        return adoptPtr(new OpenIndexCursorOperation(index, keyRange, direction, cursorType, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short untypedDirection, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    OpenIndexCursorOperation(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks)
+        : m_index(index)
+        , m_keyRange(keyRange)
+        , m_direction(direction)
+        , m_cursorType(cursorType)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBIndexBackendImpl> m_index;
+    RefPtr<IDBKeyRange> m_keyRange;
+    unsigned short m_direction;
+    IDBCursorBackendInterface::CursorType m_cursorType;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBIndexBackendImpl::IndexCountOperation {
+class IDBIndexBackendImpl::IndexCountOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&IndexCountOperation::perform, index, keyRange, callbacks, transaction);
+        return adoptPtr(new IndexCountOperation(index, keyRange, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    IndexCountOperation(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+        : m_index(index)
+        , m_keyRange(keyRange)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBIndexBackendImpl> m_index;
+    RefPtr<IDBKeyRange> m_keyRange;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation {
+class IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&IndexReferencedValueRetrievalOperation::perform, index, keyRange, callbacks, transaction);
+        return adoptPtr(new IndexReferencedValueRetrievalOperation(index, keyRange, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    IndexReferencedValueRetrievalOperation(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+        : m_index(index)
+        , m_keyRange(keyRange)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBIndexBackendImpl> m_index;
+    RefPtr<IDBKeyRange> m_keyRange;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBIndexBackendImpl::IndexValueRetrievalOperation {
+class IDBIndexBackendImpl::IndexValueRetrievalOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&IndexValueRetrievalOperation::perform, index, keyRange, callbacks, transaction);
+        return adoptPtr(new IndexValueRetrievalOperation(index, keyRange, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    IndexValueRetrievalOperation(PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+        : m_index(index)
+        , m_keyRange(keyRange)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBIndexBackendImpl> m_index;
+    RefPtr<IDBKeyRange> m_keyRange;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
 
@@ -95,19 +138,19 @@ IDBIndexBackendImpl::~IDBIndexBackendImpl()
 {
 }
 
-void IDBIndexBackendImpl::OpenIndexCursorOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, unsigned short untypedDirection, IDBCursorBackendInterface::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBIndexBackendImpl::OpenIndexCursorOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("OpenIndexCursorOperation");
-    IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(untypedDirection);
+    IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(m_direction);
 
     RefPtr<IDBBackingStore::Cursor> backingStoreCursor;
 
-    switch (cursorType) {
+    switch (m_cursorType) {
     case IDBCursorBackendInterface::IndexKeyCursor:
-        backingStoreCursor = index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), range.get(), direction);
+        backingStoreCursor = m_index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), m_keyRange.get(), direction);
         break;
     case IDBCursorBackendInterface::IndexCursor:
-        backingStoreCursor = index->backingStore()->openIndexCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), range.get(), direction);
+        backingStoreCursor = m_index->backingStore()->openIndexCursor(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), m_keyRange.get(), direction);
         break;
     case IDBCursorBackendInterface::ObjectStoreCursor:
     case IDBCursorBackendInterface::InvalidCursorType:
@@ -116,12 +159,12 @@ void IDBIndexBackendImpl::OpenIndexCursorOperation::perform(ScriptExecutionConte
     }
 
     if (!backingStoreCursor) {
-        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
+        m_callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
-    RefPtr<IDBCursorBackendImpl> cursor = IDBCursorBackendImpl::create(backingStoreCursor.get(), cursorType, transaction.get(), index->m_objectStoreBackend);
-    callbacks->onSuccess(cursor, cursor->key(), cursor->primaryKey(), cursor->value());
+    RefPtr<IDBCursorBackendImpl> cursor = IDBCursorBackendImpl::create(backingStoreCursor.get(), m_cursorType, transaction, m_index->m_objectStoreBackend);
+    m_callbacks->onSuccess(cursor, cursor->key(), cursor->primaryKey(), cursor->value());
 }
 
 void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -129,7 +172,7 @@ void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned
     IDB_TRACE("IDBIndexBackendImpl::openCursor");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(OpenIndexCursorOperation::create(this, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks, transaction)))
+    if (!transaction->scheduleTask(OpenIndexCursorOperation::create(this, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
@@ -138,18 +181,18 @@ void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> keyRange, unsign
     IDB_TRACE("IDBIndexBackendImpl::openKeyCursor");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(OpenIndexCursorOperation::create(this, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks, transaction)))
+    if (!transaction->scheduleTask(OpenIndexCursorOperation::create(this, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBIndexBackendImpl::IndexCountOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBIndexBackendImpl::IndexCountOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("IndexCountOperation");
     uint32_t count = 0;
 
-    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), range.get(), IDBCursor::NEXT);
+    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), m_keyRange.get(), IDBCursor::NEXT);
     if (!backingStoreCursor) {
-        callbacks->onSuccess(count);
+        m_callbacks->onSuccess(count);
         return;
     }
 
@@ -157,7 +200,7 @@ void IDBIndexBackendImpl::IndexCountOperation::perform(ScriptExecutionContext*,
         ++count;
     } while (backingStoreCursor->continueFunction(0));
 
-    callbacks->onSuccess(count);
+    m_callbacks->onSuccess(count);
 }
 
 void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -165,78 +208,76 @@ void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCal
     IDB_TRACE("IDBIndexBackendImpl::count");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(IndexCountOperation::create(this, range, callbacks, transaction)))
+    if (!transaction->scheduleTask(IndexCountOperation::create(this, range, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBIndexBackendImpl::IndexReferencedValueRetrievalOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("IndexReferencedValueRetrievalOperation");
 
     RefPtr<IDBKey> key;
 
-    if (keyRange->isOnlyKey())
-        key = keyRange->lower();
+    if (m_keyRange->isOnlyKey())
+        key = m_keyRange->lower();
     else {
-        RefPtr<IDBBackingStore::Cursor> backingStoreCursor = index->backingStore()->openIndexCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), keyRange.get(), IDBCursor::NEXT);
+        RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_index->backingStore()->openIndexCursor(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), m_keyRange.get(), IDBCursor::NEXT);
 
         if (!backingStoreCursor) {
-            callbacks->onSuccess();
+            m_callbacks->onSuccess();
             return;
         }
         key = backingStoreCursor->key();
     }
 
     RefPtr<IDBKey> primaryKey;
-    bool ok = index->backingStore()->getPrimaryKeyViaIndex(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), *key, primaryKey);
+    bool ok = m_index->backingStore()->getPrimaryKeyViaIndex(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), *key, primaryKey);
     if (!ok) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getPrimaryKeyViaIndex."));
+        m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getPrimaryKeyViaIndex."));
         return;
     }
 
     String value;
-    ok = index->backingStore()->getRecord(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), *primaryKey, value);
+    ok = m_index->backingStore()->getRecord(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), *primaryKey, value);
     if (!ok) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getRecord."));
+        m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getRecord."));
         return;
     }
 
     if (value.isNull()) {
-        callbacks->onSuccess();
+        m_callbacks->onSuccess();
         return;
     }
-    if (index->m_objectStoreBackend->autoIncrement() && !index->m_objectStoreBackend->keyPath().isNull()) {
-        callbacks->onSuccess(SerializedScriptValue::createFromWire(value),
-                             primaryKey, index->m_objectStoreBackend->keyPath());
+    if (m_index->m_objectStoreBackend->autoIncrement() && !m_index->m_objectStoreBackend->keyPath().isNull()) {
+        m_callbacks->onSuccess(SerializedScriptValue::createFromWire(value), primaryKey, m_index->m_objectStoreBackend->keyPath());
         return;
     }
-    callbacks->onSuccess(SerializedScriptValue::createFromWire(value));
+    m_callbacks->onSuccess(SerializedScriptValue::createFromWire(value));
 }
 
 
-void IDBIndexBackendImpl::IndexValueRetrievalOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBIndexBackendImpl::IndexValueRetrievalOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("IndexValueRetrievalOperation");
 
-    RefPtr<IDBBackingStore::Cursor> backingStoreCursor =
-            index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), keyRange.get(), IDBCursor::NEXT);
+    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), m_keyRange.get(), IDBCursor::NEXT);
 
     if (!backingStoreCursor) {
-        callbacks->onSuccess(static_cast<IDBKey*>(0));
+        m_callbacks->onSuccess(static_cast<IDBKey*>(0));
         return;
     }
 
     RefPtr<IDBKey> keyResult;
-    bool ok = index->backingStore()->getPrimaryKeyViaIndex(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), *backingStoreCursor->key(), keyResult);
+    bool ok = m_index->backingStore()->getPrimaryKeyViaIndex(transaction->backingStoreTransaction(), m_index->databaseId(), m_index->m_objectStoreBackend->id(), m_index->id(), *backingStoreCursor->key(), keyResult);
     if (!ok) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getPrimaryKeyViaIndex."));
+        m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getPrimaryKeyViaIndex."));
         return;
     }
     if (!keyResult) {
-        callbacks->onSuccess(static_cast<IDBKey*>(0));
+        m_callbacks->onSuccess(static_cast<IDBKey*>(0));
         return;
     }
-    callbacks->onSuccess(keyResult.get());
+    m_callbacks->onSuccess(keyResult.get());
 }
 
 void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -244,7 +285,7 @@ void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCa
     IDB_TRACE("IDBIndexBackendImpl::get");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(IndexReferencedValueRetrievalOperation::create(this, keyRange, callbacks, transaction)))
+    if (!transaction->scheduleTask(IndexReferencedValueRetrievalOperation::create(this, keyRange, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
@@ -253,7 +294,7 @@ void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<ID
     IDB_TRACE("IDBIndexBackendImpl::getKey");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(IndexValueRetrievalOperation::create(this, keyRange, callbacks, transaction)))
+    if (!transaction->scheduleTask(IndexValueRetrievalOperation::create(this, keyRange, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
index 132cab6..0cd7fe1 100644 (file)
@@ -39,7 +39,6 @@ namespace WebCore {
 class IDBBackingStore;
 class IDBKey;
 class IDBObjectStoreBackendImpl;
-class ScriptExecutionContext;
 
 class IDBIndexBackendImpl : public IDBIndexBackendInterface {
 public:
index c92fc8d..84dc5b7 100644 (file)
@@ -27,7 +27,7 @@
 #define IDBIndexBackendInterface_h
 
 #include <wtf/Forward.h>
-#include <wtf/ThreadSafeRefCounted.h>
+#include <wtf/RefCounted.h>
 
 #if ENABLE(INDEXED_DATABASE)
 
@@ -41,7 +41,7 @@ class IDBTransactionBackendInterface;
 
 typedef int ExceptionCode;
 
-class IDBIndexBackendInterface : public ThreadSafeRefCounted<IDBIndexBackendInterface> {
+class IDBIndexBackendInterface : public RefCounted<IDBIndexBackendInterface> {
 public:
     virtual ~IDBIndexBackendInterface() { }
 
index 864da1b..465f82e 100644 (file)
 
 #include "ScriptWrappable.h"
 #include <wtf/Forward.h>
-#include <wtf/Threading.h>
+#include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class IDBKey : public ScriptWrappable, public ThreadSafeRefCounted<IDBKey> {
+class IDBKey : public ScriptWrappable, public RefCounted<IDBKey> {
 public:
     typedef Vector<RefPtr<IDBKey> > KeyArray;
 
@@ -145,8 +145,8 @@ public:
         return b - a;
     }
 
-    using ThreadSafeRefCounted<IDBKey>::ref;
-    using ThreadSafeRefCounted<IDBKey>::deref;
+    using RefCounted<IDBKey>::ref;
+    using RefCounted<IDBKey>::deref;
 
 private:
     IDBKey() : m_type(InvalidType), m_number(0), m_sizeEstimate(OverheadSize) { }
index d347f84..6067ef9 100644 (file)
 #include "IDBKey.h"
 #include "ScriptWrappable.h"
 #include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 typedef int ExceptionCode;
 
-class IDBKeyRange : public ScriptWrappable, public ThreadSafeRefCounted<IDBKeyRange> {
+class IDBKeyRange : public ScriptWrappable, public RefCounted<IDBKeyRange> {
 public:
     enum LowerBoundType {
         LowerBoundOpen,
index 9f611cb..2e10d14 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
-#include "CrossThreadTask.h"
 #include "IDBBackingStore.h"
 #include "IDBBindingUtilities.h"
 #include "IDBCallbacks.h"
 
 namespace WebCore {
 
-class IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation {
+class IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&ObjectStoreRetrievalOperation::perform, objectStore, keyRange, callbacks, transaction);
+        return adoptPtr(new ObjectStoreRetrievalOperation(objectStore, keyRange, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    ObjectStoreRetrievalOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+        : m_objectStore(objectStore)
+        , m_keyRange(keyRange)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBKeyRange> m_keyRange;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBObjectStoreBackendImpl::ObjectStoreStorageOperation {
+class IDBObjectStoreBackendImpl::ObjectStoreStorageOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction, PassOwnPtr<Vector<int64_t> > popIndexIds, PassOwnPtr<Vector<IndexKeys> > popIndexKeys)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassOwnPtr<Vector<int64_t> > popIndexIds, PassOwnPtr<Vector<IndexKeys> > popIndexKeys)
     {
-        return createCallbackTask(&ObjectStoreStorageOperation::perform, objectStore, value, key, putMode, callbacks, transaction, popIndexIds, popIndexKeys);
+        return adoptPtr(new ObjectStoreStorageOperation(objectStore, value, key, putMode, callbacks, popIndexIds, popIndexKeys));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>, PassOwnPtr<Vector<int64_t> > popIndexIds, PassOwnPtr<Vector<IndexKeys> > popIndexKeys);
+    ObjectStoreStorageOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassOwnPtr<Vector<int64_t> > popIndexIds, PassOwnPtr<Vector<IndexKeys> > popIndexKeys)
+        : m_objectStore(objectStore)
+        , m_value(value)
+        , m_key(key)
+        , m_putMode(putMode)
+        , m_callbacks(callbacks)
+        , m_popIndexIds(popIndexIds)
+        , m_popIndexKeys(popIndexKeys)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<SerializedScriptValue> m_value;
+    RefPtr<IDBKey> m_key;
+    PutMode m_putMode;
+    RefPtr<IDBCallbacks> m_callbacks;
+    OwnPtr<Vector<int64_t> > m_popIndexIds;
+    OwnPtr<Vector<IndexKeys> > m_popIndexKeys;
 };
 
-class IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation {
+class IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassOwnPtr<Vector<int64_t> > popIndexIds, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassOwnPtr<Vector<int64_t> > popIndexIds)
     {
-        return createCallbackTask(&ObjectStoreIndexesReadyOperation::perform, objectStore, popIndexIds, transaction);
+        return adoptPtr(new ObjectStoreIndexesReadyOperation(objectStore, popIndexIds));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassOwnPtr<Vector<int64_t> > popIndexIds, PassRefPtr<IDBTransactionBackendImpl>);
+    ObjectStoreIndexesReadyOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassOwnPtr<Vector<int64_t> > popIndexIds)
+        : m_objectStore(objectStore)
+        , m_popIndexIds(popIndexIds)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    OwnPtr<Vector<int64_t> > m_popIndexIds;
 };
 
-class IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation {
+class IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&ObjectStoreDeletionOperation::perform, objectStore, keyRange, callbacks, transaction);
+        return adoptPtr(new ObjectStoreDeletionOperation(objectStore, keyRange, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    ObjectStoreDeletionOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+        : m_objectStore(objectStore)
+        , m_keyRange(keyRange)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBKeyRange> m_keyRange;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBObjectStoreBackendImpl::ObjectStoreClearOperation {
+class IDBObjectStoreBackendImpl::ObjectStoreClearOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&ObjectStoreClearOperation::perform, objectStore, callbacks, transaction);
+        return adoptPtr(new ObjectStoreClearOperation(objectStore, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    ObjectStoreClearOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBCallbacks> callbacks)
+        : m_objectStore(objectStore)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBObjectStoreBackendImpl::CreateIndexOperation {
+class IDBObjectStoreBackendImpl::CreateIndexOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
     {
-        return createCallbackTask(&CreateIndexOperation::perform, objectStore, index, transaction);
+        return adoptPtr(new CreateIndexOperation(objectStore, index));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>);
+    CreateIndexOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+        : m_objectStore(objectStore)
+        , m_index(index)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBIndexBackendImpl> m_index;
 };
 
-class IDBObjectStoreBackendImpl::DeleteIndexOperation {
+class IDBObjectStoreBackendImpl::DeleteIndexOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
     {
-        return createCallbackTask(&DeleteIndexOperation::perform, objectStore, index, transaction);
+        return adoptPtr(new DeleteIndexOperation(objectStore, index));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendImpl>);
+    DeleteIndexOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+        : m_objectStore(objectStore)
+        , m_index(index)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBIndexBackendImpl> m_index;
 };
 
-class IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation {
+class IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType)
     {
-        return createCallbackTask(&OpenObjectStoreCursorOperation::perform, objectStore, range, direction, callbacks, taskType, transaction);
+        return adoptPtr(new OpenObjectStoreCursorOperation(objectStore, range, direction, callbacks, taskType));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface::TaskType, PassRefPtr<IDBTransactionBackendImpl>);
+    OpenObjectStoreCursorOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType)
+        : m_objectStore(objectStore)
+        , m_range(range)
+        , m_direction(direction)
+        , m_callbacks(callbacks)
+        , m_taskType(taskType)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBKeyRange> m_range;
+    IDBCursor::Direction m_direction;
+    RefPtr<IDBCallbacks> m_callbacks;
+    IDBTransactionBackendInterface::TaskType m_taskType;
 };
 
-class IDBObjectStoreBackendImpl::ObjectStoreCountOperation {
+class IDBObjectStoreBackendImpl::ObjectStoreCountOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks)
     {
-        return createCallbackTask(&ObjectStoreCountOperation::perform, objectStore, range, callbacks, transaction);
+        return adoptPtr(new ObjectStoreCountOperation(objectStore, range, callbacks));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
+    ObjectStoreCountOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks)
+        : m_objectStore(objectStore)
+        , m_range(range)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBKeyRange> m_range;
+    RefPtr<IDBCallbacks> m_callbacks;
 };
 
-class IDBObjectStoreBackendImpl::CreateIndexAbortOperation {
+class IDBObjectStoreBackendImpl::CreateIndexAbortOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
     {
-        return createCallbackTask(&CreateIndexAbortOperation::perform, objectStore, index);
+        return adoptPtr(new CreateIndexAbortOperation(objectStore, index));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>);
+    CreateIndexAbortOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+        : m_objectStore(objectStore)
+        , m_index(index)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBIndexBackendImpl> m_index;
 };
 
-class IDBObjectStoreBackendImpl::DeleteIndexAbortOperation {
+class IDBObjectStoreBackendImpl::DeleteIndexAbortOperation : public IDBTransactionBackendImpl::Operation {
 public:
-    static PassOwnPtr<ScriptExecutionContext::Task> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+    static PassOwnPtr<IDBTransactionBackendImpl::Operation> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
     {
-        return createCallbackTask(&DeleteIndexAbortOperation::perform, objectStore, index);
+        return adoptPtr(new DeleteIndexAbortOperation(objectStore, index));
     }
+    virtual void perform(IDBTransactionBackendImpl*);
 private:
-    static void perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>);
+    DeleteIndexAbortOperation(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+        : m_objectStore(objectStore)
+        , m_index(index)
+    {
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
+    RefPtr<IDBIndexBackendImpl> m_index;
 };
 
 
@@ -180,42 +289,41 @@ void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr
     IDB_TRACE("IDBObjectStoreBackendImpl::get");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(ObjectStoreRetrievalOperation::create(this, keyRange, callbacks, transaction)))
+    if (!transaction->scheduleTask(ObjectStoreRetrievalOperation::create(this, keyRange, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::ObjectStoreRetrievalOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("ObjectStoreRetrievalOperation");
     RefPtr<IDBKey> key;
-    if (keyRange->isOnlyKey())
-        key = keyRange->lower();
+    if (m_keyRange->isOnlyKey())
+        key = m_keyRange->lower();
     else {
-        RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), keyRange.get(), IDBCursor::NEXT);
+        RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), m_keyRange.get(), IDBCursor::NEXT);
         if (!backingStoreCursor) {
-            callbacks->onSuccess();
+            m_callbacks->onSuccess();
             return;
         }
         key = backingStoreCursor->key();
     }
 
     String wireData;
-    bool ok = objectStore->backingStore()->getRecord(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, wireData);
+    bool ok = m_objectStore->backingStore()->getRecord(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), *key, wireData);
     if (!ok) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getRecord."));
+        m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error in getRecord."));
         return;
     }
     if (wireData.isNull()) {
-        callbacks->onSuccess();
+        m_callbacks->onSuccess();
         return;
     }
 
-    if (objectStore->autoIncrement() && !objectStore->keyPath().isNull()) {
-        callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData),
-                             key, objectStore->keyPath());
+    if (m_objectStore->autoIncrement() && !m_objectStore->keyPath().isNull()) {
+        m_callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData), key, m_objectStore->keyPath());
         return;
     }
-    callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData));
+    m_callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData));
 }
 
 void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
@@ -231,7 +339,7 @@ void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> value, Pas
 
     ASSERT(autoIncrement() || key.get());
 
-    if (!transaction->scheduleTask(ObjectStoreStorageOperation::create(this, value, key, putMode, callbacks, transaction, newIndexIds.release(), newIndexKeys.release())))
+    if (!transaction->scheduleTask(ObjectStoreStorageOperation::create(this, value, key, putMode, callbacks, newIndexIds.release(), newIndexKeys.release())))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
@@ -378,82 +486,76 @@ void IDBObjectStoreBackendImpl::setIndexesReady(const Vector<int64_t>& indexIds,
     if (transaction->isFinished())
         return;
 
-    if (!transaction->scheduleTask(IDBTransactionBackendInterface::PreemptiveTask, ObjectStoreIndexesReadyOperation::create(this, newIndexIds.release(), transaction)))
+    if (!transaction->scheduleTask(IDBTransactionBackendInterface::PreemptiveTask, ObjectStoreIndexesReadyOperation::create(this, newIndexIds.release())))
         ASSERT_NOT_REACHED();
 }
 
-void IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassOwnPtr<Vector<int64_t> > popIndexIds, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::ObjectStoreIndexesReadyOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("ObjectStoreIndexesReadyOperation");
-    OwnPtr<Vector<int64_t> > indexIds = popIndexIds;
-    for (size_t i = 0; i < indexIds->size(); ++i)
+    for (size_t i = 0; i < m_popIndexIds->size(); ++i)
         transaction->didCompletePreemptiveEvent();
 }
 
-void IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> prpTransaction, PassOwnPtr<Vector<int64_t> > popIndexIds, PassOwnPtr<Vector<IndexKeys> > popIndexKeys)
+void IDBObjectStoreBackendImpl::ObjectStoreStorageOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("ObjectStoreStorageOperation");
-    RefPtr<IDBTransactionBackendImpl> transaction = prpTransaction;
     ASSERT(transaction->mode() != IDBTransaction::READ_ONLY);
-    RefPtr<SerializedScriptValue> value = prpValue;
-    RefPtr<IDBKey> key = prpKey;
-    OwnPtr<Vector<int64_t> > indexIds = popIndexIds;
-    OwnPtr<Vector<IndexKeys> > indexKeys = popIndexKeys;
-    ASSERT(indexIds && indexKeys && indexIds->size() == indexKeys->size());
-    const bool autoIncrement = objectStore->autoIncrement();
+    ASSERT(m_popIndexIds && m_popIndexKeys && m_popIndexIds->size() == m_popIndexKeys->size());
+    const bool autoIncrement = m_objectStore->autoIncrement();
     bool keyWasGenerated = false;
 
-    if (putMode != CursorUpdate && autoIncrement && !key) {
-        RefPtr<IDBKey> autoIncKey = objectStore->generateKey(transaction);
+    if (m_putMode != CursorUpdate && autoIncrement && !m_key) {
+        RefPtr<IDBKey> autoIncKey = m_objectStore->generateKey(transaction);
         keyWasGenerated = true;
         if (!autoIncKey->isValid()) {
-            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ConstraintError, "Maximum key generator value reached."));
+            m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ConstraintError, "Maximum key generator value reached."));
             return;
         }
-        key = autoIncKey;
+        m_key = autoIncKey;
     }
 
-    ASSERT(key && key->isValid());
+    ASSERT(m_key && m_key->isValid());
 
     IDBBackingStore::RecordIdentifier recordIdentifier;
-    if (putMode == AddOnly) {
+    if (m_putMode == AddOnly) {
         bool found = false;
-        bool ok = objectStore->backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, &recordIdentifier, found);
+        bool ok = m_objectStore->backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), *m_key, &recordIdentifier, found);
         if (!ok) {
-            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error checking key existence."));
+            m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error checking key existence."));
             return;
         }
         if (found) {
-            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ConstraintError, "Key already exists in the object store."));
+            m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ConstraintError, "Key already exists in the object store."));
             return;
         }
     }
 
     Vector<OwnPtr<IndexWriter> > indexWriters;
     String errorMessage;
-    if (!makeIndexWriters(transaction, objectStore.get(), key, keyWasGenerated, *indexIds, *indexKeys, &indexWriters, &errorMessage)) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ConstraintError, errorMessage));
+    if (!makeIndexWriters(transaction, m_objectStore.get(), m_key, keyWasGenerated, *m_popIndexIds, *m_popIndexKeys, &indexWriters, &errorMessage)) {
+        m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::ConstraintError, errorMessage));
         return;
     }
 
     // Before this point, don't do any mutation.  After this point, rollback the transaction in case of error.
 
-    objectStore->backingStore()->putRecord(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, value->toWireString(), &recordIdentifier);
+    m_objectStore->backingStore()->putRecord(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), *m_key, m_value->toWireString(), &recordIdentifier);
 
     for (size_t i = 0; i < indexWriters.size(); ++i) {
         IndexWriter* indexWriter = indexWriters[i].get();
-        indexWriter->writeIndexKeys(recordIdentifier, *objectStore->backingStore(), transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->m_metadata.id);
+        indexWriter->writeIndexKeys(recordIdentifier, *m_objectStore->backingStore(), transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->m_metadata.id);
     }
 
-    if (autoIncrement && putMode != CursorUpdate && key->type() == IDBKey::NumberType) {
-        bool ok = objectStore->updateKeyGenerator(transaction, key.get(), !keyWasGenerated);
+    if (autoIncrement && m_putMode != CursorUpdate && m_key->type() == IDBKey::NumberType) {
+        bool ok = m_objectStore->updateKeyGenerator(transaction, m_key.get(), !keyWasGenerated);
         if (!ok) {
-            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error updating key generator."));
+            m_callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error updating key generator."));
             return;
         }
     }
 
-    callbacks->onSuccess(key.release());
+    m_callbacks->onSuccess(m_key.release());
 }
 
 void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -464,24 +566,24 @@ void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> keyRange,
     ASSERT(transaction->mode() != IDBTransaction::READ_ONLY);
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
 
-    if (!transaction->scheduleTask(ObjectStoreDeletionOperation::create(this, keyRange, callbacks, transaction)))
+    if (!transaction->scheduleTask(ObjectStoreDeletionOperation::create(this, keyRange, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::ObjectStoreDeletionOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("ObjectStoreDeletionOperation");
 
-    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), keyRange.get(), IDBCursor::NEXT);
+    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), m_keyRange.get(), IDBCursor::NEXT);
     if (backingStoreCursor) {
 
         do {
-            objectStore->backingStore()->deleteRecord(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), backingStoreCursor->recordIdentifier());
+            m_objectStore->backingStore()->deleteRecord(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), backingStoreCursor->recordIdentifier());
 
         } while (backingStoreCursor->continueFunction(0));
     }
 
-    callbacks->onSuccess();
+    m_callbacks->onSuccess();
 }
 
 void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -492,15 +594,15 @@ void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDB
     ASSERT(transaction->mode() != IDBTransaction::READ_ONLY);
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
 
-    if (!transaction->scheduleTask(ObjectStoreClearOperation::create(this, callbacks, transaction)))
+    if (!transaction->scheduleTask(ObjectStoreClearOperation::create(this, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBObjectStoreBackendImpl::ObjectStoreClearOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::ObjectStoreClearOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("ObjectStoreClearOperation");
-    objectStore->backingStore()->clearObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id());
-    callbacks->onSuccess();
+    m_objectStore->backingStore()->clearObjectStore(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id());
+    m_callbacks->onSuccess();
 }
 
 PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(int64_t id, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
@@ -515,7 +617,7 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(int6
     ASSERT(id > m_metadata.maxIndexId);
     m_metadata.maxIndexId = id;
 
-    if (!transaction->scheduleTask(CreateIndexOperation::create(this, index, transaction), CreateIndexAbortOperation::create(this, index))) {
+    if (!transaction->scheduleTask(CreateIndexOperation::create(this, index), CreateIndexAbortOperation::create(this, index))) {
         ec = IDBDatabaseException::TransactionInactiveError;
         return 0;
     }
@@ -524,10 +626,10 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(int6
     return index.release();
 }
 
-void IDBObjectStoreBackendImpl::CreateIndexOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::CreateIndexOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("CreateIndexOperation");
-    if (!objectStore->backingStore()->createIndex(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), index->id(), index->name(), index->keyPath(), index->unique(), index->multiEntry())) {
+    if (!m_objectStore->backingStore()->createIndex(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), m_index->id(), m_index->name(), m_index->keyPath(), m_index->unique(), m_index->multiEntry())) {
         transaction->abort();
         return;
     }
@@ -548,17 +650,17 @@ void IDBObjectStoreBackendImpl::deleteIndex(int64_t indexId, IDBTransactionBacke
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
     ASSERT(transaction->mode() == IDBTransaction::VERSION_CHANGE);
 
-    if (!transaction->scheduleTask(DeleteIndexOperation::create(this, index, transaction), DeleteIndexAbortOperation::create(this, index))) {
+    if (!transaction->scheduleTask(DeleteIndexOperation::create(this, index), DeleteIndexAbortOperation::create(this, index))) {
         ec = IDBDatabaseException::TransactionInactiveError;
         return;
     }
     m_indexes.remove(indexId);
 }
 
-void IDBObjectStoreBackendImpl::DeleteIndexOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::DeleteIndexOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("DeleteIndexOperation");
-    objectStore->backingStore()->deleteIndex(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), index->id());
+    m_objectStore->backingStore()->deleteIndex(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), m_index->id());
 }
 
 void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -566,29 +668,29 @@ void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> range, IDBCur
     IDB_TRACE("IDBObjectStoreBackendImpl::openCursor");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(OpenObjectStoreCursorOperation::create(this, range, direction, callbacks, taskType, transaction))) {
+    if (!transaction->scheduleTask(OpenObjectStoreCursorOperation::create(this, range, direction, callbacks, taskType))) {
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
     }
 }
 
-void IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface::TaskType taskType, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::OpenObjectStoreCursorOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("OpenObjectStoreCursor");
 
-    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), range.get(), direction);
+    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), m_range.get(), m_direction);
     // The frontend has begun indexing, so this pauses the transaction
     // until the indexing is complete. This can't happen any earlier
     // because we don't want to switch to early mode in case multiple
     // indexes are being created in a row, with put()'s in between.
-    if (taskType == IDBTransactionBackendInterface::PreemptiveTask)
+    if (m_taskType == IDBTransactionBackendInterface::PreemptiveTask)
         transaction->addPreemptiveEvent();
     if (!backingStoreCursor) {
-        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
+        m_callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
-    RefPtr<IDBCursorBackendImpl> cursor = IDBCursorBackendImpl::create(backingStoreCursor.release(), IDBCursorBackendInterface::ObjectStoreCursor, taskType, transaction.get(), objectStore.get());
-    callbacks->onSuccess(cursor, cursor->key(), cursor->primaryKey(), cursor->value());
+    RefPtr<IDBCursorBackendImpl> cursor = IDBCursorBackendImpl::create(backingStoreCursor.release(), IDBCursorBackendInterface::ObjectStoreCursor, m_taskType, transaction, m_objectStore.get());
+    m_callbacks->onSuccess(cursor, cursor->key(), cursor->primaryKey(), cursor->value());
 }
 
 void IDBObjectStoreBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -596,17 +698,17 @@ void IDBObjectStoreBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<
     IDB_TRACE("IDBObjectStoreBackendImpl::count");
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
-    if (!transaction->scheduleTask(ObjectStoreCountOperation::create(this, range, callbacks, transaction)))
+    if (!transaction->scheduleTask(ObjectStoreCountOperation::create(this, range, callbacks)))
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::AbortError));
 }
 
-void IDBObjectStoreBackendImpl::ObjectStoreCountOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
+void IDBObjectStoreBackendImpl::ObjectStoreCountOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("ObjectStoreCountOperation");
     uint32_t count = 0;
-    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreKeyCursor(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), range.get(), IDBCursor::NEXT);
+    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = m_objectStore->backingStore()->openObjectStoreKeyCursor(transaction->backingStoreTransaction(), m_objectStore->databaseId(), m_objectStore->id(), m_range.get(), IDBCursor::NEXT);
     if (!backingStoreCursor) {
-        callbacks->onSuccess(count);
+        m_callbacks->onSuccess(count);
         return;
     }
 
@@ -614,7 +716,7 @@ void IDBObjectStoreBackendImpl::ObjectStoreCountOperation::perform(ScriptExecuti
         ++count;
     } while (backingStoreCursor->continueFunction(0));
 
-    callbacks->onSuccess(count);
+    m_callbacks->onSuccess(count);
 }
 
 void IDBObjectStoreBackendImpl::loadIndexes()
@@ -625,17 +727,18 @@ void IDBObjectStoreBackendImpl::loadIndexes()
         m_indexes.set(indexes[i].id, IDBIndexBackendImpl::create(m_database, this, indexes[i]));
 }
 
-void IDBObjectStoreBackendImpl::CreateIndexAbortOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index)
+void IDBObjectStoreBackendImpl::CreateIndexAbortOperation::perform(IDBTransactionBackendImpl* transaction)
 {
-    ASSERT(objectStore->m_indexes.contains(index->id()));
-    objectStore->m_indexes.remove(index->id());
+    ASSERT(!transaction);
+    ASSERT(m_objectStore->m_indexes.contains(m_index->id()));
+    m_objectStore->m_indexes.remove(m_index->id());
 }
 
-void IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::perform(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> prpIndex)
+void IDBObjectStoreBackendImpl::DeleteIndexAbortOperation::perform(IDBTransactionBackendImpl* transaction)
 {
-    RefPtr<IDBIndexBackendImpl> index = prpIndex;
-    ASSERT(!objectStore->m_indexes.contains(index->id()));
-    objectStore->m_indexes.set(index->id(), index);
+    ASSERT(!transaction);
+    ASSERT(!m_objectStore->m_indexes.contains(m_index->id()));
+    m_objectStore->m_indexes.set(m_index->id(), m_index);
 }
 
 PassRefPtr<IDBKey> IDBObjectStoreBackendImpl::generateKey(PassRefPtr<IDBTransactionBackendImpl> transaction)
index f718369..c2de474 100644 (file)
@@ -42,7 +42,6 @@ class IDBDatabaseBackendImpl;
 class IDBIndexBackendImpl;
 class IDBTransactionBackendImpl;
 class IDBTransactionBackendInterface;
-class ScriptExecutionContext;
 struct IDBObjectStoreMetadata;
 
 class IDBObjectStoreBackendImpl : public IDBObjectStoreBackendInterface {
index 83bdfdc..739a0d7 100644 (file)
@@ -28,7 +28,8 @@
 
 #include "IDBCursor.h"
 #include "IDBTransactionBackendInterface.h"
-#include <wtf/Threading.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(INDEXED_DATABASE)
@@ -45,7 +46,7 @@ class SerializedScriptValue;
 
 typedef int ExceptionCode;
 
-class IDBObjectStoreBackendInterface : public ThreadSafeRefCounted<IDBObjectStoreBackendInterface> {
+class IDBObjectStoreBackendInterface : public RefCounted<IDBObjectStoreBackendInterface> {
 public:
     virtual ~IDBObjectStoreBackendInterface() { }
 
index edaa7ba..b211820 100644 (file)
@@ -111,8 +111,8 @@ public:
 
     void transactionDidFinishAndDispatch();
 
-    using ThreadSafeRefCounted<IDBCallbacks>::ref;
-    using ThreadSafeRefCounted<IDBCallbacks>::deref;
+    using RefCounted<IDBCallbacks>::ref;
+    using RefCounted<IDBCallbacks>::deref;
 
     IDBTransactionBackendInterface::TaskType taskType() { return m_taskType; }
 
index c542fdd..f2f71c4 100644 (file)
@@ -35,7 +35,6 @@
 #include "IDBObjectStoreBackendImpl.h"
 #include "IDBTracing.h"
 #include "IDBTransactionCoordinator.h"
-#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 
@@ -55,6 +54,9 @@ IDBTransactionBackendImpl::IDBTransactionBackendImpl(int64_t id, const Vector<in
     , m_taskTimer(this, &IDBTransactionBackendImpl::taskTimerFired)
     , m_pendingPreemptiveEvents(0)
 {
+    // We pass a reference of this object before it can be adopted.
+    relaxAdoptionRequirement();
+
     m_database->transactionCoordinator()->didCreateTransaction(this);
 }
 
@@ -76,7 +78,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStor
     return objectStore.release();
 }
 
-bool IDBTransactionBackendImpl::scheduleTask(TaskType type, PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask)
+bool IDBTransactionBackendImpl::scheduleTask(TaskType type, PassOwnPtr<Operation> task, PassOwnPtr<Operation> abortTask)
 {
     if (m_state == Finished)
         return false;
@@ -123,8 +125,8 @@ void IDBTransactionBackendImpl::abort(PassRefPtr<IDBDatabaseError> error)
 
     // Run the abort tasks, if any.
     while (!m_abortTaskQueue.isEmpty()) {
-        OwnPtr<ScriptExecutionContext::Task> task(m_abortTaskQueue.takeFirst());
-        task->performTask(0);
+        OwnPtr<Operation> task(m_abortTaskQueue.takeFirst());
+        task->perform(0);
     }
 
     // Backing store resources (held via cursors) must be released before script callbacks
@@ -254,8 +256,8 @@ void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*
     TaskQueue* taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue;
     while (!taskQueue->isEmpty() && m_state != Finished) {
         ASSERT(m_state == Running);
-        OwnPtr<ScriptExecutionContext::Task> task(taskQueue->takeFirst());
-        task->performTask(0);
+        OwnPtr<Operation> task(taskQueue->takeFirst());
+        task->perform(this);
 
         // Event itself may change which queue should be processed next.
         taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue;
index d2a9585..512478d 100644 (file)
@@ -32,7 +32,6 @@
 #include "IDBDatabaseError.h"
 #include "IDBTransactionBackendInterface.h"
 #include "IDBTransactionCallbacks.h"
-#include "ScriptExecutionContext.h"
 #include "Timer.h"
 #include <wtf/Deque.h>
 #include <wtf/HashSet.h>
@@ -56,12 +55,18 @@ public:
     virtual void abort();
     virtual void setCallbacks(IDBTransactionCallbacks* callbacks) { m_callbacks = callbacks; }
 
+    class Operation {
+    public:
+        virtual ~Operation() { }
+        virtual void perform(IDBTransactionBackendImpl*) = 0;
+    };
+
     void abort(PassRefPtr<IDBDatabaseError>);
     void run();
     unsigned short mode() const { return m_mode; }
     bool isFinished() const { return m_state == Finished; }
-    bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr) { return scheduleTask(NormalTask, task, abortTask); }
-    bool scheduleTask(TaskType, PassOwnPtr<ScriptExecutionContext::Task>, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr);
+    bool scheduleTask(PassOwnPtr<Operation> task, PassOwnPtr<Operation> abortTask = nullptr) { return scheduleTask(NormalTask, task, abortTask); }
+    bool scheduleTask(TaskType, PassOwnPtr<Operation>, PassOwnPtr<Operation> abortTask = nullptr);
     void registerOpenCursor(IDBCursorBackendImpl*);
     void unregisterOpenCursor(IDBCursorBackendImpl*);
     void addPreemptiveEvent() { m_pendingPreemptiveEvents++; }
@@ -97,7 +102,7 @@ private:
     RefPtr<IDBTransactionCallbacks> m_callbacks;
     RefPtr<IDBDatabaseBackendImpl> m_database;
 
-    typedef Deque<OwnPtr<ScriptExecutionContext::Task> > TaskQueue;
+    typedef Deque<OwnPtr<Operation> > TaskQueue;
     TaskQueue m_taskQueue;
     TaskQueue m_preemptiveTaskQueue;
     TaskQueue m_abortTaskQueue;
index cc74d11..7a85c92 100644 (file)
@@ -27,7 +27,8 @@
 #define IDBTransactionBackendInterface_h
 
 #include "IDBCallbacks.h"
-#include <wtf/Threading.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(INDEXED_DATABASE)
@@ -44,7 +45,7 @@ typedef int ExceptionCode;
 // This is implemented by IDBTransactionBackendImpl and optionally others (in order to proxy
 // calls across process barriers). All calls to these classes should be non-blocking and
 // trigger work on a background thread if necessary.
-class IDBTransactionBackendInterface : public ThreadSafeRefCounted<IDBTransactionBackendInterface> {
+class IDBTransactionBackendInterface : public RefCounted<IDBTransactionBackendInterface> {
 public:
     virtual ~IDBTransactionBackendInterface() { }
 
index 6db0d70..cfd3d16 100644 (file)
@@ -31,7 +31,6 @@
 #include "IDBDatabaseBackendImpl.h"
 #include "IDBObjectStoreBackendInterface.h"
 #include "IDBTransactionBackendImpl.h"
-#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 
index 634450d..b907322 100644 (file)
@@ -1,3 +1,18 @@
+2012-12-05  Joshua Bell  <jsbell@chromium.org>
+
+        IndexedDB: Replace use of ScriptExecutionContext::Task (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=103931
+
+        Reviewed by Tony Chang.
+
+        Now that IDBCallbacks uses real RefPtr<> a mock class needs to be heap allocated.
+
+        * tests/IDBAbortOnCorruptTest.cpp:
+        (WebCore::MockIDBCallbacks::create):
+        (WebCore::MockIDBCallbacks::MockIDBCallbacks):
+        (MockIDBCallbacks):
+        (WebCore::TEST):
+
 2012-12-05  Stephen White  <senorblanco@chromium.org>
 
         Unreviewed.  Rolled DEPS.
index ec079f5..a3d80fd 100644 (file)
@@ -43,8 +43,10 @@ namespace {
 
 class MockIDBCallbacks : public IDBCallbacks {
 public:
-    MockIDBCallbacks() : m_wasErrorCalled(false) { }
-
+    static PassRefPtr<MockIDBCallbacks> create()
+    {
+        return adoptRef(new MockIDBCallbacks());
+    }
     virtual ~MockIDBCallbacks()
     {
         EXPECT_TRUE(m_wasErrorCalled);
@@ -69,6 +71,8 @@ public:
     virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { }
     virtual void onBlocked() { }
 private:
+    MockIDBCallbacks() : m_wasErrorCalled(false) { }
+
     bool m_wasErrorCalled;
 };
 
@@ -116,11 +120,11 @@ TEST(IDBAbortTest, TheTest)
 {
     RefPtr<IDBFactoryBackendImpl> factory = FailingIDBFactoryBackendImpl::create();
     const String& name = "db name";
-    MockIDBCallbacks callbacks;
+    RefPtr<MockIDBCallbacks> callbacks = MockIDBCallbacks::create();
     RefPtr<FakeIDBDatabaseCallbacks> databaseCallbacks = FakeIDBDatabaseCallbacks::create();
     RefPtr<SecurityOrigin> origin = SecurityOrigin::create("http", "localhost", 81);
     const int64_t DummyVersion = 2;
-    factory->open(name, DummyVersion, &callbacks, databaseCallbacks, origin, 0 /*Frame*/, String() /*path*/);
+    factory->open(name, DummyVersion, callbacks.get(), databaseCallbacks, origin, 0 /*Frame*/, String() /*path*/);
 }
 
 } // namespace