Commit 96d115ed authored by beidson@apple.com's avatar beidson@apple.com

Merge IDBCursorBackendInterface and IDBCursorBackendImpl

https://bugs.webkit.org/show_bug.cgi?id=124068

Reviewed by Anders Carlsson.

Source/WebCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBCursorBackendInterface.h: Removed.

* Modules/indexeddb/IDBCursorBackend.cpp: Renamed from Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp.
* Modules/indexeddb/IDBCursorBackend.h: Renamed from Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h.

* Modules/indexeddb/IDBCallbacks.h:
* Modules/indexeddb/IDBCursor.cpp:
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBCursorWithValue.cpp:
* Modules/indexeddb/IDBCursorWithValue.h:
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
* Modules/indexeddb/IDBFactoryBackendInterface.h:
* Modules/indexeddb/IDBRequest.cpp:
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
* Modules/indexeddb/IDBTransactionBackendImpl.h:
* Modules/indexeddb/IDBTransactionBackendInterface.h:
* Modules/indexeddb/IDBTransactionBackendOperations.cpp:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::WebIDBFactoryBackend::createCursorBackend):
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158959 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eefc25d1
...@@ -761,7 +761,7 @@ set(WebCore_SOURCES ...@@ -761,7 +761,7 @@ set(WebCore_SOURCES
Modules/indexeddb/DOMWindowIndexedDatabase.cpp Modules/indexeddb/DOMWindowIndexedDatabase.cpp
Modules/indexeddb/IDBAny.cpp Modules/indexeddb/IDBAny.cpp
Modules/indexeddb/IDBCursor.cpp Modules/indexeddb/IDBCursor.cpp
Modules/indexeddb/IDBCursorBackendImpl.cpp Modules/indexeddb/IDBCursorBackend.cpp
Modules/indexeddb/IDBCursorWithValue.cpp Modules/indexeddb/IDBCursorWithValue.cpp
Modules/indexeddb/IDBDatabase.cpp Modules/indexeddb/IDBDatabase.cpp
Modules/indexeddb/IDBDatabaseBackendImpl.cpp Modules/indexeddb/IDBDatabaseBackendImpl.cpp
......
2013-11-08 Brady Eidson <beidson@apple.com>
Merge IDBCursorBackendInterface and IDBCursorBackendImpl
https://bugs.webkit.org/show_bug.cgi?id=124068
Reviewed by Anders Carlsson.
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:
* Modules/indexeddb/IDBCursorBackendInterface.h: Removed.
* Modules/indexeddb/IDBCursorBackend.cpp: Renamed from Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp.
* Modules/indexeddb/IDBCursorBackend.h: Renamed from Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h.
* Modules/indexeddb/IDBCallbacks.h:
* Modules/indexeddb/IDBCursor.cpp:
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBCursorWithValue.cpp:
* Modules/indexeddb/IDBCursorWithValue.h:
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
* Modules/indexeddb/IDBFactoryBackendInterface.h:
* Modules/indexeddb/IDBRequest.cpp:
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
* Modules/indexeddb/IDBTransactionBackendImpl.h:
* Modules/indexeddb/IDBTransactionBackendInterface.h:
* Modules/indexeddb/IDBTransactionBackendOperations.cpp:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
2013-11-08 Sam Weinig <sam@webkit.org> 2013-11-08 Sam Weinig <sam@webkit.org>
Modernize FrameLoader a bit Modernize FrameLoader a bit
......
...@@ -1794,9 +1794,8 @@ webcore_modules_sources += \ ...@@ -1794,9 +1794,8 @@ webcore_modules_sources += \
Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.cpp \ Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.cpp \
Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h \ Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h \
Source/WebCore/Modules/indexeddb/IDBCallbacks.h \ Source/WebCore/Modules/indexeddb/IDBCallbacks.h \
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp \ Source/WebCore/Modules/indexeddb/IDBCursorBackend.cpp \
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h \ Source/WebCore/Modules/indexeddb/IDBCursorBackend.h \
Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h \
Source/WebCore/Modules/indexeddb/IDBCursor.cpp \ Source/WebCore/Modules/indexeddb/IDBCursor.cpp \
Source/WebCore/Modules/indexeddb/IDBCursor.h \ Source/WebCore/Modules/indexeddb/IDBCursor.h \
Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp \ Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp \
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
namespace WebCore { namespace WebCore {
class DOMStringList; class DOMStringList;
class IDBCursorBackendInterface; class IDBCursorBackend;
class IDBDatabaseBackendInterface; class IDBDatabaseBackendInterface;
struct IDBDatabaseMetadata; struct IDBDatabaseMetadata;
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
// From IDBFactory.webkitGetDatabaseNames() // From IDBFactory.webkitGetDatabaseNames()
virtual void onSuccess(PassRefPtr<DOMStringList>) = 0; virtual void onSuccess(PassRefPtr<DOMStringList>) = 0;
// From IDBObjectStore/IDBIndex.openCursor(), IDBIndex.openKeyCursor() // From IDBObjectStore/IDBIndex.openCursor(), IDBIndex.openKeyCursor()
virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>) = 0; virtual void onSuccess(PassRefPtr<IDBCursorBackend>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>) = 0;
// From IDBObjectStore.add()/put(), IDBIndex.getKey() // From IDBObjectStore.add()/put(), IDBIndex.getKey()
virtual void onSuccess(PassRefPtr<IDBKey>) = 0; virtual void onSuccess(PassRefPtr<IDBKey>) = 0;
// From IDBObjectStore/IDBIndex.get()/count(), and various methods that yield null/undefined. // From IDBObjectStore/IDBIndex.get()/count(), and various methods that yield null/undefined.
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "IDBAny.h" #include "IDBAny.h"
#include "IDBBindingUtilities.h" #include "IDBBindingUtilities.h"
#include "IDBCallbacks.h" #include "IDBCallbacks.h"
#include "IDBCursorBackendInterface.h" #include "IDBCursorBackend.h"
#include "IDBKey.h" #include "IDBKey.h"
#include "IDBObjectStore.h" #include "IDBObjectStore.h"
#include "IDBRequest.h" #include "IDBRequest.h"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
namespace WebCore { namespace WebCore {
PassRefPtr<IDBCursor> IDBCursor::create(PassRefPtr<IDBCursorBackendInterface> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) PassRefPtr<IDBCursor> IDBCursor::create(PassRefPtr<IDBCursorBackend> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction)
{ {
return adoptRef(new IDBCursor(backend, direction, request, source, transaction)); return adoptRef(new IDBCursor(backend, direction, request, source, transaction));
} }
...@@ -73,7 +73,7 @@ const AtomicString& IDBCursor::directionPrevUnique() ...@@ -73,7 +73,7 @@ const AtomicString& IDBCursor::directionPrevUnique()
} }
IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackendInterface> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackend> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction)
: m_backend(backend) : m_backend(backend)
, m_request(request) , m_request(request)
, m_direction(direction) , m_direction(direction)
......
...@@ -42,7 +42,7 @@ namespace WebCore { ...@@ -42,7 +42,7 @@ namespace WebCore {
class DOMRequestState; class DOMRequestState;
class IDBAny; class IDBAny;
class IDBCallbacks; class IDBCallbacks;
class IDBCursorBackendInterface; class IDBCursorBackend;
class IDBRequest; class IDBRequest;
class ScriptExecutionContext; class ScriptExecutionContext;
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
static IndexedDB::CursorDirection stringToDirection(const String& modeString, ExceptionCode&); static IndexedDB::CursorDirection stringToDirection(const String& modeString, ExceptionCode&);
static const AtomicString& directionToString(unsigned short mode); static const AtomicString& directionToString(unsigned short mode);
static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackend>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
virtual ~IDBCursor(); virtual ~IDBCursor();
// Implement the IDL // Implement the IDL
...@@ -82,13 +82,13 @@ public: ...@@ -82,13 +82,13 @@ public:
PassRefPtr<IDBKey> idbPrimaryKey() { return m_currentPrimaryKey; } PassRefPtr<IDBKey> idbPrimaryKey() { return m_currentPrimaryKey; }
protected: protected:
IDBCursor(PassRefPtr<IDBCursorBackendInterface>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); IDBCursor(PassRefPtr<IDBCursorBackend>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
virtual bool isKeyCursor() const { return true; } virtual bool isKeyCursor() const { return true; }
private: private:
PassRefPtr<IDBObjectStore> effectiveObjectStore(); PassRefPtr<IDBObjectStore> effectiveObjectStore();
RefPtr<IDBCursorBackendInterface> m_backend; RefPtr<IDBCursorBackend> m_backend;
RefPtr<IDBRequest> m_request; RefPtr<IDBRequest> m_request;
const IndexedDB::CursorDirection m_direction; const IndexedDB::CursorDirection m_direction;
RefPtr<IDBAny> m_source; RefPtr<IDBAny> m_source;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
*/ */
#include "config.h" #include "config.h"
#include "IDBCursorBackendImpl.h" #include "IDBCursorBackend.h"
#if ENABLE(INDEXED_DATABASE) #if ENABLE(INDEXED_DATABASE)
...@@ -41,67 +41,67 @@ ...@@ -41,67 +41,67 @@
namespace WebCore { namespace WebCore {
class IDBCursorBackendImpl::CursorIterationOperation : public IDBOperation { class IDBCursorBackend::CursorIterationOperation : public IDBOperation {
public: public:
static PassOwnPtr<IDBOperation> create(PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) static PassOwnPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
{ {
return adoptPtr(new CursorIterationOperation(cursor, key, callbacks)); return adoptPtr(new CursorIterationOperation(cursor, key, callbacks));
} }
virtual void perform() OVERRIDE FINAL; virtual void perform() OVERRIDE FINAL;
private: private:
CursorIterationOperation(PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) CursorIterationOperation(PassRefPtr<IDBCursorBackend> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
: m_cursor(cursor) : m_cursor(cursor)
, m_key(key) , m_key(key)
, m_callbacks(callbacks) , m_callbacks(callbacks)
{ {
} }
RefPtr<IDBCursorBackendImpl> m_cursor; RefPtr<IDBCursorBackend> m_cursor;
RefPtr<IDBKey> m_key; RefPtr<IDBKey> m_key;
RefPtr<IDBCallbacks> m_callbacks; RefPtr<IDBCallbacks> m_callbacks;
}; };
class IDBCursorBackendImpl::CursorAdvanceOperation : public IDBOperation { class IDBCursorBackend::CursorAdvanceOperation : public IDBOperation {
public: public:
static PassOwnPtr<IDBOperation> create(PassRefPtr<IDBCursorBackendImpl> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks) static PassOwnPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
{ {
return adoptPtr(new CursorAdvanceOperation(cursor, count, callbacks)); return adoptPtr(new CursorAdvanceOperation(cursor, count, callbacks));
} }
virtual void perform() OVERRIDE FINAL; virtual void perform() OVERRIDE FINAL;
private: private:
CursorAdvanceOperation(PassRefPtr<IDBCursorBackendImpl> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks) CursorAdvanceOperation(PassRefPtr<IDBCursorBackend> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
: m_cursor(cursor) : m_cursor(cursor)
, m_count(count) , m_count(count)
, m_callbacks(callbacks) , m_callbacks(callbacks)
{ {
} }
RefPtr<IDBCursorBackendImpl> m_cursor; RefPtr<IDBCursorBackend> m_cursor;
unsigned long m_count; unsigned long m_count;
RefPtr<IDBCallbacks> m_callbacks; RefPtr<IDBCallbacks> m_callbacks;
}; };
class IDBCursorBackendImpl::CursorPrefetchIterationOperation : public IDBOperation { class IDBCursorBackend::CursorPrefetchIterationOperation : public IDBOperation {
public: public:
static PassOwnPtr<IDBOperation> create(PassRefPtr<IDBCursorBackendImpl> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks) static PassOwnPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
{ {
return adoptPtr(new CursorPrefetchIterationOperation(cursor, numberToFetch, callbacks)); return adoptPtr(new CursorPrefetchIterationOperation(cursor, numberToFetch, callbacks));
} }
virtual void perform() OVERRIDE FINAL; virtual void perform() OVERRIDE FINAL;
private: private:
CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackendImpl> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks) CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
: m_cursor(cursor) : m_cursor(cursor)
, m_numberToFetch(numberToFetch) , m_numberToFetch(numberToFetch)
, m_callbacks(callbacks) , m_callbacks(callbacks)
{ {
} }
RefPtr<IDBCursorBackendImpl> m_cursor; RefPtr<IDBCursorBackend> m_cursor;
int m_numberToFetch; int m_numberToFetch;
RefPtr<IDBCallbacks> m_callbacks; RefPtr<IDBCallbacks> m_callbacks;
}; };
IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId) IDBCursorBackend::IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId)
: m_taskType(taskType) : m_taskType(taskType)
, m_cursorType(cursorType) , m_cursorType(cursorType)
, m_database(&(transaction->database())) , m_database(&(transaction->database()))
...@@ -113,27 +113,27 @@ IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStoreCursorInter ...@@ -113,27 +113,27 @@ IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStoreCursorInter
m_transaction->registerOpenCursor(this); m_transaction->registerOpenCursor(this);
} }
IDBCursorBackendImpl::~IDBCursorBackendImpl() IDBCursorBackend::~IDBCursorBackend()
{ {
m_transaction->unregisterOpenCursor(this); m_transaction->unregisterOpenCursor(this);
} }
void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) void IDBCursorBackend::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&)
{ {
LOG(StorageAPI, "IDBCursorBackendImpl::continue"); LOG(StorageAPI, "IDBCursorBackend::continue");
RefPtr<IDBCallbacks> callbacks = prpCallbacks; RefPtr<IDBCallbacks> callbacks = prpCallbacks;
m_transaction->scheduleTask(m_taskType, CursorIterationOperation::create(this, key, callbacks)); m_transaction->scheduleTask(m_taskType, CursorIterationOperation::create(this, key, callbacks));
} }
void IDBCursorBackendImpl::advance(unsigned long count, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) void IDBCursorBackend::advance(unsigned long count, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&)
{ {
LOG(StorageAPI, "IDBCursorBackendImpl::advance"); LOG(StorageAPI, "IDBCursorBackend::advance");
RefPtr<IDBCallbacks> callbacks = prpCallbacks; RefPtr<IDBCallbacks> callbacks = prpCallbacks;
m_transaction->scheduleTask(CursorAdvanceOperation::create(this, count, callbacks)); m_transaction->scheduleTask(CursorAdvanceOperation::create(this, count, callbacks));
} }
void IDBCursorBackendImpl::CursorAdvanceOperation::perform() void IDBCursorBackend::CursorAdvanceOperation::perform()
{ {
LOG(StorageAPI, "CursorAdvanceOperation"); LOG(StorageAPI, "CursorAdvanceOperation");
if (!m_cursor->m_cursor || !m_cursor->m_cursor->advance(m_count)) { if (!m_cursor->m_cursor || !m_cursor->m_cursor->advance(m_count)) {
...@@ -145,7 +145,7 @@ void IDBCursorBackendImpl::CursorAdvanceOperation::perform() ...@@ -145,7 +145,7 @@ void IDBCursorBackendImpl::CursorAdvanceOperation::perform()
m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value()); m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
} }
void IDBCursorBackendImpl::CursorIterationOperation::perform() void IDBCursorBackend::CursorIterationOperation::perform()
{ {
LOG(StorageAPI, "CursorIterationOperation"); LOG(StorageAPI, "CursorIterationOperation");
if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(m_key.get())) { if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(m_key.get())) {
...@@ -157,22 +157,22 @@ void IDBCursorBackendImpl::CursorIterationOperation::perform() ...@@ -157,22 +157,22 @@ void IDBCursorBackendImpl::CursorIterationOperation::perform()
m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value()); m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
} }
void IDBCursorBackendImpl::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) void IDBCursorBackend::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&)
{ {
LOG(StorageAPI, "IDBCursorBackendImpl::delete"); LOG(StorageAPI, "IDBCursorBackend::delete");
ASSERT(m_transaction->mode() != IndexedDB::TransactionReadOnly); ASSERT(m_transaction->mode() != IndexedDB::TransactionReadOnly);
RefPtr<IDBKeyRange> keyRange = IDBKeyRange::create(m_cursor->primaryKey()); RefPtr<IDBKeyRange> keyRange = IDBKeyRange::create(m_cursor->primaryKey());
m_database->deleteRange(m_transaction.get()->id(), m_objectStoreId, keyRange.release(), prpCallbacks); m_database->deleteRange(m_transaction.get()->id(), m_objectStoreId, keyRange.release(), prpCallbacks);
} }
void IDBCursorBackendImpl::prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) void IDBCursorBackend::prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&)
{ {
LOG(StorageAPI, "IDBCursorBackendImpl::prefetchContinue"); LOG(StorageAPI, "IDBCursorBackend::prefetchContinue");
RefPtr<IDBCallbacks> callbacks = prpCallbacks; RefPtr<IDBCallbacks> callbacks = prpCallbacks;
m_transaction->scheduleTask(m_taskType, CursorPrefetchIterationOperation::create(this, numberToFetch, callbacks)); m_transaction->scheduleTask(m_taskType, CursorPrefetchIterationOperation::create(this, numberToFetch, callbacks));
} }
void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform() void IDBCursorBackend::CursorPrefetchIterationOperation::perform()
{ {
LOG(StorageAPI, "CursorPrefetchIterationOperation"); LOG(StorageAPI, "CursorPrefetchIterationOperation");
...@@ -221,9 +221,9 @@ void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform() ...@@ -221,9 +221,9 @@ void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform()
m_callbacks->onSuccessWithPrefetch(foundKeys, foundPrimaryKeys, foundValues); m_callbacks->onSuccessWithPrefetch(foundKeys, foundPrimaryKeys, foundValues);
} }
void IDBCursorBackendImpl::prefetchReset(int usedPrefetches, int) void IDBCursorBackend::prefetchReset(int usedPrefetches, int)
{ {
LOG(StorageAPI, "IDBCursorBackendImpl::prefetchReset"); LOG(StorageAPI, "IDBCursorBackend::prefetchReset");
m_cursor = m_savedCursor; m_cursor = m_savedCursor;
m_savedCursor = 0; m_savedCursor = 0;
...@@ -237,9 +237,9 @@ void IDBCursorBackendImpl::prefetchReset(int usedPrefetches, int) ...@@ -237,9 +237,9 @@ void IDBCursorBackendImpl::prefetchReset(int usedPrefetches, int)
} }
} }
void IDBCursorBackendImpl::close() void IDBCursorBackend::close()
{ {
LOG(StorageAPI, "IDBCursorBackendImpl::close"); LOG(StorageAPI, "IDBCursorBackend::close");
m_closed = true; m_closed = true;
m_cursor.clear(); m_cursor.clear();
m_savedCursor.clear(); m_savedCursor.clear();
......
...@@ -24,13 +24,12 @@ ...@@ -24,13 +24,12 @@
*/ */
#ifndef IDBCursorBackendImpl_h #ifndef IDBCursorBackend_h
#define IDBCursorBackendImpl_h #define IDBCursorBackend_h
#if ENABLE(INDEXED_DATABASE) #if ENABLE(INDEXED_DATABASE)
#include "IDBBackingStoreInterface.h" #include "IDBBackingStoreInterface.h"
#include "IDBCursorBackendInterface.h"
#include "IDBDatabaseBackendImpl.h" #include "IDBDatabaseBackendImpl.h"
#include "IDBTransactionBackendImpl.h" #include "IDBTransactionBackendImpl.h"
#include "SharedBuffer.h" #include "SharedBuffer.h"
...@@ -42,34 +41,33 @@ namespace WebCore { ...@@ -42,34 +41,33 @@ namespace WebCore {
class IDBKeyRange; class IDBKeyRange;
class IDBCursorBackendImpl : public IDBCursorBackendInterface { class IDBCursorBackend : public RefCounted<IDBCursorBackend> {
public: public:
static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId) static PassRefPtr<IDBCursorBackend> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId)
{ {
return adoptRef(new IDBCursorBackendImpl(cursor, cursorType, IDBDatabaseBackendInterface::NormalTask, transaction, objectStoreId)); return adoptRef(new IDBCursorBackend(cursor, cursorType, IDBDatabaseBackendInterface::NormalTask, transaction, objectStoreId));
} }
static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId) static PassRefPtr<IDBCursorBackend> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId)
{ {
return adoptRef(new IDBCursorBackendImpl(cursor, cursorType, taskType, transaction, objectStoreId)); return adoptRef(new IDBCursorBackend(cursor, cursorType, taskType, transaction, objectStoreId));
} }
virtual ~IDBCursorBackendImpl(); ~IDBCursorBackend();
// IDBCursorBackendInterface void advance(unsigned long, PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void advance(unsigned long, PassRefPtr<IDBCallbacks>, ExceptionCode&); void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&); void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&); void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&); void prefetchReset(int usedPrefetches, int unusedPrefetches);
virtual void prefetchReset(int usedPrefetches, int unusedPrefetches); void postSuccessHandlerCallback() { }
virtual void postSuccessHandlerCallback() { }
virtual IDBKey* key() const OVERRIDE { return m_cursor->key().get(); } IDBKey* key() const { return m_cursor->key().get(); }
virtual IDBKey* primaryKey() const OVERRIDE { return m_cursor->primaryKey().get(); } IDBKey* primaryKey() const { return m_cursor->primaryKey().get(); }
virtual SharedBuffer* value() const OVERRIDE { return (m_cursorType == IndexedDB::CursorKeyOnly) ? 0 : m_cursor->value().get(); } SharedBuffer* value() const { return (m_cursorType == IndexedDB::CursorKeyOnly) ? 0 : m_cursor->value().get(); }
virtual void close() OVERRIDE; void close();
private: private:
IDBCursorBackendImpl(PassRefPtr<IDBBackingStoreCursorInterface>, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, IDBTransactionBackendInterface*, int64_t objectStoreId); IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface>, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, IDBTransactionBackendInterface*, int64_t objectStoreId);
class CursorIterationOperation; class CursorIterationOperation;
class CursorAdvanceOperation; class CursorAdvanceOperation;
...@@ -91,4 +89,4 @@ private: ...@@ -91,4 +89,4 @@ private:
#endif // ENABLE(INDEXED_DATABASE) #endif // ENABLE(INDEXED_DATABASE)
#endif // IDBCursorBackendImpl_h #endif // IDBCursorBackend_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IDBCursorBackendInterface_h
#define IDBCursorBackendInterface_h
#if ENABLE(INDEXED_DATABASE)
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class IDBCallbacks;
class IDBKey;
class IDBRequest;
class SharedBuffer;
typedef int ExceptionCode;
class IDBCursorBackendInterface : public RefCounted<IDBCursorBackendInterface> {
public:
virtual ~IDBCursorBackendInterface() {}