summaryrefslogtreecommitdiffstats
path: root/WebCore/storage
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-08-11 14:44:44 +0100
committerBen Murdoch <benm@google.com>2010-08-12 19:15:41 +0100
commitdd8bb3de4f353a81954234999f1fea748aee2ea9 (patch)
tree729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /WebCore/storage
parentf3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff)
downloadexternal_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip
external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz
external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'WebCore/storage')
-rw-r--r--WebCore/storage/Database.cpp20
-rw-r--r--WebCore/storage/Database.h6
-rw-r--r--WebCore/storage/Database.idl6
-rw-r--r--WebCore/storage/DatabaseAuthorizer.h2
-rw-r--r--WebCore/storage/DatabaseCallback.h5
-rw-r--r--WebCore/storage/DatabaseSync.cpp14
-rw-r--r--WebCore/storage/DatabaseSync.h4
-rw-r--r--WebCore/storage/DatabaseSync.idl6
-rw-r--r--WebCore/storage/DatabaseTrackerClient.h3
-rw-r--r--WebCore/storage/EntryCallback.h2
-rw-r--r--WebCore/storage/ErrorCallback.h2
-rw-r--r--WebCore/storage/FileSystemCallback.h2
-rw-r--r--WebCore/storage/IDBAny.cpp44
-rw-r--r--WebCore/storage/IDBAny.h25
-rw-r--r--WebCore/storage/IDBCallbacks.h10
-rw-r--r--WebCore/storage/IDBCursor.cpp (renamed from WebCore/storage/IDBDatabaseRequest.cpp)55
-rw-r--r--WebCore/storage/IDBCursor.h (renamed from WebCore/storage/IDBDatabaseRequest.h)50
-rw-r--r--WebCore/storage/IDBCursor.idl44
-rw-r--r--WebCore/storage/IDBCursorBackendImpl.cpp88
-rw-r--r--WebCore/storage/IDBCursorBackendImpl.h71
-rw-r--r--WebCore/storage/IDBCursorBackendInterface.h (renamed from WebCore/storage/IDBObjectStoreRequest.h)50
-rw-r--r--WebCore/storage/IDBDatabase.cpp84
-rw-r--r--WebCore/storage/IDBDatabase.h46
-rw-r--r--WebCore/storage/IDBDatabase.idl (renamed from WebCore/storage/IDBDatabaseRequest.idl)6
-rw-r--r--WebCore/storage/IDBDatabaseBackendImpl.cpp (renamed from WebCore/storage/IDBDatabaseImpl.cpp)25
-rw-r--r--WebCore/storage/IDBDatabaseBackendImpl.h (renamed from WebCore/storage/IDBDatabaseImpl.h)22
-rw-r--r--WebCore/storage/IDBDatabaseBackendInterface.h68
-rw-r--r--WebCore/storage/IDBFactoryBackendImpl.cpp16
-rw-r--r--WebCore/storage/IDBFactoryBackendImpl.h4
-rw-r--r--WebCore/storage/IDBObjectStore.cpp (renamed from WebCore/storage/IDBObjectStoreRequest.cpp)32
-rw-r--r--WebCore/storage/IDBObjectStore.h46
-rw-r--r--WebCore/storage/IDBObjectStore.idl (renamed from WebCore/storage/IDBObjectStoreRequest.idl)4
-rwxr-xr-xWebCore/storage/IDBObjectStoreBackendImpl.cpp (renamed from WebCore/storage/IDBObjectStoreImpl.cpp)32
-rw-r--r--WebCore/storage/IDBObjectStoreBackendImpl.h (renamed from WebCore/storage/IDBObjectStoreImpl.h)20
-rw-r--r--WebCore/storage/IDBObjectStoreBackendInterface.h67
-rw-r--r--WebCore/storage/IDBRequest.cpp47
-rw-r--r--WebCore/storage/IDBRequest.h12
-rw-r--r--WebCore/storage/IDBTransaction.cpp72
-rw-r--r--WebCore/storage/IDBTransaction.h91
-rw-r--r--WebCore/storage/IDBTransaction.idl57
-rw-r--r--WebCore/storage/IDBTransactionBackendInterface.h62
-rw-r--r--WebCore/storage/MetadataCallback.h2
-rw-r--r--WebCore/storage/OriginUsageRecord.cpp6
-rw-r--r--WebCore/storage/SQLStatement.cpp4
-rw-r--r--WebCore/storage/SQLStatementCallback.h3
-rw-r--r--WebCore/storage/SQLStatementErrorCallback.h3
-rw-r--r--WebCore/storage/SQLTransaction.cpp4
-rw-r--r--WebCore/storage/SQLTransaction.h1
-rw-r--r--WebCore/storage/SQLTransactionCallback.h3
-rw-r--r--WebCore/storage/SQLTransactionErrorCallback.h3
-rw-r--r--WebCore/storage/SQLTransactionSync.cpp2
-rw-r--r--WebCore/storage/SQLTransactionSync.h1
-rw-r--r--WebCore/storage/SQLTransactionSyncCallback.h3
-rw-r--r--WebCore/storage/Storage.h1
-rw-r--r--WebCore/storage/chromium/DatabaseObserver.h3
55 files changed, 1074 insertions, 287 deletions
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 69f5036..9550083 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -68,9 +68,9 @@ public:
return new DatabaseCreationCallbackTask(database, creationCallback);
}
- virtual void performTask(ScriptExecutionContext* context)
+ virtual void performTask(ScriptExecutionContext*)
{
- m_creationCallback->handleEvent(context, m_database.get());
+ m_creationCallback->handleEvent(m_database.get());
}
private:
@@ -109,7 +109,7 @@ PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, con
if (context->isDocument()) {
Document* document = static_cast<Document*>(context);
if (Page* page = document->page())
- page->inspectorController()->didOpenDatabase(database.get(), context->securityOrigin()->host(), name, expectedVersion);
+ page->inspectorController()->didOpenDatabase(database, context->securityOrigin()->host(), name, expectedVersion);
}
#endif
@@ -270,8 +270,18 @@ void Database::changeVersion(const String& oldVersion, const String& newVersion,
scheduleTransaction();
}
-void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
- PassRefPtr<VoidCallback> successCallback, bool readOnly)
+void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
+{
+ runTransaction(callback, errorCallback, successCallback, false);
+}
+
+void Database::readTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
+{
+ runTransaction(callback, errorCallback, successCallback, true);
+}
+
+void Database::runTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+ PassRefPtr<VoidCallback> successCallback, bool readOnly)
{
m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, 0, readOnly));
MutexLocker locker(m_transactionInProgressMutex);
diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h
index e8482a7..47001a4 100644
--- a/WebCore/storage/Database.h
+++ b/WebCore/storage/Database.h
@@ -59,8 +59,8 @@ public:
virtual String version() const;
void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
- void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
- PassRefPtr<VoidCallback> successCallback, bool readOnly);
+ void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
+ void readTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
// Internal engine support
Vector<String> tableNames();
@@ -90,6 +90,8 @@ private:
Database(ScriptExecutionContext*, const String& name, const String& expectedVersion,
const String& displayName, unsigned long estimatedSize);
+ void runTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
+ PassRefPtr<VoidCallback> successCallback, bool readOnly);
bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&);
virtual bool performOpenAndVerify(bool setVersionInNewDatabase, ExceptionCode&);
diff --git a/WebCore/storage/Database.idl b/WebCore/storage/Database.idl
index ab79c97..20c2fa1 100644
--- a/WebCore/storage/Database.idl
+++ b/WebCore/storage/Database.idl
@@ -34,9 +34,9 @@ module storage {
NoStaticTables
] Database {
readonly attribute DOMString version;
- [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
- [Custom] void transaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
- [Custom] void readTransaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
+ [RequiresAllArguments=Raise] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback);
+ [RequiresAllArguments=Raise] void transaction(in [Callback] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback);
+ [RequiresAllArguments=Raise] void readTransaction(in [Callback] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback);
};
}
diff --git a/WebCore/storage/DatabaseAuthorizer.h b/WebCore/storage/DatabaseAuthorizer.h
index af6e016..66bc5d8 100644
--- a/WebCore/storage/DatabaseAuthorizer.h
+++ b/WebCore/storage/DatabaseAuthorizer.h
@@ -36,8 +36,6 @@
namespace WebCore {
-class String;
-
extern const int SQLAuthAllow;
extern const int SQLAuthIgnore;
extern const int SQLAuthDeny;
diff --git a/WebCore/storage/DatabaseCallback.h b/WebCore/storage/DatabaseCallback.h
index 9ece2a3..8ad56ed 100644
--- a/WebCore/storage/DatabaseCallback.h
+++ b/WebCore/storage/DatabaseCallback.h
@@ -39,13 +39,12 @@ namespace WebCore {
class Database;
class DatabaseSync;
-class ScriptExecutionContext;
class DatabaseCallback : public ThreadSafeShared<DatabaseCallback> {
public:
virtual ~DatabaseCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, Database*) = 0;
- virtual bool handleEvent(ScriptExecutionContext*, DatabaseSync*) = 0;
+ virtual bool handleEvent(Database*) = 0;
+ virtual bool handleEvent(DatabaseSync*) = 0;
};
}
diff --git a/WebCore/storage/DatabaseSync.cpp b/WebCore/storage/DatabaseSync.cpp
index f64c27f..817fdcc 100644
--- a/WebCore/storage/DatabaseSync.cpp
+++ b/WebCore/storage/DatabaseSync.cpp
@@ -68,7 +68,7 @@ PassRefPtr<DatabaseSync> DatabaseSync::openDatabaseSync(ScriptExecutionContext*
if (database->isNew() && creationCallback.get()) {
database->m_expectedVersion = "";
LOG(StorageAPI, "Invoking the creation callback for database %p\n", database.get());
- creationCallback->handleEvent(context, database.get());
+ creationCallback->handleEvent(database.get());
}
return database;
@@ -128,7 +128,17 @@ void DatabaseSync::changeVersion(const String& oldVersion, const String& newVers
setExpectedVersion(newVersion);
}
-void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec)
+void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
+{
+ runTransaction(callback, false, ec);
+}
+
+void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
+{
+ runTransaction(callback, true, ec);
+}
+
+void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec)
{
ASSERT(m_scriptExecutionContext->isContextThread());
diff --git a/WebCore/storage/DatabaseSync.h b/WebCore/storage/DatabaseSync.h
index 2019f85..6563b23 100644
--- a/WebCore/storage/DatabaseSync.h
+++ b/WebCore/storage/DatabaseSync.h
@@ -56,7 +56,8 @@ public:
static PassRefPtr<DatabaseSync> openDatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion,
const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&);
void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
- void transaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
+ void transaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
+ void readTransaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
virtual void markAsDeletedAndClose();
virtual void closeImmediately();
@@ -64,6 +65,7 @@ public:
private:
DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion,
const String& displayName, unsigned long estimatedSize);
+ void runTransaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
};
} // namespace WebCore
diff --git a/WebCore/storage/DatabaseSync.idl b/WebCore/storage/DatabaseSync.idl
index 30adf38..0064991 100644
--- a/WebCore/storage/DatabaseSync.idl
+++ b/WebCore/storage/DatabaseSync.idl
@@ -36,9 +36,9 @@ module storage {
NoStaticTables
] DatabaseSync {
readonly attribute DOMString version;
- [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionSyncCallback callback);
- [Custom] void transaction(in SQLTransactionSyncCallback callback);
- [Custom] void readTransaction(in SQLTransactionSyncCallback callback);
+ [RequiresAllArguments=Raise] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionSyncCallback callback) raises(DOMException);
+ [RequiresAllArguments=Raise] void transaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);
+ [RequiresAllArguments=Raise] void readTransaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);
};
}
diff --git a/WebCore/storage/DatabaseTrackerClient.h b/WebCore/storage/DatabaseTrackerClient.h
index b43123c..2e0497f 100644
--- a/WebCore/storage/DatabaseTrackerClient.h
+++ b/WebCore/storage/DatabaseTrackerClient.h
@@ -30,10 +30,11 @@
#if ENABLE(DATABASE)
+#include <wtf/Forward.h>
+
namespace WebCore {
class SecurityOrigin;
-class String;
class DatabaseTrackerClient {
public:
diff --git a/WebCore/storage/EntryCallback.h b/WebCore/storage/EntryCallback.h
index 58aa34a..121bf07 100644
--- a/WebCore/storage/EntryCallback.h
+++ b/WebCore/storage/EntryCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
class EntryCallback : public RefCounted<EntryCallback> {
public:
virtual ~EntryCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, Entry*) = 0;
+ virtual bool handleEvent(Entry*) = 0;
};
} // namespace
diff --git a/WebCore/storage/ErrorCallback.h b/WebCore/storage/ErrorCallback.h
index 8cddbc7..91143e8 100644
--- a/WebCore/storage/ErrorCallback.h
+++ b/WebCore/storage/ErrorCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
class ErrorCallback : public RefCounted<ErrorCallback> {
public:
virtual ~ErrorCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, FileError*) = 0;
+ virtual bool handleEvent(FileError*) = 0;
};
} // namespace
diff --git a/WebCore/storage/FileSystemCallback.h b/WebCore/storage/FileSystemCallback.h
index a3bf34d..19f44df 100644
--- a/WebCore/storage/FileSystemCallback.h
+++ b/WebCore/storage/FileSystemCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
class FileSystemCallback : public RefCounted<FileSystemCallback> {
public:
virtual ~FileSystemCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, DOMFileSystem*) = 0;
+ virtual bool handleEvent(DOMFileSystem*) = 0;
};
} // namespace
diff --git a/WebCore/storage/IDBAny.cpp b/WebCore/storage/IDBAny.cpp
index da0cb22..93d2633 100644
--- a/WebCore/storage/IDBAny.cpp
+++ b/WebCore/storage/IDBAny.cpp
@@ -28,10 +28,11 @@
#if ENABLE(INDEXED_DATABASE)
-#include "IDBDatabaseRequest.h"
+#include "IDBCursor.h"
+#include "IDBDatabase.h"
#include "IDBFactory.h"
#include "IDBIndex.h"
-#include "IDBObjectStoreRequest.h"
+#include "IDBObjectStore.h"
#include "SerializedScriptValue.h"
namespace WebCore {
@@ -50,10 +51,16 @@ IDBAny::~IDBAny()
{
}
-PassRefPtr<IDBDatabaseRequest> IDBAny::idbDatabaseRequest()
+PassRefPtr<IDBCursor> IDBAny::idbCursor()
{
- ASSERT(m_type == IDBDatabaseRequestType);
- return m_idbDatabaseRequest;
+ ASSERT(m_type == IDBCursorType);
+ return m_idbCursor;
+}
+
+PassRefPtr<IDBDatabase> IDBAny::idbDatabase()
+{
+ ASSERT(m_type == IDBDatabaseType);
+ return m_idbDatabase;
}
PassRefPtr<IDBIndex> IDBAny::idbIndex()
@@ -68,10 +75,10 @@ PassRefPtr<IDBKey> IDBAny::idbKey()
return m_idbKey;
}
-PassRefPtr<IDBObjectStoreRequest> IDBAny::idbObjectStoreRequest()
+PassRefPtr<IDBObjectStore> IDBAny::idbObjectStore()
{
- ASSERT(m_type == IDBObjectStoreRequestType);
- return m_idbObjectStoreRequest;
+ ASSERT(m_type == IDBObjectStoreType);
+ return m_idbObjectStore;
}
PassRefPtr<IDBFactory> IDBAny::idbFactory()
@@ -92,17 +99,24 @@ void IDBAny::set()
m_type = NullType;
}
-void IDBAny::set(PassRefPtr<IDBDatabaseRequest> value)
+void IDBAny::set(PassRefPtr<IDBCursor> value)
+{
+ ASSERT(m_type == UndefinedType);
+ m_type = IDBCursorType;
+ m_idbCursor = value;
+}
+
+void IDBAny::set(PassRefPtr<IDBDatabase> value)
{
ASSERT(m_type == UndefinedType);
- m_type = IDBDatabaseRequestType;
- m_idbDatabaseRequest = value;
+ m_type = IDBDatabaseType;
+ m_idbDatabase = value;
}
void IDBAny::set(PassRefPtr<IDBIndex> value)
{
ASSERT(m_type == UndefinedType);
- m_type = IDBDatabaseRequestType;
+ m_type = IDBDatabaseType;
m_idbIndex = value;
}
@@ -113,11 +127,11 @@ void IDBAny::set(PassRefPtr<IDBKey> value)
m_idbKey = value;
}
-void IDBAny::set(PassRefPtr<IDBObjectStoreRequest> value)
+void IDBAny::set(PassRefPtr<IDBObjectStore> value)
{
ASSERT(m_type == UndefinedType);
- m_type = IDBObjectStoreRequestType;
- m_idbObjectStoreRequest = value;
+ m_type = IDBObjectStoreType;
+ m_idbObjectStore = value;
}
void IDBAny::set(PassRefPtr<IDBFactory> value)
diff --git a/WebCore/storage/IDBAny.h b/WebCore/storage/IDBAny.h
index a7859a1..950660a 100644
--- a/WebCore/storage/IDBAny.h
+++ b/WebCore/storage/IDBAny.h
@@ -34,10 +34,11 @@
namespace WebCore {
-class IDBDatabaseRequest;
+class IDBCursor;
+class IDBDatabase;
class IDBIndex;
class IDBKey;
-class IDBObjectStoreRequest;
+class IDBObjectStore;
class IDBFactory;
class SerializedScriptValue;
@@ -56,30 +57,33 @@ public:
enum Type {
UndefinedType = 0,
NullType,
- IDBDatabaseRequestType,
+ IDBCursorType,
+ IDBDatabaseType,
IDBFactoryType,
IDBIndexType,
IDBKeyType,
- IDBObjectStoreRequestType,
+ IDBObjectStoreType,
SerializedScriptValueType
};
Type type() const { return m_type; }
// Use type() to figure out which one of these you're allowed to call.
- PassRefPtr<IDBDatabaseRequest> idbDatabaseRequest();
+ PassRefPtr<IDBCursor> idbCursor();
+ PassRefPtr<IDBDatabase> idbDatabase();
PassRefPtr<IDBFactory> idbFactory();
PassRefPtr<IDBIndex> idbIndex();
PassRefPtr<IDBKey> idbKey();
- PassRefPtr<IDBObjectStoreRequest> idbObjectStoreRequest();
+ PassRefPtr<IDBObjectStore> idbObjectStore();
PassRefPtr<SerializedScriptValue> serializedScriptValue();
// Set can only be called once.
void set(); // For "null".
- void set(PassRefPtr<IDBDatabaseRequest>);
+ void set(PassRefPtr<IDBCursor>);
+ void set(PassRefPtr<IDBDatabase>);
void set(PassRefPtr<IDBFactory>);
void set(PassRefPtr<IDBIndex>);
void set(PassRefPtr<IDBKey>);
- void set(PassRefPtr<IDBObjectStoreRequest>);
+ void set(PassRefPtr<IDBObjectStore>);
void set(PassRefPtr<SerializedScriptValue>);
private:
@@ -88,11 +92,12 @@ private:
Type m_type;
// Only one of the following should ever be in use at any given time.
- RefPtr<IDBDatabaseRequest> m_idbDatabaseRequest;
+ RefPtr<IDBCursor> m_idbCursor;
+ RefPtr<IDBDatabase> m_idbDatabase;
RefPtr<IDBFactory> m_idbFactory;
RefPtr<IDBIndex> m_idbIndex;
RefPtr<IDBKey> m_idbKey;
- RefPtr<IDBObjectStoreRequest> m_idbObjectStoreRequest;
+ RefPtr<IDBObjectStore> m_idbObjectStore;
RefPtr<SerializedScriptValue> m_serializedScriptValue;
};
diff --git a/WebCore/storage/IDBCallbacks.h b/WebCore/storage/IDBCallbacks.h
index d79cdec..bc48477 100644
--- a/WebCore/storage/IDBCallbacks.h
+++ b/WebCore/storage/IDBCallbacks.h
@@ -29,11 +29,12 @@
#ifndef IDBCallbacks_h
#define IDBCallbacks_h
-#include "IDBDatabase.h"
+#include "IDBCursorBackendInterface.h"
+#include "IDBDatabaseBackendInterface.h"
#include "IDBDatabaseError.h"
#include "IDBIndexBackendInterface.h"
#include "IDBKey.h"
-#include "IDBObjectStore.h"
+#include "IDBObjectStoreBackendInterface.h"
#include "SerializedScriptValue.h"
#include <wtf/RefCounted.h>
@@ -47,10 +48,11 @@ public:
virtual void onError(PassRefPtr<IDBDatabaseError>) = 0;
virtual void onSuccess() = 0; // For "null".
- virtual void onSuccess(PassRefPtr<IDBDatabase>) = 0;
+ virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>) = 0;
+ virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) = 0;
virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>) = 0;
virtual void onSuccess(PassRefPtr<IDBKey>) = 0;
- virtual void onSuccess(PassRefPtr<IDBObjectStore>) = 0;
+ virtual void onSuccess(PassRefPtr<IDBObjectStoreBackendInterface>) = 0;
virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0;
};
diff --git a/WebCore/storage/IDBDatabaseRequest.cpp b/WebCore/storage/IDBCursor.cpp
index 8a40e9e..de752f5 100644
--- a/WebCore/storage/IDBDatabaseRequest.cpp
+++ b/WebCore/storage/IDBCursor.cpp
@@ -24,48 +24,63 @@
*/
#include "config.h"
-#include "IDBDatabaseRequest.h"
+#include "IDBCursor.h"
+
+#if ENABLE(INDEXED_DATABASE)
#include "IDBAny.h"
-#include "IDBFactoryBackendInterface.h"
-#include "IDBObjectStoreRequest.h"
+#include "IDBCallbacks.h"
+#include "IDBCursorBackendInterface.h"
+#include "IDBKey.h"
#include "IDBRequest.h"
#include "ScriptExecutionContext.h"
-
-#if ENABLE(INDEXED_DATABASE)
+#include "SerializedScriptValue.h"
namespace WebCore {
-IDBDatabaseRequest::IDBDatabaseRequest(PassRefPtr<IDBDatabase> database)
- : m_database(database)
+IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackendInterface> backend)
+ : m_backend(backend)
+{
+}
+
+IDBCursor::~IDBCursor()
{
- // We pass a reference to this object before it can be adopted.
- relaxAdoptionRequirement();
}
-IDBDatabaseRequest::~IDBDatabaseRequest()
+unsigned short IDBCursor::direction() const
{
+ return m_backend->direction();
}
-PassRefPtr<IDBRequest> IDBDatabaseRequest::createObjectStore(ScriptExecutionContext* context, const String& name, const String& keyPath, bool autoIncrement)
+PassRefPtr<IDBKey> IDBCursor::key() const
+{
+ return m_backend->key();
+}
+
+PassRefPtr<IDBAny> IDBCursor::value() const
+{
+ return m_backend->value();
+}
+
+PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
- m_database->createObjectStore(name, keyPath, autoIncrement, request);
- return request;
+ m_backend->update(value, request);
+ return request.release();
}
-PassRefPtr<IDBObjectStoreRequest> IDBDatabaseRequest::objectStore(const String& name, unsigned short mode)
+PassRefPtr<IDBRequest> IDBCursor::continueFunction(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
{
- RefPtr<IDBObjectStore> objectStore = m_database->objectStore(name, mode);
- ASSERT(objectStore); // FIXME: If this is null, we should raise a NOT_FOUND_ERR.
- return IDBObjectStoreRequest::create(objectStore.release());
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+ m_backend->continueFunction(key, request);
+ return request.release();
}
-PassRefPtr<IDBRequest> IDBDatabaseRequest::removeObjectStore(ScriptExecutionContext* context, const String& name)
+PassRefPtr<IDBRequest> IDBCursor::remove(ScriptExecutionContext* context)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
- m_database->removeObjectStore(name, request);
- return request;
+ m_backend->remove(request);
+ return request.release();
}
} // namespace WebCore
diff --git a/WebCore/storage/IDBDatabaseRequest.h b/WebCore/storage/IDBCursor.h
index fd19882..ccce001 100644
--- a/WebCore/storage/IDBDatabaseRequest.h
+++ b/WebCore/storage/IDBCursor.h
@@ -23,50 +23,56 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IDBDatabaseRequest_h
-#define IDBDatabaseRequest_h
+#ifndef IDBCursor_h
+#define IDBCursor_h
+
+#if ENABLE(INDEXED_DATABASE)
-#include "DOMStringList.h"
-#include "IDBDatabase.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-
-#if ENABLE(INDEXED_DATABASE)
+#include <wtf/Threading.h>
namespace WebCore {
class IDBAny;
-class IDBObjectStoreRequest;
+class IDBCallbacks;
+class IDBCursorBackendInterface;
+class IDBKey;
class IDBRequest;
class ScriptExecutionContext;
+class SerializedScriptValue;
-class IDBDatabaseRequest : public RefCounted<IDBDatabaseRequest> {
+class IDBCursor : public ThreadSafeShared<IDBCursor> {
public:
- static PassRefPtr<IDBDatabaseRequest> create(PassRefPtr<IDBDatabase> database)
+ enum Direction {
+ NEXT = 0,
+ NEXT_NO_DUPLICATE = 1,
+ PREV = 2,
+ PREV_NO_DUPLICATE = 3,
+ };
+ static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface> backend)
{
- return adoptRef(new IDBDatabaseRequest(database));
+ return adoptRef(new IDBCursor(backend));
}
- ~IDBDatabaseRequest();
+ virtual ~IDBCursor();
// Implement the IDL
- String name() const { return m_database->name(); }
- String description() const { return m_database->description(); }
- String version() const { return m_database->version(); }
- PassRefPtr<DOMStringList> objectStores() const { return m_database->objectStores(); }
-
- PassRefPtr<IDBRequest> createObjectStore(ScriptExecutionContext*, const String& name, const String& keyPath = String(), bool autoIncrement = false);
- PassRefPtr<IDBObjectStoreRequest> objectStore(const String& name, unsigned short mode = 0); // FIXME: Use constant rather than 0.
- PassRefPtr<IDBRequest> removeObjectStore(ScriptExecutionContext*, const String& name);
+ virtual unsigned short direction() const;
+ virtual PassRefPtr<IDBKey> key() const;
+ virtual PassRefPtr<IDBAny> value() const;
+ virtual PassRefPtr<IDBRequest> update(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>);
+ virtual PassRefPtr<IDBRequest> continueFunction(ScriptExecutionContext*, PassRefPtr<IDBKey> = 0);
+ virtual PassRefPtr<IDBRequest> remove(ScriptExecutionContext*);
private:
- IDBDatabaseRequest(PassRefPtr<IDBDatabase>);
+ explicit IDBCursor(PassRefPtr<IDBCursorBackendInterface>);
- RefPtr<IDBDatabase> m_database;
+ RefPtr<IDBCursorBackendInterface> m_backend;
};
} // namespace WebCore
#endif
-#endif // IDBDatabaseRequest_h
+#endif // IDBCursor_h
diff --git a/WebCore/storage/IDBCursor.idl b/WebCore/storage/IDBCursor.idl
new file mode 100644
index 0000000..3702ef3
--- /dev/null
+++ b/WebCore/storage/IDBCursor.idl
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+module storage {
+
+ interface [
+ Conditional=INDEXED_DATABASE
+ ] IDBCursor {
+ const unsigned short NEXT = 0;
+ const unsigned short NEXT_NO_DUPLICATE = 1;
+ const unsigned short PREV = 2;
+ const unsigned short PREV_NO_DUPLICATE = 3;
+
+ readonly attribute unsigned short direction;
+ readonly attribute IDBKey key;
+ readonly attribute IDBAny value;
+
+ [CallWith=ScriptExecutionContext] IDBRequest update(in SerializedScriptValue value);
+ [CallWith=ScriptExecutionContext, ImplementationFunction=continueFunction] IDBRequest continue(in [Optional] IDBKey key);
+ [CallWith=ScriptExecutionContext] IDBRequest remove();
+ };
+}
diff --git a/WebCore/storage/IDBCursorBackendImpl.cpp b/WebCore/storage/IDBCursorBackendImpl.cpp
new file mode 100644
index 0000000..4e08b8f
--- /dev/null
+++ b/WebCore/storage/IDBCursorBackendImpl.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "IDBCursorBackendImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBAny.h"
+#include "IDBCallbacks.h"
+#include "IDBKeyRange.h"
+#include "IDBObjectStoreBackendImpl.h"
+#include "IDBRequest.h"
+#include "SerializedScriptValue.h"
+
+namespace WebCore {
+
+IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl> idbObjectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value)
+ : m_idbObjectStore(idbObjectStore)
+ , m_keyRange(keyRange)
+ , m_direction(direction)
+ , m_key(key)
+ , m_value(IDBAny::create(value.get()))
+{
+}
+
+IDBCursorBackendImpl::~IDBCursorBackendImpl()
+{
+}
+
+unsigned short IDBCursorBackendImpl::direction() const
+{
+ return m_direction;
+}
+
+PassRefPtr<IDBKey> IDBCursorBackendImpl::key() const
+{
+ return m_key;
+}
+
+PassRefPtr<IDBAny> IDBCursorBackendImpl::value() const
+{
+ return m_value;
+}
+
+void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>)
+{
+ // FIXME: Implement this method.
+ ASSERT_NOT_REACHED();
+}
+
+void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>)
+{
+ // FIXME: Implement this method.
+ ASSERT_NOT_REACHED();
+}
+
+void IDBCursorBackendImpl::remove(PassRefPtr<IDBCallbacks>)
+{
+ // FIXME: Implement this method.
+ ASSERT_NOT_REACHED();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBCursorBackendImpl.h b/WebCore/storage/IDBCursorBackendImpl.h
new file mode 100644
index 0000000..9ef62fe
--- /dev/null
+++ b/WebCore/storage/IDBCursorBackendImpl.h
@@ -0,0 +1,71 @@
+/*
+ * 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 IDBCursorBackendImpl_h
+#define IDBCursorBackendImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBCursor.h"
+#include "IDBCursorBackendInterface.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBKeyRange;
+class IDBObjectStoreBackendImpl;
+class SerializedScriptValue;
+
+class IDBCursorBackendImpl : public IDBCursorBackendInterface {
+public:
+ static PassRefPtr<IDBCursorBackendImpl> create(PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value)
+ {
+ return adoptRef(new IDBCursorBackendImpl(objectStore, keyRange, direction, key, value));
+ }
+ virtual ~IDBCursorBackendImpl();
+
+ virtual unsigned short direction() const;
+ virtual PassRefPtr<IDBKey> key() const;
+ virtual PassRefPtr<IDBAny> value() const;
+ virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>);
+ virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
+ virtual void remove(PassRefPtr<IDBCallbacks>);
+
+private:
+ IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>);
+
+ RefPtr<IDBObjectStoreBackendImpl> m_idbObjectStore;
+ RefPtr<IDBKeyRange> m_keyRange;
+ IDBCursor::Direction m_direction;
+ RefPtr<IDBKey> m_key;
+ RefPtr<IDBAny> m_value;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBCursorBackendImpl_h
diff --git a/WebCore/storage/IDBObjectStoreRequest.h b/WebCore/storage/IDBCursorBackendInterface.h
index bfd01f0..4b209c4 100644
--- a/WebCore/storage/IDBObjectStoreRequest.h
+++ b/WebCore/storage/IDBCursorBackendInterface.h
@@ -23,56 +23,38 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IDBObjectStoreRequest_h
-#define IDBObjectStoreRequest_h
+#ifndef IDBCursorBackendInterface_h
+#define IDBCursorBackendInterface_h
+
+#if ENABLE(INDEXED_DATABASE)
-#include "IDBObjectStore.h"
-#include "IDBRequest.h"
-#include "PlatformString.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-#if ENABLE(INDEXED_DATABASE)
+#include <wtf/Threading.h>
namespace WebCore {
-class DOMStringList;
class IDBAny;
-class IDBIndexRequest;
+class IDBCallbacks;
class IDBKey;
+class IDBRequest;
class SerializedScriptValue;
-class IDBObjectStoreRequest : public RefCounted<IDBObjectStoreRequest> {
+class IDBCursorBackendInterface : public ThreadSafeShared<IDBCursorBackendInterface> {
public:
- static PassRefPtr<IDBObjectStoreRequest> create(PassRefPtr<IDBObjectStore> idbObjectStore)
- {
- return adoptRef(new IDBObjectStoreRequest(idbObjectStore));
- }
- ~IDBObjectStoreRequest() { }
+ virtual ~IDBCursorBackendInterface() {}
- String name() const;
- String keyPath() const;
- PassRefPtr<DOMStringList> indexNames() const;
+ virtual unsigned short direction() const = 0;
+ virtual PassRefPtr<IDBKey> key() const = 0;
+ virtual PassRefPtr<IDBAny> value() const = 0;
- PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
- PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
- PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
- PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
-
- PassRefPtr<IDBRequest> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, bool unique = false);
- PassRefPtr<IDBIndex> index(const String& name);
- PassRefPtr<IDBRequest> removeIndex(ScriptExecutionContext*, const String& name);
-
-private:
- IDBObjectStoreRequest(PassRefPtr<IDBObjectStore>);
-
- RefPtr<IDBObjectStore> m_objectStore;
+ virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>) = 0;
+ virtual void continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0;
+ virtual void remove(PassRefPtr<IDBCallbacks>) = 0;
};
} // namespace WebCore
#endif
-#endif // IDBObjectStoreRequest_h
-
+#endif // IDBCursorBackendInterface_h
diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp
new file mode 100644
index 0000000..fa1807c
--- /dev/null
+++ b/WebCore/storage/IDBDatabase.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "IDBDatabase.h"
+
+#include "IDBAny.h"
+#include "IDBFactoryBackendInterface.h"
+#include "IDBObjectStore.h"
+#include "IDBRequest.h"
+#include "IDBTransaction.h"
+#include "ScriptExecutionContext.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+IDBDatabase::IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface> backend)
+ : m_backend(backend)
+{
+ // We pass a reference to this object before it can be adopted.
+ relaxAdoptionRequirement();
+}
+
+IDBDatabase::~IDBDatabase()
+{
+}
+
+PassRefPtr<IDBRequest> IDBDatabase::createObjectStore(ScriptExecutionContext* context, const String& name, const String& keyPath, bool autoIncrement)
+{
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+ m_backend->createObjectStore(name, keyPath, autoIncrement, request);
+ return request;
+}
+
+PassRefPtr<IDBObjectStore> IDBDatabase::objectStore(const String& name, unsigned short mode)
+{
+ RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->objectStore(name, mode);
+ ASSERT(objectStore); // FIXME: If this is null, we should raise a NOT_FOUND_ERR.
+ return IDBObjectStore::create(objectStore.release());
+}
+
+PassRefPtr<IDBRequest> IDBDatabase::removeObjectStore(ScriptExecutionContext* context, const String& name)
+{
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+ m_backend->removeObjectStore(name, request);
+ return request;
+}
+
+PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, DOMStringList* storeNames, unsigned short mode, unsigned long timeout)
+{
+ // We need to create a new transaction synchronously. Locks are acquired asynchronously. Operations
+ // can be queued against the transaction at any point. They will start executing as soon as the
+ // appropriate locks have been acquired.
+ RefPtr<IDBTransactionBackendInterface> transactionBackend = m_backend->transaction(storeNames, mode, timeout);
+ RefPtr<IDBTransaction> transaction = IDBTransaction::create(context, transactionBackend.release(), this);
+ return transaction.release();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h
index 0055ad1..6900efd 100644
--- a/WebCore/storage/IDBDatabase.h
+++ b/WebCore/storage/IDBDatabase.h
@@ -26,37 +26,45 @@
#ifndef IDBDatabase_h
#define IDBDatabase_h
-#include "PlatformString.h"
+#include "DOMStringList.h"
+#include "IDBDatabaseBackendInterface.h"
+#include "IDBTransaction.h"
#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
-class DOMStringList;
-class Frame;
-class IDBCallbacks;
+class IDBAny;
class IDBObjectStore;
+class IDBRequest;
+class ScriptExecutionContext;
-// This class is shared by IDBDatabaseRequest (async) and IDBDatabaseSync (sync).
-// This is implemented by IDBDatabaseImpl 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 IDBDatabase : public ThreadSafeShared<IDBDatabase> {
+class IDBDatabase : public RefCounted<IDBDatabase> {
public:
- virtual ~IDBDatabase() { }
+ static PassRefPtr<IDBDatabase> create(PassRefPtr<IDBDatabaseBackendInterface> database)
+ {
+ return adoptRef(new IDBDatabase(database));
+ }
+ ~IDBDatabase();
- virtual String name() const = 0;
- virtual String description() const = 0;
- virtual String version() const = 0;
- virtual PassRefPtr<DOMStringList> objectStores() const = 0;
+ // Implement the IDL
+ String name() const { return m_backend->name(); }
+ String description() const { return m_backend->description(); }
+ String version() const { return m_backend->version(); }
+ PassRefPtr<DOMStringList> objectStores() const { return m_backend->objectStores(); }
- // FIXME: Add transaction and setVersion.
+ PassRefPtr<IDBRequest> createObjectStore(ScriptExecutionContext*, const String& name, const String& keyPath = String(), bool autoIncrement = false);
+ PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode = IDBTransaction::READ_ONLY);
+ PassRefPtr<IDBRequest> removeObjectStore(ScriptExecutionContext*, const String& name);
+ PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, DOMStringList* storeNames = 0, unsigned short mode = IDBTransaction::READ_ONLY,
+ unsigned long timeout = 0); // FIXME: what should the default timeout be?
+private:
+ IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface>);
- virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>) = 0;
- virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode) = 0;
- virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>) = 0;
+ RefPtr<IDBDatabaseBackendInterface> m_backend;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBDatabaseRequest.idl b/WebCore/storage/IDBDatabase.idl
index 548b221..4e3f620 100644
--- a/WebCore/storage/IDBDatabaseRequest.idl
+++ b/WebCore/storage/IDBDatabase.idl
@@ -27,19 +27,19 @@ module storage {
interface [
Conditional=INDEXED_DATABASE
- ] IDBDatabaseRequest {
+ ] IDBDatabase {
readonly attribute DOMString name;
readonly attribute DOMString description;
readonly attribute DOMString version;
readonly attribute DOMStringList objectStores;
- // FIXME: Add transaction.
// FIXME: Add setVersion.
[CallWith=ScriptExecutionContext] IDBRequest createObjectStore(in DOMString name, in [Optional, ConvertNullToNullString] DOMString keyPath, in [Optional] boolean autoIncrement);
// FIXME: objectStore needs to be able to raise an IDBDatabaseException.
- IDBObjectStoreRequest objectStore(in DOMString name, in [Optional] unsigned short mode);
+ IDBObjectStore objectStore(in DOMString name, in [Optional] unsigned short mode);
[CallWith=ScriptExecutionContext] IDBRequest removeObjectStore(in DOMString name);
+ [CallWith=ScriptExecutionContext] IDBTransaction transaction (in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode, in [Optional] unsigned long timeout);
};
}
diff --git a/WebCore/storage/IDBDatabaseImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 162efab..09b9dee 100644
--- a/WebCore/storage/IDBDatabaseImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -24,28 +24,28 @@
*/
#include "config.h"
-#include "IDBDatabaseImpl.h"
+#include "IDBDatabaseBackendImpl.h"
#include "DOMStringList.h"
#include "IDBDatabaseException.h"
-#include "IDBObjectStoreImpl.h"
+#include "IDBObjectStoreBackendImpl.h"
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
-IDBDatabaseImpl::IDBDatabaseImpl(const String& name, const String& description, const String& version)
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, const String& version)
: m_name(name)
, m_description(description)
, m_version(version)
{
}
-IDBDatabaseImpl::~IDBDatabaseImpl()
+IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl()
{
}
-PassRefPtr<DOMStringList> IDBDatabaseImpl::objectStores() const
+PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStores() const
{
RefPtr<DOMStringList> objectStoreNames = DOMStringList::create();
for (ObjectStoreMap::const_iterator it = m_objectStores.begin(); it != m_objectStores.end(); ++it)
@@ -53,26 +53,26 @@ PassRefPtr<DOMStringList> IDBDatabaseImpl::objectStores() const
return objectStoreNames.release();
}
-void IDBDatabaseImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks)
{
if (m_objectStores.contains(name)) {
callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "An objectStore with that name already exists."));
return;
}
- RefPtr<IDBObjectStore> objectStore = IDBObjectStoreImpl::create(name, keyPath, autoIncrement);
+ RefPtr<IDBObjectStoreBackendInterface> objectStore = IDBObjectStoreBackendImpl::create(name, keyPath, autoIncrement);
m_objectStores.set(name, objectStore);
callbacks->onSuccess(objectStore.release());
}
-PassRefPtr<IDBObjectStore> IDBDatabaseImpl::objectStore(const String& name, unsigned short mode)
+PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::objectStore(const String& name, unsigned short mode)
{
// FIXME: If no transaction is running, this should implicitly start one.
ASSERT_UNUSED(mode, !mode); // FIXME: Handle non-standard modes.
return m_objectStores.get(name);
}
-void IDBDatabaseImpl::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks)
{
if (!m_objectStores.contains(name)) {
callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "No objectStore with that name exists."));
@@ -83,6 +83,13 @@ void IDBDatabaseImpl::removeObjectStore(const String& name, PassRefPtr<IDBCallba
callbacks->onSuccess();
}
+PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList*, unsigned short, unsigned long)
+{
+ // FIXME: Ask the transaction manager for a new IDBTransactionBackendImpl.
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBDatabaseImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h
index 7203c5a..f6ff058 100644
--- a/WebCore/storage/IDBDatabaseImpl.h
+++ b/WebCore/storage/IDBDatabaseBackendImpl.h
@@ -23,8 +23,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IDBDatabaseImpl_h
-#define IDBDatabaseImpl_h
+#ifndef IDBDatabaseBackendImpl_h
+#define IDBDatabaseBackendImpl_h
#include "IDBCallbacks.h"
#include "IDBDatabase.h"
@@ -35,13 +35,13 @@
namespace WebCore {
-class IDBDatabaseImpl : public IDBDatabase {
+class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface {
public:
- static PassRefPtr<IDBDatabase> create(const String& name, const String& description, const String& version)
+ static PassRefPtr<IDBDatabaseBackendInterface> create(const String& name, const String& description, const String& version)
{
- return adoptRef(new IDBDatabaseImpl(name, description, version));
+ return adoptRef(new IDBDatabaseBackendImpl(name, description, version));
}
- virtual ~IDBDatabaseImpl();
+ virtual ~IDBDatabaseBackendImpl();
// Implements IDBDatabase
virtual String name() const { return m_name; }
@@ -50,17 +50,17 @@ public:
virtual PassRefPtr<DOMStringList> objectStores() const;
virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>);
- virtual PassRefPtr<IDBObjectStore> objectStore(const String& name, unsigned short mode);
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode);
virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>);
-
+ virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout);
private:
- IDBDatabaseImpl(const String& name, const String& description, const String& version);
+ IDBDatabaseBackendImpl(const String& name, const String& description, const String& version);
String m_name;
String m_description;
String m_version;
- typedef HashMap<String, RefPtr<IDBObjectStore> > ObjectStoreMap;
+ typedef HashMap<String, RefPtr<IDBObjectStoreBackendInterface> > ObjectStoreMap;
ObjectStoreMap m_objectStores;
};
@@ -68,4 +68,4 @@ private:
#endif
-#endif // IDBDatabaseImpl_h
+#endif // IDBDatabaseBackendImpl_h
diff --git a/WebCore/storage/IDBDatabaseBackendInterface.h b/WebCore/storage/IDBDatabaseBackendInterface.h
new file mode 100644
index 0000000..ac12bf1
--- /dev/null
+++ b/WebCore/storage/IDBDatabaseBackendInterface.h
@@ -0,0 +1,68 @@
+/*
+ * 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 IDBDatabaseBackendInterface_h
+#define IDBDatabaseBackendInterface_h
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+class DOMStringList;
+class Frame;
+class IDBCallbacks;
+class IDBObjectStoreBackendInterface;
+class IDBTransactionBackendInterface;
+
+// This class is shared by IDBDatabase (async) and IDBDatabaseSync (sync).
+// 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 ThreadSafeShared<IDBDatabaseBackendInterface> {
+public:
+ virtual ~IDBDatabaseBackendInterface() { }
+
+ virtual String name() const = 0;
+ virtual String description() const = 0;
+ virtual String version() const = 0;
+ virtual PassRefPtr<DOMStringList> objectStores() const = 0;
+
+ // FIXME: Add transaction and setVersion.
+
+ virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>) = 0;
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode) = 0;
+ virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>) = 0;
+ virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout) = 0;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBDatabaseBackendInterface_h
diff --git a/WebCore/storage/IDBFactoryBackendImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp
index e965c3f..7bdd70d 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.cpp
+++ b/WebCore/storage/IDBFactoryBackendImpl.cpp
@@ -30,7 +30,7 @@
#include "IDBFactoryBackendImpl.h"
#include "DOMStringList.h"
-#include "IDBDatabaseImpl.h"
+#include "IDBDatabaseBackendImpl.h"
#include "SecurityOrigin.h"
#include <wtf/Threading.h>
#include <wtf/UnusedParam.h>
@@ -54,16 +54,16 @@ IDBFactoryBackendImpl::~IDBFactoryBackendImpl()
void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*)
{
- RefPtr<IDBDatabase> database;
- IDBDatabaseMap::iterator it = m_databaseMap.find(name);
- if (it == m_databaseMap.end()) {
+ RefPtr<IDBDatabaseBackendInterface> databaseBackend;
+ IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(name);
+ if (it == m_databaseBackendMap.end()) {
// FIXME: What should the version be? The spec doesn't define it yet.
- database = IDBDatabaseImpl::create(name, description, "");
- m_databaseMap.set(name, database);
+ databaseBackend = IDBDatabaseBackendImpl::create(name, description, "");
+ m_databaseBackendMap.set(name, databaseBackend);
} else
- database = it->second;
+ databaseBackend = it->second;
- callbacks->onSuccess(database.release());
+ callbacks->onSuccess(databaseBackend.release());
}
} // namespace WebCore
diff --git a/WebCore/storage/IDBFactoryBackendImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h
index bb28b6d..bbcc537 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.h
+++ b/WebCore/storage/IDBFactoryBackendImpl.h
@@ -48,8 +48,8 @@ public:
private:
IDBFactoryBackendImpl();
- typedef HashMap<String, RefPtr<IDBDatabase> > IDBDatabaseMap;
- IDBDatabaseMap m_databaseMap;
+ typedef HashMap<String, RefPtr<IDBDatabaseBackendInterface> > IDBDatabaseBackendMap;
+ IDBDatabaseBackendMap m_databaseBackendMap;
// We only create one instance of this class at a time.
static IDBFactoryBackendImpl* idbFactoryBackendImpl;
diff --git a/WebCore/storage/IDBObjectStoreRequest.cpp b/WebCore/storage/IDBObjectStore.cpp
index 0778214..b457cd1 100644
--- a/WebCore/storage/IDBObjectStoreRequest.cpp
+++ b/WebCore/storage/IDBObjectStore.cpp
@@ -24,12 +24,13 @@
*/
#include "config.h"
-#include "IDBObjectStoreRequest.h"
+#include "IDBObjectStore.h"
#include "DOMStringList.h"
#include "IDBAny.h"
#include "IDBIndex.h"
#include "IDBKey.h"
+#include "IDBKeyRange.h"
#include "SerializedScriptValue.h"
#include <wtf/UnusedParam.h>
@@ -37,77 +38,84 @@
namespace WebCore {
-IDBObjectStoreRequest::IDBObjectStoreRequest(PassRefPtr<IDBObjectStore> idbObjectStore)
+IDBObjectStore::IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore)
: m_objectStore(idbObjectStore)
{
// We pass a reference to this object before it can be adopted.
relaxAdoptionRequirement();
}
-String IDBObjectStoreRequest::name() const
+String IDBObjectStore::name() const
{
return m_objectStore->name();
}
-String IDBObjectStoreRequest::keyPath() const
+String IDBObjectStore::keyPath() const
{
return m_objectStore->keyPath();
}
-PassRefPtr<DOMStringList> IDBObjectStoreRequest::indexNames() const
+PassRefPtr<DOMStringList> IDBObjectStore::indexNames() const
{
return m_objectStore->indexNames();
}
-PassRefPtr<IDBRequest> IDBObjectStoreRequest::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
m_objectStore->get(key, request);
return request;
}
-PassRefPtr<IDBRequest> IDBObjectStoreRequest::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
m_objectStore->put(value, key, true, request);
return request;
}
-PassRefPtr<IDBRequest> IDBObjectStoreRequest::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
m_objectStore->put(value, key, false, request);
return request;
}
-PassRefPtr<IDBRequest> IDBObjectStoreRequest::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
m_objectStore->remove(key, request);
return request;
}
-PassRefPtr<IDBRequest> IDBObjectStoreRequest::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, bool unique)
+PassRefPtr<IDBRequest> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, bool unique)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
m_objectStore->createIndex(name, keyPath, unique, request);
return request;
}
-PassRefPtr<IDBIndex> IDBObjectStoreRequest::index(const String& name)
+PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name)
{
RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name);
ASSERT(index); // FIXME: If this is null, we should raise a NOT_FOUND_ERR.
return IDBIndex::create(index.release());
}
-PassRefPtr<IDBRequest> IDBObjectStoreRequest::removeIndex(ScriptExecutionContext* context, const String& name)
+PassRefPtr<IDBRequest> IDBObjectStore::removeIndex(ScriptExecutionContext* context, const String& name)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
m_objectStore->removeIndex(name, request);
return request;
}
+PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction)
+{
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+ m_objectStore->openCursor(range, direction, request);
+ return request.release();
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h
index 4a53eb4..035f5d8 100644
--- a/WebCore/storage/IDBObjectStore.h
+++ b/WebCore/storage/IDBObjectStore.h
@@ -26,34 +26,52 @@
#ifndef IDBObjectStore_h
#define IDBObjectStore_h
+#include "IDBCursor.h"
+#include "IDBKeyRange.h"
+#include "IDBObjectStoreBackendInterface.h"
+#include "IDBRequest.h"
#include "PlatformString.h"
-#include <wtf/Threading.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
class DOMStringList;
-class IDBCallbacks;
-class IDBIndexBackendInterface;
+class IDBAny;
+class IDBIndexRequest;
class IDBKey;
class SerializedScriptValue;
-class IDBObjectStore : public ThreadSafeShared<IDBObjectStore> {
+class IDBObjectStore : public RefCounted<IDBObjectStore> {
public:
- virtual ~IDBObjectStore() { }
+ static PassRefPtr<IDBObjectStore> create(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore)
+ {
+ return adoptRef(new IDBObjectStore(idbObjectStore));
+ }
+ ~IDBObjectStore() { }
- virtual String name() const = 0;
- virtual String keyPath() const = 0;
- virtual PassRefPtr<DOMStringList> indexNames() const = 0;
+ String name() const;
+ String keyPath() const;
+ PassRefPtr<DOMStringList> indexNames() const;
- virtual void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0;
- virtual void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>) = 0;
- virtual void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0;
+ PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
+ PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
+ PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
+ PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
- virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>) = 0;
- virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name) = 0;
- virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>) = 0;
+ PassRefPtr<IDBRequest> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, bool unique = false);
+ PassRefPtr<IDBIndex> index(const String& name);
+ PassRefPtr<IDBRequest> removeIndex(ScriptExecutionContext*, const String& name);
+
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange> = 0, unsigned short direction = IDBCursor::NEXT);
+
+private:
+ IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface>);
+
+ RefPtr<IDBObjectStoreBackendInterface> m_objectStore;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBObjectStoreRequest.idl b/WebCore/storage/IDBObjectStore.idl
index 6db6ad8..1649a1d 100644
--- a/WebCore/storage/IDBObjectStoreRequest.idl
+++ b/WebCore/storage/IDBObjectStore.idl
@@ -27,7 +27,7 @@ module storage {
interface [
Conditional=INDEXED_DATABASE
- ] IDBObjectStoreRequest {
+ ] IDBObjectStore {
[CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key);
// FIXME: Come to concensus re getAll.
// FIXME: SerializedScriptValue raises an exception if you pass in something that can't be serialized.
@@ -41,6 +41,8 @@ module storage {
IDBIndex index(in DOMString name);
[CallWith=ScriptExecutionContext] IDBRequest removeIndex(in DOMString name);
+ [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction);
+
readonly attribute DOMString name;
readonly attribute [ConvertNullStringTo=Null] DOMString keyPath;
readonly attribute DOMStringList indexNames;
diff --git a/WebCore/storage/IDBObjectStoreImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index 8c6444a..9732bc1 100755
--- a/WebCore/storage/IDBObjectStoreImpl.cpp
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -24,24 +24,26 @@
*/
#include "config.h"
-#include "IDBObjectStoreImpl.h"
+#include "IDBObjectStoreBackendImpl.h"
#include "DOMStringList.h"
#include "IDBBindingUtilities.h"
#include "IDBCallbacks.h"
+#include "IDBCursorBackendImpl.h"
#include "IDBDatabaseException.h"
#include "IDBIndexBackendImpl.h"
+#include "IDBKeyRange.h"
#include "IDBKeyTree.h"
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
-IDBObjectStoreImpl::~IDBObjectStoreImpl()
+IDBObjectStoreBackendImpl::~IDBObjectStoreBackendImpl()
{
}
-IDBObjectStoreImpl::IDBObjectStoreImpl(const String& name, const String& keyPath, bool autoIncrement)
+IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(const String& name, const String& keyPath, bool autoIncrement)
: m_name(name)
, m_keyPath(keyPath)
, m_autoIncrement(autoIncrement)
@@ -49,7 +51,7 @@ IDBObjectStoreImpl::IDBObjectStoreImpl(const String& name, const String& keyPath
{
}
-PassRefPtr<DOMStringList> IDBObjectStoreImpl::indexNames() const
+PassRefPtr<DOMStringList> IDBObjectStoreBackendImpl::indexNames() const
{
RefPtr<DOMStringList> indexNames = DOMStringList::create();
for (IndexMap::const_iterator it = m_indexes.begin(); it != m_indexes.end(); ++it)
@@ -57,7 +59,7 @@ PassRefPtr<DOMStringList> IDBObjectStoreImpl::indexNames() const
return indexNames.release();
}
-void IDBObjectStoreImpl::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
{
RefPtr<SerializedScriptValue> value = m_tree->get(key.get());
if (!value) {
@@ -67,7 +69,7 @@ void IDBObjectStoreImpl::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> ca
callbacks->onSuccess(value.get());
}
-void IDBObjectStoreImpl::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks)
{
RefPtr<IDBKey> key = prpKey;
@@ -95,13 +97,13 @@ void IDBObjectStoreImpl::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr
callbacks->onSuccess(key.get());
}
-void IDBObjectStoreImpl::remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
{
m_tree->remove(key.get());
callbacks->onSuccess();
}
-void IDBObjectStoreImpl::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks)
{
if (m_indexes.contains(name)) {
callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Index name already exists."));
@@ -114,12 +116,12 @@ void IDBObjectStoreImpl::createIndex(const String& name, const String& keyPath,
callbacks->onSuccess(index.release());
}
-PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreImpl::index(const String& name)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const String& name)
{
return m_indexes.get(name);
}
-void IDBObjectStoreImpl::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks)
{
if (!m_indexes.contains(name)) {
callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Index name does not exist."));
@@ -130,6 +132,16 @@ void IDBObjectStoreImpl::removeIndex(const String& name, PassRefPtr<IDBCallbacks
callbacks->onSuccess();
}
+void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks)
+{
+ RefPtr<IDBKey> key = range->left();
+ RefPtr<SerializedScriptValue> value = m_tree->get(key.get());
+ if (value) {
+ RefPtr<IDBCursorBackendInterface> cursor = IDBCursorBackendImpl::create(this, range, static_cast<IDBCursor::Direction>(direction), key, value);
+ callbacks->onSuccess(cursor.release());
+ } else
+ callbacks->onSuccess();
+}
} // namespace WebCore
diff --git a/WebCore/storage/IDBObjectStoreImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h
index f2c2e03..fc63658 100644
--- a/WebCore/storage/IDBObjectStoreImpl.h
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.h
@@ -23,10 +23,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IDBObjectStoreImpl_h
-#define IDBObjectStoreImpl_h
+#ifndef IDBObjectStoreBackendImpl_h
+#define IDBObjectStoreBackendImpl_h
-#include "IDBObjectStore.h"
+#include "IDBObjectStoreBackendInterface.h"
#include "StringHash.h"
#include <wtf/HashMap.h>
@@ -36,13 +36,13 @@ namespace WebCore {
template <typename ValueType> class IDBKeyTree;
-class IDBObjectStoreImpl : public IDBObjectStore {
+class IDBObjectStoreBackendImpl : public IDBObjectStoreBackendInterface {
public:
- static PassRefPtr<IDBObjectStore> create(const String& name, const String& keyPath, bool autoIncrement)
+ static PassRefPtr<IDBObjectStoreBackendInterface> create(const String& name, const String& keyPath, bool autoIncrement)
{
- return adoptRef(new IDBObjectStoreImpl(name, keyPath, autoIncrement));
+ return adoptRef(new IDBObjectStoreBackendImpl(name, keyPath, autoIncrement));
}
- ~IDBObjectStoreImpl();
+ ~IDBObjectStoreBackendImpl();
String name() const { return m_name; }
String keyPath() const { return m_keyPath; }
@@ -56,8 +56,10 @@ public:
PassRefPtr<IDBIndexBackendInterface> index(const String& name);
void removeIndex(const String& name, PassRefPtr<IDBCallbacks>);
+ void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>);
+
private:
- IDBObjectStoreImpl(const String& name, const String& keyPath, bool autoIncrement);
+ IDBObjectStoreBackendImpl(const String& name, const String& keyPath, bool autoIncrement);
String m_name;
String m_keyPath;
@@ -74,4 +76,4 @@ private:
#endif
-#endif // IDBObjectStoreImpl_h
+#endif // IDBObjectStoreBackendImpl_h
diff --git a/WebCore/storage/IDBObjectStoreBackendInterface.h b/WebCore/storage/IDBObjectStoreBackendInterface.h
new file mode 100644
index 0000000..200ac29
--- /dev/null
+++ b/WebCore/storage/IDBObjectStoreBackendInterface.h
@@ -0,0 +1,67 @@
+/*
+ * 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 IDBObjectStoreBackendInterface_h
+#define IDBObjectStoreBackendInterface_h
+
+#include "PlatformString.h"
+#include <wtf/Threading.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+class DOMStringList;
+class IDBCallbacks;
+class IDBIndexBackendInterface;
+class IDBKey;
+class IDBKeyRange;
+class SerializedScriptValue;
+
+class IDBObjectStoreBackendInterface : public ThreadSafeShared<IDBObjectStoreBackendInterface> {
+public:
+ virtual ~IDBObjectStoreBackendInterface() { }
+
+ virtual String name() const = 0;
+ virtual String keyPath() const = 0;
+ virtual PassRefPtr<DOMStringList> indexNames() const = 0;
+
+ virtual void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0;
+ virtual void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>) = 0;
+ virtual void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0;
+
+ virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>) = 0;
+ virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name) = 0;
+ virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>) = 0;
+
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>) = 0;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBObjectStoreBackendInterface_h
+
diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp
index b836cc3..94ef7e5 100644
--- a/WebCore/storage/IDBRequest.cpp
+++ b/WebCore/storage/IDBRequest.cpp
@@ -35,10 +35,11 @@
#include "EventException.h"
#include "EventListener.h"
#include "EventNames.h"
-#include "IDBDatabaseRequest.h"
+#include "IDBCursor.h"
+#include "IDBDatabase.h"
#include "IDBIndex.h"
#include "IDBErrorEvent.h"
-#include "IDBObjectStoreRequest.h"
+#include "IDBObjectStore.h"
#include "IDBSuccessEvent.h"
#include "ScriptExecutionContext.h"
@@ -49,7 +50,6 @@ IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc
, m_source(source)
, m_result(IDBAny::create())
, m_timer(this, &IDBRequest::timerFired)
- , m_stopped(false)
, m_aborted(false)
, m_readyState(INITIAL)
{
@@ -73,10 +73,16 @@ void IDBRequest::onSuccess()
m_result->set();
}
-void IDBRequest::onSuccess(PassRefPtr<IDBDatabase> idbDatabase)
+void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend)
{
onEventCommon();
- m_result->set(IDBDatabaseRequest::create(idbDatabase));
+ m_result->set(IDBCursor::create(backend));
+}
+
+void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend)
+{
+ onEventCommon();
+ m_result->set(IDBDatabase::create(backend));
}
void IDBRequest::onSuccess(PassRefPtr<IDBIndexBackendInterface> backend)
@@ -91,10 +97,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey)
m_result->set(idbKey);
}
-void IDBRequest::onSuccess(PassRefPtr<IDBObjectStore> idbObjectStore)
+void IDBRequest::onSuccess(PassRefPtr<IDBObjectStoreBackendInterface> backend)
{
onEventCommon();
- m_result->set(IDBObjectStoreRequest::create(idbObjectStore));
+ m_result->set(IDBObjectStore::create(backend));
}
void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue)
@@ -115,24 +121,11 @@ ScriptExecutionContext* IDBRequest::scriptExecutionContext() const
return ActiveDOMObject::scriptExecutionContext();
}
-void IDBRequest::stop()
-{
- abort();
- m_selfRef = 0; // Could trigger a delete.
-}
-
-void IDBRequest::suspend()
-{
- m_timer.stop();
- m_stopped = true;
-}
-
-void IDBRequest::resume()
+bool IDBRequest::canSuspend() const
{
- m_stopped = false;
- // We only hold our self ref when we're waiting to dispatch an event.
- if (m_selfRef && !m_aborted)
- m_timer.startOneShot(0);
+ // IDBTransactions cannot be suspended at the moment. We therefore
+ // disallow the back/forward cache for pages that use IndexedDatabase.
+ return false;
}
EventTargetData* IDBRequest::eventTargetData()
@@ -149,7 +142,6 @@ void IDBRequest::timerFired(Timer<IDBRequest>*)
{
ASSERT(m_readyState == DONE);
ASSERT(m_selfRef);
- ASSERT(!m_stopped);
ASSERT(!m_aborted);
// We need to keep self-referencing ourself, otherwise it's possible we'll be deleted.
@@ -162,7 +154,7 @@ void IDBRequest::timerFired(Timer<IDBRequest>*)
dispatchEvent(IDBErrorEvent::create(m_source, *m_error));
} else {
ASSERT(m_result->type() != IDBAny::UndefinedType);
- dispatchEvent(IDBSuccessEvent::create(m_source, m_result));
+ dispatchEvent(IDBSuccessEvent::create(m_source, m_result));
}
}
@@ -179,8 +171,7 @@ void IDBRequest::onEventCommon()
m_readyState = DONE;
m_selfRef = this;
- if (!m_stopped)
- m_timer.startOneShot(0);
+ m_timer.startOneShot(0);
}
} // namespace WebCore
diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h
index 39f6a51..ddfdcf3 100644
--- a/WebCore/storage/IDBRequest.h
+++ b/WebCore/storage/IDBRequest.h
@@ -41,8 +41,6 @@
namespace WebCore {
-class IDBDatabaseRequest;
-
class IDBRequest : public IDBCallbacks, public EventTarget, public ActiveDOMObject {
public:
static PassRefPtr<IDBRequest> create(ScriptExecutionContext* context, PassRefPtr<IDBAny> source) { return adoptRef(new IDBRequest(context, source)); }
@@ -64,10 +62,11 @@ public:
// IDBCallbacks
virtual void onError(PassRefPtr<IDBDatabaseError>);
virtual void onSuccess(); // For "null".
- virtual void onSuccess(PassRefPtr<IDBDatabase>);
+ virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>);
+ virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBKey>);
- virtual void onSuccess(PassRefPtr<IDBObjectStore>);
+ virtual void onSuccess(PassRefPtr<IDBObjectStoreBackendInterface>);
virtual void onSuccess(PassRefPtr<SerializedScriptValue>);
// EventTarget
@@ -75,9 +74,7 @@ public:
// ActiveDOMObject
virtual ScriptExecutionContext* scriptExecutionContext() const;
- virtual void stop();
- virtual void suspend();
- virtual void resume();
+ virtual bool canSuspend() const;
using RefCounted<IDBCallbacks>::ref;
using RefCounted<IDBCallbacks>::deref;
@@ -103,7 +100,6 @@ private:
Timer<IDBRequest> m_timer;
RefPtr<IDBRequest> m_selfRef; // This is set to us iff there's an event pending.
- bool m_stopped;
bool m_aborted;
ReadyState m_readyState;
EventTargetData m_eventTargetData;
diff --git a/WebCore/storage/IDBTransaction.cpp b/WebCore/storage/IDBTransaction.cpp
new file mode 100644
index 0000000..1bc059a
--- /dev/null
+++ b/WebCore/storage/IDBTransaction.cpp
@@ -0,0 +1,72 @@
+#include "config.h"
+#include "IDBTransaction.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "Event.h"
+#include "EventException.h"
+#include "IDBDatabase.h"
+#include "IDBObjectStore.h"
+#include "IDBObjectStoreBackendInterface.h"
+#include "ScriptExecutionContext.h"
+
+namespace WebCore {
+
+IDBTransaction::IDBTransaction(ScriptExecutionContext* context, PassRefPtr<IDBTransactionBackendInterface> backend, IDBDatabase* db)
+ : ActiveDOMObject(context, this)
+ , m_backend(backend)
+ , m_database(db)
+{
+}
+
+IDBTransaction::~IDBTransaction()
+{
+}
+
+unsigned short IDBTransaction::mode() const
+{
+ return m_backend->mode();
+}
+
+IDBDatabase* IDBTransaction::db()
+{
+ return m_database.get();
+}
+
+PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, const ExceptionCode&)
+{
+ RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->objectStore(name);
+ RefPtr<IDBObjectStore> objectStore = IDBObjectStore::create(objectStoreBackend);
+ return objectStore.release();
+}
+
+void IDBTransaction::abort()
+{
+ m_backend->abort();
+}
+
+ScriptExecutionContext* IDBTransaction::scriptExecutionContext() const
+{
+ return ActiveDOMObject::scriptExecutionContext();
+}
+
+bool IDBTransaction::canSuspend() const
+{
+ // We may be in the middle of a transaction so we cannot suspend our object.
+ // Instead, we simply don't allow the owner page to go into the back/forward cache.
+ return false;
+}
+
+EventTargetData* IDBTransaction::eventTargetData()
+{
+ return &m_eventTargetData;
+}
+
+EventTargetData* IDBTransaction::ensureEventTargetData()
+{
+ return &m_eventTargetData;
+}
+
+}
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBTransaction.h b/WebCore/storage/IDBTransaction.h
new file mode 100644
index 0000000..2e3167c
--- /dev/null
+++ b/WebCore/storage/IDBTransaction.h
@@ -0,0 +1,91 @@
+/*
+ * 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 IDBTransaction_h
+#define IDBTransaction_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "ActiveDOMObject.h"
+#include "DOMStringList.h"
+#include "EventListener.h"
+#include "EventNames.h"
+#include "EventTarget.h"
+#include "IDBTransactionBackendInterface.h"
+
+namespace WebCore {
+
+class IDBDatabase;
+class IDBObjectStore;
+
+class IDBTransaction : public EventTarget, public ActiveDOMObject {
+public:
+ static PassRefPtr<IDBTransaction> create(ScriptExecutionContext* context, PassRefPtr<IDBTransactionBackendInterface> backend, IDBDatabase* db)
+ {
+ return adoptRef(new IDBTransaction(context, backend, db));
+ }
+ virtual ~IDBTransaction();
+
+ enum Mode {
+ READ_WRITE = 0,
+ READ_ONLY = 1,
+ SNAPSHOT_READ = 2
+ };
+
+ unsigned short mode() const;
+ IDBDatabase* db();
+ PassRefPtr<IDBObjectStore> objectStore(const String& name, const ExceptionCode&);
+ void abort();
+
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(complete);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout);
+
+ // EventTarget
+ virtual IDBTransaction* toIDBTransaction() { return this; }
+
+ // ActiveDOMObject
+ virtual ScriptExecutionContext* scriptExecutionContext() const;
+ virtual bool canSuspend() const;
+
+private:
+ IDBTransaction(ScriptExecutionContext*, PassRefPtr<IDBTransactionBackendInterface>, IDBDatabase*);
+
+ // EventTarget
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+ virtual EventTargetData* eventTargetData();
+ virtual EventTargetData* ensureEventTargetData();
+
+ EventTargetData m_eventTargetData;
+ RefPtr<IDBTransactionBackendInterface> m_backend;
+ RefPtr<IDBDatabase> m_database;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBTransaction_h
diff --git a/WebCore/storage/IDBTransaction.idl b/WebCore/storage/IDBTransaction.idl
new file mode 100644
index 0000000..a3907dc
--- /dev/null
+++ b/WebCore/storage/IDBTransaction.idl
@@ -0,0 +1,57 @@
+ /*
+ * 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.
+ */
+
+module storage {
+
+ interface [
+ Conditional=INDEXED_DATABASE,
+ EventTarget
+ ] IDBTransaction {
+ // Modes
+ const unsigned short READ_WRITE = 0;
+ const unsigned short READ_ONLY = 1;
+ const unsigned short SNAPSHOT_READ = 2;
+ // Properties
+ readonly attribute unsigned short mode;
+ readonly attribute IDBDatabase db;
+ // Methods
+ IDBObjectStore objectStore (in DOMString name)
+ raises (IDBDatabaseException);
+ void abort ();
+ // Events
+ attribute EventListener onabort;
+ attribute EventListener oncomplete;
+ attribute EventListener ontimeout;
+ // EventTarget interface
+ void addEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ void removeEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ boolean dispatchEvent(in Event evt)
+ raises(EventException);
+ };
+}
diff --git a/WebCore/storage/IDBTransactionBackendInterface.h b/WebCore/storage/IDBTransactionBackendInterface.h
new file mode 100644
index 0000000..dff2bd7
--- /dev/null
+++ b/WebCore/storage/IDBTransactionBackendInterface.h
@@ -0,0 +1,62 @@
+/*
+ * 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 IDBTransactionBackendInterface_h
+#define IDBTransactionBackendInterface_h
+
+#include "ExceptionCode.h"
+#include "IDBCallbacks.h"
+#include "PlatformString.h"
+#include "ScriptExecutionContext.h"
+#include <wtf/Threading.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+class IDBObjectStoreBackendInterface;
+class SQLiteDatabase;
+
+// This class is shared by IDBTransaction (async) and IDBTransactionSync (sync).
+// 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 ThreadSafeShared<IDBTransactionBackendInterface> {
+public:
+ virtual ~IDBTransactionBackendInterface() { }
+
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name) = 0;
+ virtual unsigned short mode() const = 0;
+ virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) = 0;
+ virtual void abort() = 0;
+ virtual SQLiteDatabase* sqliteDatabase() = 0;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBTransactionBackendInterface_h
+
diff --git a/WebCore/storage/MetadataCallback.h b/WebCore/storage/MetadataCallback.h
index 96e4c91..3d57400 100644
--- a/WebCore/storage/MetadataCallback.h
+++ b/WebCore/storage/MetadataCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
class MetadataCallback : public RefCounted<MetadataCallback> {
public:
virtual ~MetadataCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, Metadata*) = 0;
+ virtual bool handleEvent(Metadata*) = 0;
};
} // namespace
diff --git a/WebCore/storage/OriginUsageRecord.cpp b/WebCore/storage/OriginUsageRecord.cpp
index 8128a1b..eac08fd 100644
--- a/WebCore/storage/OriginUsageRecord.cpp
+++ b/WebCore/storage/OriginUsageRecord.cpp
@@ -42,8 +42,8 @@ OriginUsageRecord::OriginUsageRecord()
void OriginUsageRecord::addDatabase(const String& identifier, const String& fullPath)
{
ASSERT(!m_databaseMap.contains(identifier));
- ASSERT_ARG(identifier, identifier.impl()->hasOneRef());
- ASSERT_ARG(fullPath, fullPath.impl()->hasOneRef());
+ ASSERT_ARG(identifier, identifier.impl()->hasOneRef() || identifier.isEmpty());
+ ASSERT_ARG(fullPath, fullPath.impl()->hasOneRef() || fullPath.isEmpty());
m_databaseMap.set(identifier, DatabaseEntry(fullPath));
m_unknownSet.add(identifier);
@@ -63,7 +63,7 @@ void OriginUsageRecord::removeDatabase(const String& identifier)
void OriginUsageRecord::markDatabase(const String& identifier)
{
ASSERT(m_databaseMap.contains(identifier));
- ASSERT_ARG(identifier, identifier.impl()->hasOneRef());
+ ASSERT_ARG(identifier, identifier.impl()->hasOneRef() || identifier.isEmpty());
m_unknownSet.add(identifier);
m_cachedDiskUsageIsValid = false;
diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp
index 9dd249a..3973157 100644
--- a/WebCore/storage/SQLStatement.cpp
+++ b/WebCore/storage/SQLStatement.cpp
@@ -170,9 +170,9 @@ bool SQLStatement::performCallback(SQLTransaction* transaction)
// because then we need to jump to the transaction error callback.
if (m_error) {
ASSERT(m_statementErrorCallback);
- callbackError = m_statementErrorCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_error.get());
+ callbackError = m_statementErrorCallback->handleEvent(transaction, m_error.get());
} else if (m_statementCallback)
- callbackError = !m_statementCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_resultSet.get());
+ callbackError = !m_statementCallback->handleEvent(transaction, m_resultSet.get());
// Now release our callbacks, to break reference cycles.
m_statementCallback = 0;
diff --git a/WebCore/storage/SQLStatementCallback.h b/WebCore/storage/SQLStatementCallback.h
index 4bb2e06..f86e29f 100644
--- a/WebCore/storage/SQLStatementCallback.h
+++ b/WebCore/storage/SQLStatementCallback.h
@@ -34,14 +34,13 @@
namespace WebCore {
-class ScriptExecutionContext;
class SQLTransaction;
class SQLResultSet;
class SQLStatementCallback : public ThreadSafeShared<SQLStatementCallback> {
public:
virtual ~SQLStatementCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*) = 0;
+ virtual bool handleEvent(SQLTransaction*, SQLResultSet*) = 0;
};
}
diff --git a/WebCore/storage/SQLStatementErrorCallback.h b/WebCore/storage/SQLStatementErrorCallback.h
index 7c45afd..acb8f64 100644
--- a/WebCore/storage/SQLStatementErrorCallback.h
+++ b/WebCore/storage/SQLStatementErrorCallback.h
@@ -35,14 +35,13 @@
namespace WebCore {
-class ScriptExecutionContext;
class SQLTransaction;
class SQLError;
class SQLStatementErrorCallback : public ThreadSafeShared<SQLStatementErrorCallback> {
public:
virtual ~SQLStatementErrorCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*) = 0;
+ virtual bool handleEvent(SQLTransaction*, SQLError*) = 0;
};
}
diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp
index 454ea63..c9f6609 100644
--- a/WebCore/storage/SQLTransaction.cpp
+++ b/WebCore/storage/SQLTransaction.cpp
@@ -295,7 +295,7 @@ void SQLTransaction::deliverTransactionCallback()
if (m_callback) {
m_executeSqlAllowed = true;
- shouldDeliverErrorCallback = !m_callback->handleEvent(m_database->scriptExecutionContext(), this);
+ shouldDeliverErrorCallback = !m_callback->handleEvent(this);
m_executeSqlAllowed = false;
m_callback = 0;
}
@@ -553,7 +553,7 @@ void SQLTransaction::deliverTransactionErrorCallback()
// Transaction Step 12 - If exists, invoke error callback with the last
// error to have occurred in this transaction.
if (m_errorCallback) {
- m_errorCallback->handleEvent(m_database->scriptExecutionContext(), m_transactionError.get());
+ m_errorCallback->handleEvent(m_transactionError.get());
m_errorCallback = 0;
}
diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h
index 2eb200b..3eb1fd5 100644
--- a/WebCore/storage/SQLTransaction.h
+++ b/WebCore/storage/SQLTransaction.h
@@ -48,7 +48,6 @@ class SQLTransaction;
class SQLTransactionCallback;
class SQLTransactionErrorCallback;
class SQLValue;
-class String;
class VoidCallback;
class SQLTransactionWrapper : public ThreadSafeShared<SQLTransactionWrapper> {
diff --git a/WebCore/storage/SQLTransactionCallback.h b/WebCore/storage/SQLTransactionCallback.h
index 73123ee..aff6233 100644
--- a/WebCore/storage/SQLTransactionCallback.h
+++ b/WebCore/storage/SQLTransactionCallback.h
@@ -35,13 +35,12 @@
namespace WebCore {
-class ScriptExecutionContext;
class SQLTransaction;
class SQLTransactionCallback : public ThreadSafeShared<SQLTransactionCallback> {
public:
virtual ~SQLTransactionCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*) = 0;
+ virtual bool handleEvent(SQLTransaction*) = 0;
};
}
diff --git a/WebCore/storage/SQLTransactionErrorCallback.h b/WebCore/storage/SQLTransactionErrorCallback.h
index 71580eb..4095d6a 100644
--- a/WebCore/storage/SQLTransactionErrorCallback.h
+++ b/WebCore/storage/SQLTransactionErrorCallback.h
@@ -35,13 +35,12 @@
namespace WebCore {
-class ScriptExecutionContext;
class SQLError;
class SQLTransactionErrorCallback : public ThreadSafeShared<SQLTransactionErrorCallback> {
public:
virtual ~SQLTransactionErrorCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, SQLError*) = 0;
+ virtual bool handleEvent(SQLError*) = 0;
};
}
diff --git a/WebCore/storage/SQLTransactionSync.cpp b/WebCore/storage/SQLTransactionSync.cpp
index 883721c..e56d7b4 100644
--- a/WebCore/storage/SQLTransactionSync.cpp
+++ b/WebCore/storage/SQLTransactionSync.cpp
@@ -150,7 +150,7 @@ ExceptionCode SQLTransactionSync::begin()
ExceptionCode SQLTransactionSync::execute()
{
ASSERT(m_database->scriptExecutionContext()->isContextThread());
- if (!m_database->opened() || (m_callback && !m_callback->handleEvent(m_database->scriptExecutionContext(), this))) {
+ if (!m_database->opened() || (m_callback && !m_callback->handleEvent(this))) {
m_callback = 0;
return SQLException::UNKNOWN_ERR;
}
diff --git a/WebCore/storage/SQLTransactionSync.h b/WebCore/storage/SQLTransactionSync.h
index 025215b..e66c876 100644
--- a/WebCore/storage/SQLTransactionSync.h
+++ b/WebCore/storage/SQLTransactionSync.h
@@ -46,7 +46,6 @@ class SQLTransactionClient;
class SQLTransactionSyncCallback;
class SQLValue;
class SQLiteTransaction;
-class String;
// Instances of this class should be created and used only on the worker's context thread.
class SQLTransactionSync : public RefCounted<SQLTransactionSync> {
diff --git a/WebCore/storage/SQLTransactionSyncCallback.h b/WebCore/storage/SQLTransactionSyncCallback.h
index 557db86..f22e62f 100644
--- a/WebCore/storage/SQLTransactionSyncCallback.h
+++ b/WebCore/storage/SQLTransactionSyncCallback.h
@@ -37,14 +37,13 @@
namespace WebCore {
-class ScriptExecutionContext;
class SQLTransactionSync;
// Instances of this class should be created and used only on the worker's context thread.
class SQLTransactionSyncCallback : public RefCounted<SQLTransactionSyncCallback> {
public:
virtual ~SQLTransactionSyncCallback() { }
- virtual bool handleEvent(ScriptExecutionContext*, SQLTransactionSync*) = 0;
+ virtual bool handleEvent(SQLTransactionSync*) = 0;
};
}
diff --git a/WebCore/storage/Storage.h b/WebCore/storage/Storage.h
index 06cc97b..c81481a 100644
--- a/WebCore/storage/Storage.h
+++ b/WebCore/storage/Storage.h
@@ -36,7 +36,6 @@ namespace WebCore {
class Frame;
class StorageArea;
- class String;
typedef int ExceptionCode;
class Storage : public RefCounted<Storage> {
diff --git a/WebCore/storage/chromium/DatabaseObserver.h b/WebCore/storage/chromium/DatabaseObserver.h
index 96b5972..deb8036 100644
--- a/WebCore/storage/chromium/DatabaseObserver.h
+++ b/WebCore/storage/chromium/DatabaseObserver.h
@@ -33,11 +33,12 @@
#if ENABLE(DATABASE)
+#include <wtf/Forward.h>
+
namespace WebCore {
class AbstractDatabase;
class ScriptExecutionContext;
-class String;
// The implementation of this class is in the WebKit API (Chromium source tree)
// in WebKit/chromium/src/DatabaseObserver.cpp.