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
Modules/indexeddb/DOMWindowIndexedDatabase.cpp
Modules/indexeddb/IDBAny.cpp
Modules/indexeddb/IDBCursor.cpp
Modules/indexeddb/IDBCursorBackendImpl.cpp
Modules/indexeddb/IDBCursorBackend.cpp
Modules/indexeddb/IDBCursorWithValue.cpp
Modules/indexeddb/IDBDatabase.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>
Modernize FrameLoader a bit
......
......@@ -1794,9 +1794,8 @@ webcore_modules_sources += \
Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.cpp \
Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h \
Source/WebCore/Modules/indexeddb/IDBCallbacks.h \
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp \
Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h \
Source/WebCore/Modules/indexeddb/IDBCursorBackendInterface.h \
Source/WebCore/Modules/indexeddb/IDBCursorBackend.cpp \
Source/WebCore/Modules/indexeddb/IDBCursorBackend.h \
Source/WebCore/Modules/indexeddb/IDBCursor.cpp \
Source/WebCore/Modules/indexeddb/IDBCursor.h \
Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp \
......
......@@ -39,7 +39,7 @@
namespace WebCore {
class DOMStringList;
class IDBCursorBackendInterface;
class IDBCursorBackend;
class IDBDatabaseBackendInterface;
struct IDBDatabaseMetadata;
......@@ -52,7 +52,7 @@ public:
// From IDBFactory.webkitGetDatabaseNames()
virtual void onSuccess(PassRefPtr<DOMStringList>) = 0;
// 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()
virtual void onSuccess(PassRefPtr<IDBKey>) = 0;
// From IDBObjectStore/IDBIndex.get()/count(), and various methods that yield null/undefined.
......
......@@ -31,7 +31,7 @@
#include "IDBAny.h"
#include "IDBBindingUtilities.h"
#include "IDBCallbacks.h"
#include "IDBCursorBackendInterface.h"
#include "IDBCursorBackend.h"
#include "IDBKey.h"
#include "IDBObjectStore.h"
#include "IDBRequest.h"
......@@ -43,7 +43,7 @@
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));
}
......@@ -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_request(request)
, m_direction(direction)
......
......@@ -42,7 +42,7 @@ namespace WebCore {
class DOMRequestState;
class IDBAny;
class IDBCallbacks;
class IDBCursorBackendInterface;
class IDBCursorBackend;
class IDBRequest;
class ScriptExecutionContext;
......@@ -58,7 +58,7 @@ public:
static IndexedDB::CursorDirection stringToDirection(const String& modeString, ExceptionCode&);
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();
// Implement the IDL
......@@ -82,13 +82,13 @@ public:
PassRefPtr<IDBKey> idbPrimaryKey() { return m_currentPrimaryKey; }
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; }
private:
PassRefPtr<IDBObjectStore> effectiveObjectStore();
RefPtr<IDBCursorBackendInterface> m_backend;
RefPtr<IDBCursorBackend> m_backend;
RefPtr<IDBRequest> m_request;
const IndexedDB::CursorDirection m_direction;
RefPtr<IDBAny> m_source;
......
......@@ -24,7 +24,7 @@
*/
#include "config.h"
#include "IDBCursorBackendImpl.h"
#include "IDBCursorBackend.h"
#if ENABLE(INDEXED_DATABASE)
......@@ -41,67 +41,67 @@
namespace WebCore {
class IDBCursorBackendImpl::CursorIterationOperation : public IDBOperation {
class IDBCursorBackend::CursorIterationOperation : public IDBOperation {
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));
}
virtual void perform() OVERRIDE FINAL;
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_key(key)
, m_callbacks(callbacks)
{
}
RefPtr<IDBCursorBackendImpl> m_cursor;
RefPtr<IDBCursorBackend> m_cursor;
RefPtr<IDBKey> m_key;
RefPtr<IDBCallbacks> m_callbacks;
};
class IDBCursorBackendImpl::CursorAdvanceOperation : public IDBOperation {
class IDBCursorBackend::CursorAdvanceOperation : public IDBOperation {
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));
}
virtual void perform() OVERRIDE FINAL;
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_count(count)
, m_callbacks(callbacks)
{
}
RefPtr<IDBCursorBackendImpl> m_cursor;
RefPtr<IDBCursorBackend> m_cursor;
unsigned long m_count;
RefPtr<IDBCallbacks> m_callbacks;
};
class IDBCursorBackendImpl::CursorPrefetchIterationOperation : public IDBOperation {
class IDBCursorBackend::CursorPrefetchIterationOperation : public IDBOperation {
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));
}
virtual void perform() OVERRIDE FINAL;
private:
CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackendImpl> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
: m_cursor(cursor)
, m_numberToFetch(numberToFetch)
, m_callbacks(callbacks)
{
}
RefPtr<IDBCursorBackendImpl> m_cursor;
RefPtr<IDBCursorBackend> m_cursor;
int m_numberToFetch;
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_cursorType(cursorType)
, m_database(&(transaction->database()))
......@@ -113,27 +113,27 @@ IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBBackingStoreCursorInter
m_transaction->registerOpenCursor(this);
}
IDBCursorBackendImpl::~IDBCursorBackendImpl()
IDBCursorBackend::~IDBCursorBackend()
{
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;
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;
m_transaction->scheduleTask(CursorAdvanceOperation::create(this, count, callbacks));
}
void IDBCursorBackendImpl::CursorAdvanceOperation::perform()
void IDBCursorBackend::CursorAdvanceOperation::perform()
{
LOG(StorageAPI, "CursorAdvanceOperation");
if (!m_cursor->m_cursor || !m_cursor->m_cursor->advance(m_count)) {
......@@ -145,7 +145,7 @@ void IDBCursorBackendImpl::CursorAdvanceOperation::perform()
m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
}
void IDBCursorBackendImpl::CursorIterationOperation::perform()
void IDBCursorBackend::CursorIterationOperation::perform()
{
LOG(StorageAPI, "CursorIterationOperation");
if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(m_key.get())) {
......@@ -157,22 +157,22 @@ void IDBCursorBackendImpl::CursorIterationOperation::perform()
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);
RefPtr<IDBKeyRange> keyRange = IDBKeyRange::create(m_cursor->primaryKey());
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;
m_transaction->scheduleTask(m_taskType, CursorPrefetchIterationOperation::create(this, numberToFetch, callbacks));
}
void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform()
void IDBCursorBackend::CursorPrefetchIterationOperation::perform()
{
LOG(StorageAPI, "CursorPrefetchIterationOperation");
......@@ -221,9 +221,9 @@ void IDBCursorBackendImpl::CursorPrefetchIterationOperation::perform()
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_savedCursor = 0;
......@@ -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_cursor.clear();
m_savedCursor.clear();
......
......@@ -24,13 +24,12 @@
*/
#ifndef IDBCursorBackendImpl_h
#define IDBCursorBackendImpl_h
#ifndef IDBCursorBackend_h
#define IDBCursorBackend_h
#if ENABLE(INDEXED_DATABASE)
#include "IDBBackingStoreInterface.h"
#include "IDBCursorBackendInterface.h"
#include "IDBDatabaseBackendImpl.h"
#include "IDBTransactionBackendImpl.h"
#include "SharedBuffer.h"
......@@ -42,34 +41,33 @@ namespace WebCore {
class IDBKeyRange;
class IDBCursorBackendImpl : public IDBCursorBackendInterface {
class IDBCursorBackend : public RefCounted<IDBCursorBackend> {
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
virtual void advance(unsigned long, PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&);
virtual void prefetchReset(int usedPrefetches, int unusedPrefetches);
virtual void postSuccessHandlerCallback() { }
void advance(unsigned long, PassRefPtr<IDBCallbacks>, ExceptionCode&);
void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&);
void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&);
void prefetchReset(int usedPrefetches, int unusedPrefetches);
void postSuccessHandlerCallback() { }
virtual IDBKey* key() const OVERRIDE { return m_cursor->key().get(); }
virtual IDBKey* primaryKey() const OVERRIDE { return m_cursor->primaryKey().get(); }
virtual SharedBuffer* value() const OVERRIDE { return (m_cursorType == IndexedDB::CursorKeyOnly) ? 0 : m_cursor->value().get(); }
IDBKey* key() const { return m_cursor->key().get(); }
IDBKey* primaryKey() const { return m_cursor->primaryKey().get(); }
SharedBuffer* value() const { return (m_cursorType == IndexedDB::CursorKeyOnly) ? 0 : m_cursor->value().get(); }
virtual void close() OVERRIDE;
void close();
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 CursorAdvanceOperation;
......@@ -91,4 +89,4 @@ private:
#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() {}
virtual void advance(unsigned long count, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
virtual void continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
virtual void deleteFunction(PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
virtual void prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
virtual void prefetchReset(int usedPrefetches, int unusedPrefetches) = 0;
virtual void postSuccessHandlerCallback() = 0;
virtual IDBKey* key() const = 0;
virtual IDBKey* primaryKey() const = 0;
virtual SharedBuffer* value() const = 0;
virtual void close() = 0;
};
} // namespace WebCore
#endif
#endif // IDBCursorBackendInterface_h
......@@ -28,12 +28,12 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBCursorBackendInterface.h"
#include "IDBCursorBackend.h"
#include "IDBKey.h"
namespace WebCore {
PassRefPtr<IDBCursorWithValue> IDBCursorWithValue::create(PassRefPtr<IDBCursorBackendInterface> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction)
PassRefPtr<IDBCursorWithValue> IDBCursorWithValue::create(PassRefPtr<IDBCursorBackend> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction)
{
return adoptRef(new IDBCursorWithValue(backend, direction, request, source, transaction));
}
......@@ -44,7 +44,7 @@ PassRefPtr<IDBCursorWithValue> IDBCursorWithValue::fromCursor(PassRefPtr<IDBCurs
return cursorWithValue.release();
}
IDBCursorWithValue::IDBCursorWithValue(PassRefPtr<IDBCursorBackendInterface> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction)
IDBCursorWithValue::IDBCursorWithValue(PassRefPtr<IDBCursorBackend> backend, IndexedDB::CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction)
: IDBCursor(backend, direction, request, source, transaction)
{
}
......
......@@ -34,7 +34,7 @@ namespace WebCore {
class IDBCursorWithValue : public IDBCursor {
public:
static PassRefPtr<IDBCursorWithValue> create(PassRefPtr<IDBCursorBackendInterface>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
static PassRefPtr<IDBCursorWithValue> create(PassRefPtr<IDBCursorBackend>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
static PassRefPtr<IDBCursorWithValue> fromCursor(PassRefPtr<IDBCursor>);
virtual ~IDBCursorWithValue();
......@@ -45,7 +45,7 @@ protected:
virtual bool isKeyCursor() const OVERRIDE { return false; }
private:
IDBCursorWithValue(PassRefPtr<IDBCursorBackendInterface>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
IDBCursorWithValue(PassRefPtr<IDBCursorBackend>, IndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
};
} // namespace WebCore
......
......@@ -29,7 +29,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBBackingStoreInterface.h"
#include "IDBCursorBackendInterface.h"
#include "IDBCursorBackend.h"
#include "IDBDatabaseCallbacks.h"
#include "IDBDatabaseException.h"
#include "IDBFactoryBackendInterface.h"
......
......@@ -66,7 +66,7 @@ public:
virtual PassRefPtr<IDBTransactionBackendInterface> maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode) = 0;
virtual PassRefPtr<IDBCursorBackendInterface> createCursorBackend(IDBTransactionBackendInterface&, IDBBackingStoreCursorInterface&, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, int64_t objectStoreId) = 0;
virtual PassRefPtr<IDBCursorBackend> createCursorBackend(IDBTransactionBackendInterface&, IDBBackingStoreCursorInterface&, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, int64_t objectStoreId) = 0;
};
} // namespace WebCore
......
......@@ -37,7 +37,7 @@
#include "EventQueue.h"
#include "ExceptionCodePlaceholder.h"
#include "IDBBindingUtilities.h"
#include "IDBCursorBackendInterface.h"
#include "IDBCursorBackend.h"
#include "IDBCursorWithValue.h"
#include "IDBDatabase.h"
#include "IDBEventDispatcher.h"
......@@ -275,7 +275,7 @@ void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList)
enqueueEvent(createSuccessEvent());
}
void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> buffer)
void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackend> backend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> buffer)
{
LOG(StorageAPI, "IDBRequest::onSuccess(IDBCursor)");
if (!shouldEnqueueEvent())
......
......@@ -86,7 +86,7 @@ public:
// IDBCallbacks
virtual void onError(PassRefPtr<IDBDatabaseError>);
virtual void onSuccess(PassRefPtr<DOMStringList>);
virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>);
virtual void onSuccess(PassRefPtr<IDBCursorBackend>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>);
virtual void onSuccess(PassRefPtr<IDBKey>);
virtual void onSuccess(PassRefPtr<SharedBuffer>);
virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const IDBKeyPath&);
......
......@@ -28,7 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBCursorBackendInterface.h"
#include "IDBCursorBackend.h"
#include "IDBDatabaseBackendImpl.h"
#include "IDBDatabaseCallbacks.h"
#include "IDBDatabaseException.h"
......@@ -153,12 +153,12 @@ bool IDBTransactionBackendImpl::hasPendingTasks() const
return m_pendingPreemptiveEvents || !isTaskQueueEmpty();
}
void IDBTransactionBackendImpl::registerOpenCursor(IDBCursorBackendInterface* cursor)
void IDBTransactionBackendImpl::registerOpenCursor(IDBCursorBackend* cursor)
{
m_openCursors.add(cursor);
}
void IDBTransactionBackendImpl::unregisterOpenCursor(IDBCursorBackendInterface* cursor)
void IDBTransactionBackendImpl::unregisterOpenCursor(IDBCursorBackend* cursor)
{
m_openCursors.remove(cursor);
}
......@@ -265,7 +265,7 @@ void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*
void IDBTransactionBackendImpl::closeOpenCursors()
{
for (HashSet<IDBCursorBackendInterface*>::iterator i = m_openCursors.begin(); i != m_openCursors.end(); ++i)
for (HashSet<IDBCursorBackend*>::iterator i = m_openCursors.begin(); i != m_openCursors.end(); ++i)
(*i)->close();
m_openCursors.clear();
}
......@@ -330,7 +330,7 @@ void IDBTransactionBackendImpl::scheduleClearOperation(int64_t objectStoreId, Pa
scheduleTask(ClearOperation::create(this, m_backingStore.get(), database().id(), objectStoreId, callbacks));
}
PassRefPtr<IDBCursorBackendInterface> IDBTransactionBackendImpl::createCursorBackend(IDBBackingStoreCursorInterface& cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, int64_t objectStoreId)
PassRefPtr<IDBCursorBackend> IDBTransactionBackendImpl::createCursorBackend(IDBBackingStoreCursorInterface& cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, int64_t objectStoreId)
{
return m_database->factoryBackend().createCursorBackend(*this, cursor, cursorType, taskType, objectStoreId);
}
......
......@@ -59,8 +59,8 @@ public:
virtual void scheduleTask(PassOwnPtr<IDBOperation> task, PassOwnPtr<IDBOperation> abortTask = nullptr) { scheduleTask(IDBDatabaseBackendInterface::NormalTask, task, abortTask); }
virtual void scheduleTask(IDBDatabaseBackendInterface::TaskType, PassOwnPtr<IDBOperation>, PassOwnPtr<IDBOperation> abortTask = nullptr) OVERRIDE;
virtual void registerOpenCursor(IDBCursorBackendInterface*) OVERRIDE;
virtual void unregisterOpenCursor(IDBCursorBackendInterface*) OVERRIDE;
virtual void registerOpenCursor(IDBCursorBackend*) OVERRIDE;
<