[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
bulach at chromium.org
bulach at chromium.org
Wed Dec 22 11:46:20 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 51cb8ffcada8f0dc0ba3654004518ab8250adfd7
Author: bulach at chromium.org <bulach at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Aug 6 10:37:41 2010 +0000
2010-08-05 Marcus Bulach <bulach at chromium.org>
Reviewed by Jeremy Orlow.
Initial bindings and plumbing for IDBCursor.
https://bugs.webkit.org/show_bug.cgi?id=41888
Test: storage/indexeddb/idb-opencursor.html
* storage/indexeddb/open-cursor-expected.txt: Added.
* storage/indexeddb/open-cursor.html: Added.
* storage/indexeddb/script-tests/open-cursor.js: Added.
(cursorSuccess):
(openCursor):
(populateObjectStore):
(createObjectStoreSuccess):
(openSuccess):
(test):
2010-08-05 Marcus Bulach <bulach at chromium.org>
Reviewed by Jeremy Orlow.
Initial bindings and plumbing for IDBCursor.
https://bugs.webkit.org/show_bug.cgi?id=41888
Test: storage/indexeddb/idb-opencursor.html
* Android.derived.jscbindings.mk:
* Android.derived.v8bindings.mk:
* Android.mk:
* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/v8/custom/V8IDBAnyCustom.cpp:
(WebCore::toV8):
* storage/IDBAny.cpp:
(WebCore::IDBAny::idbCursor):
(WebCore::IDBAny::set):
* storage/IDBAny.h:
(WebCore::IDBAny::):
* storage/IDBCallbacks.h:
* storage/IDBCursor.cpp: Added.
(WebCore::IDBCursor::IDBCursor):
(WebCore::IDBCursor::~IDBCursor):
(WebCore::IDBCursor::direction):
(WebCore::IDBCursor::key):
(WebCore::IDBCursor::value):
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::continueFunction):
(WebCore::IDBCursor::remove):
* storage/IDBCursor.h: Added.
(WebCore::IDBCursor::):
(WebCore::IDBCursor::create):
* storage/IDBCursor.idl: Added.
* storage/IDBCursorBackendImpl.cpp: Added.
(WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl):
(WebCore::IDBCursorBackendImpl::~IDBCursorBackendImpl):
(WebCore::IDBCursorBackendImpl::direction):
(WebCore::IDBCursorBackendImpl::key):
(WebCore::IDBCursorBackendImpl::value):
(WebCore::IDBCursorBackendImpl::update):
(WebCore::IDBCursorBackendImpl::continueFunction):
(WebCore::IDBCursorBackendImpl::remove):
* storage/IDBCursorBackendImpl.h: Added.
(WebCore::IDBCursorBackendImpl::create):
* storage/IDBCursorBackendInterface.h: Added.
(WebCore::IDBCursorBackendInterface::~IDBCursorBackendInterface):
* storage/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::openCursor):
* storage/IDBObjectStore.h:
* storage/IDBObjectStore.idl:
* storage/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::openCursor):
* storage/IDBObjectStoreBackendImpl.h:
* storage/IDBObjectStoreBackendInterface.h:
* storage/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::timerFired):
* storage/IDBRequest.h:
2010-08-05 Marcus Bulach <bulach at chromium.org>
Reviewed by Jeremy Orlow.
Initial bindings and plumbing for IDBCursor.
https://bugs.webkit.org/show_bug.cgi?id=41888
Test: storage/indexeddb/idb-opencursor.html
* WebKit.gyp:
* public/WebIDBCallbacks.h:
(WebKit::WebIDBCallbacks::onSuccess):
* public/WebIDBCursor.h: Added.
(WebKit::WebIDBCursor::~WebIDBCursor):
(WebKit::WebIDBCursor::direction):
(WebKit::WebIDBCursor::key):
(WebKit::WebIDBCursor::value):
(WebKit::WebIDBCursor::update):
(WebKit::WebIDBCursor::continueFunction):
(WebKit::WebIDBCursor::remove):
* public/WebIDBKeyRange.h: Added.
(WebKit::WebIDBKeyRange::~WebIDBKeyRange):
(WebKit::WebIDBKeyRange::WebIDBKeyRange):
* public/WebIDBObjectStore.h:
(WebKit::WebIDBObjectStore::openCursor):
* src/IDBCallbacksProxy.cpp:
(WebCore::IDBCallbacksProxy::onSuccess):
* src/IDBCallbacksProxy.h:
* src/IDBCursorBackendProxy.cpp: Added.
(WebCore::IDBCursorBackendProxy::create):
(WebCore::IDBCursorBackendProxy::IDBCursorBackendProxy):
(WebCore::IDBCursorBackendProxy::~IDBCursorBackendProxy):
(WebCore::IDBCursorBackendProxy::direction):
(WebCore::IDBCursorBackendProxy::key):
(WebCore::IDBCursorBackendProxy::value):
(WebCore::IDBCursorBackendProxy::update):
(WebCore::IDBCursorBackendProxy::continueFunction):
(WebCore::IDBCursorBackendProxy::remove):
* src/IDBCursorBackendProxy.h: Added.
* src/IDBObjectStoreProxy.cpp:
(WebCore::IDBObjectStoreProxy::openCursor):
* src/IDBObjectStoreProxy.h:
* src/WebIDBCallbacksImpl.cpp:
(WebCore::WebIDBCallbacksImpl::onSuccess):
* src/WebIDBCallbacksImpl.h:
* src/WebIDBCursorImpl.cpp: Added.
(WebKit::WebIDBCursorImpl::WebIDBCursorImpl):
(WebKit::WebIDBCursorImpl::~WebIDBCursorImpl):
(WebKit::WebIDBCursorImpl::direction):
(WebKit::WebIDBCursorImpl::key):
(WebKit::WebIDBCursorImpl::value):
(WebKit::WebIDBCursorImpl::update):
(WebKit::WebIDBCursorImpl::continueFunction):
(WebKit::WebIDBCursorImpl::remove):
* src/WebIDBCursorImpl.h: Added.
* src/WebIDBKeyRange.cpp: Added.
(WebKit::WebIDBKeyRange::WebIDBKeyRange):
(WebKit::WebIDBKeyRange::assign):
(WebKit::WebIDBKeyRange::reset):
(WebKit::WebIDBKeyRange::left):
(WebKit::WebIDBKeyRange::right):
(WebKit::WebIDBKeyRange::flags):
* src/WebIDBObjectStoreImpl.cpp:
(WebKit::WebIDBObjectStoreImpl::openCursor):
* src/WebIDBObjectStoreImpl.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ea2c4af..90adcba 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-05 Marcus Bulach <bulach at chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Initial bindings and plumbing for IDBCursor.
+ https://bugs.webkit.org/show_bug.cgi?id=41888
+
+ Test: storage/indexeddb/idb-opencursor.html
+
+ * storage/indexeddb/open-cursor-expected.txt: Added.
+ * storage/indexeddb/open-cursor.html: Added.
+ * storage/indexeddb/script-tests/open-cursor.js: Added.
+ (cursorSuccess):
+ (openCursor):
+ (populateObjectStore):
+ (createObjectStoreSuccess):
+ (openSuccess):
+ (test):
+
2010-08-06 Pavel Feldman <pfeldman at chromium.org>
Not reviewed: Chromium test expectations rebaseline.
diff --git a/LayoutTests/storage/indexeddb/open-cursor-expected.txt b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
new file mode 100644
index 0000000..ac58785
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
@@ -0,0 +1,102 @@
+Test IndexedDB's openCursor.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB.open('name', 'description')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.createObjectStore('test')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+objectStore = event.result
+objectStore.add('myValue', 'myKey')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Opening cursor
+objectStore.openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Cursor opened successfully.
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result.direction is 0
+PASS event.result.key is 'myKey'
+PASS event.result.value is 'myValue'
+
+Opening an empty cursor.
+objectStore.openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Empty cursor opened successfully.
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
diff --git a/LayoutTests/storage/indexeddb/open-cursor.html b/LayoutTests/storage/indexeddb/open-cursor.html
new file mode 100644
index 0000000..f60365d
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/open-cursor.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/open-cursor.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/script-tests/open-cursor.js b/LayoutTests/storage/indexeddb/script-tests/open-cursor.js
new file mode 100644
index 0000000..e3c615c
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/open-cursor.js
@@ -0,0 +1,79 @@
+description("Test IndexedDB's openCursor.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function emptyCursorSuccess()
+{
+ debug("Empty cursor opened successfully.")
+ verifySuccessEvent(event);
+ // FIXME: check that we can iterate the cursor.
+ shouldBe("event.result", "null");
+ done();
+}
+
+function openEmptyCursor()
+{
+ debug("Opening an empty cursor.");
+ keyRange = IDBKeyRange.leftBound("InexistentKey");
+ result = evalAndLog("objectStore.openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = emptyCursorSuccess;
+}
+
+function cursorSuccess()
+{
+ debug("Cursor opened successfully.")
+ verifySuccessEvent(event);
+ // FIXME: check that we can iterate the cursor.
+ shouldBe("event.result.direction", "0");
+ shouldBe("event.result.key", "'myKey'");
+ shouldBe("event.result.value", "'myValue'");
+ debug("");
+ openEmptyCursor();
+}
+
+function openCursor()
+{
+ debug("Opening cursor");
+ keyRange = IDBKeyRange.leftBound("myKey");
+ result = evalAndLog("objectStore.openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = cursorSuccess;
+}
+
+function populateObjectStore(objectStore)
+{
+ result = evalAndLog("objectStore.add('myValue', 'myKey')");
+ verifyResult(result);
+ result.onsuccess = openCursor;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createObjectStoreSuccess()
+{
+ verifySuccessEvent(event);
+ var objectStore = evalAndLog("objectStore = event.result");
+ populateObjectStore(objectStore);
+}
+
+function openSuccess()
+{
+ verifySuccessEvent(event);
+ var db = evalAndLog("db = event.result");
+ result = evalAndLog("db.createObjectStore('test')");
+ verifyResult(result);
+ result.onsuccess = createObjectStoreSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function test()
+{
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+test();
+
+var successfullyParsed = true;
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk
index 845abdb..cc3ae07 100644
--- a/WebCore/Android.derived.jscbindings.mk
+++ b/WebCore/Android.derived.jscbindings.mk
@@ -1,3 +1,4 @@
+
##
## Copyright 2009, The Android Open Source Project
##
@@ -361,6 +362,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/
# Indexed Database
GEN := \
$(intermediates)/storage/JSIDBAny.h \
+ $(intermediates)/storage/JSIDBCursor.h \
$(intermediates)/storage/JSIDBDatabaseError.h \
$(intermediates)/storage/JSIDBDatabaseException.h \
$(intermediates)/storage/JSIDBDatabase.h \
diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk
index f531fea..ee24058 100644
--- a/WebCore/Android.derived.v8bindings.mk
+++ b/WebCore/Android.derived.v8bindings.mk
@@ -342,6 +342,7 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)
# Indexed Database
GEN := \
$(intermediates)/bindings/V8IDBAny.h \
+ $(intermediates)/bindings/V8IDBCursor.h \
$(intermediates)/bindings/V8IDBDatabaseError.h \
$(intermediates)/bindings/V8IDBDatabaseException.h \
$(intermediates)/bindings/V8IDBDatabase.h \
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 143dce6..b4c5188 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -743,6 +743,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
storage/DatabaseThread.cpp \
storage/DatabaseTracker.cpp \
storage/IDBAny.cpp \
+ storage/IDBCursor.cpp \
+ storage/IDBCursorBackendImpl.cpp \
storage/IDBDatabase.cpp \
storage/IDBDatabaseBackendImpl.cpp \
storage/IDBErrorEvent.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index ddb8210..bf1a052 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -334,6 +334,7 @@ SET(WebCore_IDL_FILES
storage/DatabaseCallback.idl
storage/DatabaseSync.idl
storage/IDBAny.idl
+ storage/IDBCursor.idl
storage/IDBDatabaseError.idl
storage/IDBDatabaseException.idl
storage/IDBDatabase.idl
@@ -1439,6 +1440,8 @@ SET(WebCore_SOURCES
storage/IDBAny.cpp
storage/IDBDatabase.cpp
storage/IDBDatabaseBackendImpl.cpp
+ storage/IDBCursor.cpp
+ storage/IDBCursorBackendImpl.cpp
storage/IDBErrorEvent.cpp
storage/IDBEvent.cpp
storage/IDBIndex.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index da85abe..d71a350 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,71 @@
+2010-08-05 Marcus Bulach <bulach at chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Initial bindings and plumbing for IDBCursor.
+ https://bugs.webkit.org/show_bug.cgi?id=41888
+
+ Test: storage/indexeddb/idb-opencursor.html
+
+ * Android.derived.jscbindings.mk:
+ * Android.derived.v8bindings.mk:
+ * Android.mk:
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pri:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/v8/custom/V8IDBAnyCustom.cpp:
+ (WebCore::toV8):
+ * storage/IDBAny.cpp:
+ (WebCore::IDBAny::idbCursor):
+ (WebCore::IDBAny::set):
+ * storage/IDBAny.h:
+ (WebCore::IDBAny::):
+ * storage/IDBCallbacks.h:
+ * storage/IDBCursor.cpp: Added.
+ (WebCore::IDBCursor::IDBCursor):
+ (WebCore::IDBCursor::~IDBCursor):
+ (WebCore::IDBCursor::direction):
+ (WebCore::IDBCursor::key):
+ (WebCore::IDBCursor::value):
+ (WebCore::IDBCursor::update):
+ (WebCore::IDBCursor::continueFunction):
+ (WebCore::IDBCursor::remove):
+ * storage/IDBCursor.h: Added.
+ (WebCore::IDBCursor::):
+ (WebCore::IDBCursor::create):
+ * storage/IDBCursor.idl: Added.
+ * storage/IDBCursorBackendImpl.cpp: Added.
+ (WebCore::IDBCursorBackendImpl::IDBCursorBackendImpl):
+ (WebCore::IDBCursorBackendImpl::~IDBCursorBackendImpl):
+ (WebCore::IDBCursorBackendImpl::direction):
+ (WebCore::IDBCursorBackendImpl::key):
+ (WebCore::IDBCursorBackendImpl::value):
+ (WebCore::IDBCursorBackendImpl::update):
+ (WebCore::IDBCursorBackendImpl::continueFunction):
+ (WebCore::IDBCursorBackendImpl::remove):
+ * storage/IDBCursorBackendImpl.h: Added.
+ (WebCore::IDBCursorBackendImpl::create):
+ * storage/IDBCursorBackendInterface.h: Added.
+ (WebCore::IDBCursorBackendInterface::~IDBCursorBackendInterface):
+ * storage/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::openCursor):
+ * storage/IDBObjectStore.h:
+ * storage/IDBObjectStore.idl:
+ * storage/IDBObjectStoreBackendImpl.cpp:
+ (WebCore::IDBObjectStoreBackendImpl::openCursor):
+ * storage/IDBObjectStoreBackendImpl.h:
+ * storage/IDBObjectStoreBackendInterface.h:
+ * storage/IDBRequest.cpp:
+ (WebCore::IDBRequest::onSuccess):
+ (WebCore::IDBRequest::timerFired):
+ * storage/IDBRequest.h:
+
2010-08-06 Andrei Popescu <andreip at google.com>
Unreviewed, release build fix.
diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp
index 7071183..fd7fcf8 100644
--- a/WebCore/DerivedSources.cpp
+++ b/WebCore/DerivedSources.cpp
@@ -176,6 +176,7 @@
#include "JSHTMLUListElement.cpp"
#include "JSHTMLVideoElement.cpp"
#include "JSIDBAny.cpp"
+#include "JSIDBCursor.cpp"
#include "JSIDBDatabase.cpp"
#include "JSIDBDatabaseError.cpp"
#include "JSIDBDatabaseException.cpp"
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index f331db8..b651119 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -226,6 +226,7 @@ DOM_CLASSES = \
HTMLVideoElement \
History \
IDBAny \
+ IDBCursor \
IDBDatabaseError \
IDBDatabaseException \
IDBDatabase \
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 96dd46d..b2a3e53 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2863,6 +2863,11 @@ webcore_sources += \
WebCore/storage/IDBAny.h \
WebCore/storage/IDBCallbacks.h \
WebCore/storage/IDBDatabase.cpp \
+ WebCore/storage/IDBCursor.h \
+ WebCore/storage/IDBCursor.cpp \
+ WebCore/storage/IDBCursorBackendImpl.cpp \
+ WebCore/storage/IDBCursorBackendImpl.h \
+ WebCore/storage/IDBCursorBackendInterface.h \
WebCore/storage/IDBDatabase.h \
WebCore/storage/IDBDatabaseBackendImpl.cpp \
WebCore/storage/IDBDatabaseBackendImpl.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 0892445..4e35085 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -237,6 +237,7 @@
'storage/FileSystemCallback.idl',
'storage/Flags.idl',
'storage/IDBAny.idl',
+ 'storage/IDBCursor.idl',
'storage/IDBDatabaseError.idl',
'storage/IDBDatabaseException.idl',
'storage/IDBDatabase.idl',
@@ -3494,6 +3495,11 @@
'storage/IDBAny.cpp',
'storage/IDBAny.h',
'storage/IDBCallbacks.h',
+ 'storage/IDBCursor.cpp',
+ 'storage/IDBCursor.h',
+ 'storage/IDBCursorBackendImpl.cpp',
+ 'storage/IDBCursorBackendImpl.h',
+ 'storage/IDBCursorBackendInterface.h',
'storage/IDBDatabase.h',
'storage/IDBDatabase.cpp',
'storage/IDBDatabaseError.h',
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index f262c1d..54e996e 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -483,6 +483,7 @@ IDL_BINDINGS += \
storage/DatabaseCallback.idl \
storage/DatabaseSync.idl \
storage/IDBAny.idl \
+ storage/IDBCursor.idl \
storage/IDBDatabaseError.idl \
storage/IDBDatabaseException.idl \
storage/IDBDatabase.idl \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 161e798..3f22a22 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2424,6 +2424,9 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) {
bindings/js/IDBBindingUtilities.h \
storage/IDBAny.h \
storage/IDBCallbacks.h \
+ storage/IDBCursor.h \
+ storage/IDBCursorBackendImpl.h \
+ storage/IDBCursorBackendInterface.h \
storage/IDBDatabase.h \
storage/IDBDatabaseBackendImpl.h \
storage/IDBDatabaseBackendInterface.h \
@@ -2452,6 +2455,8 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) {
bindings/js/JSIDBAnyCustom.cpp \
bindings/js/JSIDBKeyCustom.cpp \
storage/IDBAny.cpp \
+ storage/IDBCursor.cpp \
+ storage/IDBCursorBackendImpl.cpp \
storage/IDBDatabase.cpp \
storage/IDBDatabaseBackendImpl.cpp \
storage/IDBErrorEvent.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index de2470e..78d5264 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -44312,6 +44312,110 @@
</FileConfiguration>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBCursor.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBCursor.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\bindings\js\JSHTMLOptionsCollectionCustom.cpp"
>
<FileConfiguration
@@ -50161,6 +50265,26 @@
>
</File>
<File
+ RelativePath="..\storage\IDBCursor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\IDBCursor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\IDBCursorBackendImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\IDBCursorBackendImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\IDBCursorBackendInterface.h"
+ >
+ </File>
+ <File
RelativePath="..\storage\IDBDatabase.cpp"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 1192fcd..8842d1f 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1413,6 +1413,13 @@
7AED3E060FBB1EAA00D2B03C /* InspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */; };
7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 81BE209811F4AB8D00915DFA /* IDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE209311F4AB8D00915DFA /* IDBCursor.cpp */; };
+ 81BE209711F4AB8D00915DFA /* IDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209211F4AB8D00915DFA /* IDBCursor.h */; };
+ 81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */; };
+ 81BE209911F4AB8D00915DFA /* IDBCursorBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */; };
+ 81BE209B11F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE209611F4AB8D00915DFA /* IDBCursorBackendInterface.h */; };
+ 81BE20D211F4BC3200915DFA /* JSIDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81BE20A711F4B66F00915DFA /* JSIDBCursor.cpp */; };
+ 81BE20D311F4BC3200915DFA /* JSIDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81BE20A811F4B66F00915DFA /* JSIDBCursor.h */; };
82B658981189E39200E052A1 /* InspectorCSSStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B658971189E39200E052A1 /* InspectorCSSStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
82B6589A1189E47600E052A1 /* InspectorCSSStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 82B658991189E47600E052A1 /* InspectorCSSStore.cpp */; };
841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */; };
@@ -7213,6 +7220,13 @@
7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontend.h; sourceTree = "<group>"; };
7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; };
7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; };
+ 81BE209211F4AB8D00915DFA /* IDBCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursor.h; sourceTree = "<group>"; };
+ 81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorBackendImpl.cpp; sourceTree = "<group>"; };
+ 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendImpl.h; sourceTree = "<group>"; };
+ 81BE209411F4AB8D00915DFA /* IDBCursorBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendInterface.h; sourceTree = "<group>"; };
+ 81BE209C11F4ABBD00915DFA /* IDBCursor.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBCursor.idl; sourceTree = "<group>"; };
+ 81BE20A711F4B66F00915DFA /* JSIDBCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBCursor.cpp; sourceTree = "<group>"; };
+ 81BE20A811F4B66F00915DFA /* JSIDBCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBCursor.h; sourceTree = "<group>"; };
82B658971189E39200E052A1 /* InspectorCSSStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorCSSStore.h; sourceTree = "<group>"; };
82B658991189E47600E052A1 /* InspectorCSSStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCSSStore.cpp; sourceTree = "<group>"; };
841FDC241178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceFilter.cpp; sourceTree = "<group>"; };
@@ -11401,12 +11415,19 @@
C585A69911D4FB3D004C3E4B /* IDBAny.h */,
C585A69A11D4FB3D004C3E4B /* IDBAny.idl */,
C585A69B11D4FB3D004C3E4B /* IDBCallbacks.h */,
+ 81BE209211F4AB8D00915DFA /* IDBCursor.cpp */,
+ 81BE209211F4AB8D00915DFA /* IDBCursor.h */,
+ 81BE209C11F4ABBD00915DFA /* IDBCursor.idl */,
+ 81BE209311F4AB8D00915DFA /* IDBCursorBackendImpl.cpp */,
+ 81BE209411F4AB8D00915DFA /* IDBCursorBackendImpl.h */,
+ 81BE209511F4AB8D00915DFA /* IDBCursorBackendInterface.h */,
C585A6A311D4FB3D004C3E4B /* IDBDatabase.cpp */,
C585A6A411D4FB3D004C3E4B /* IDBDatabase.h */,
C585A6A511D4FB3D004C3E4B /* IDBDatabase.idl */,
C585A6A111D4FB3D004C3E4B /* IDBDatabaseBackendImpl.cpp */,
B61762611203490800EF9114 /* IDBDatabaseBackendImpl.h */,
B61762531203374F00EF9114 /* IDBDatabaseBackendInterface.h */,
+
C585A69D11D4FB3D004C3E4B /* IDBDatabaseError.h */,
C585A69E11D4FB3D004C3E4B /* IDBDatabaseError.idl */,
C585A69F11D4FB3D004C3E4B /* IDBDatabaseException.h */,
@@ -14866,6 +14887,8 @@
897A2D92120003760082740C /* JSFlags.h */,
C585A66411D4FB07004C3E4B /* JSIDBAny.cpp */,
C585A66511D4FB07004C3E4B /* JSIDBAny.h */,
+ 81BE20A711F4B66F00915DFA /* JSIDBCursor.cpp */,
+ 81BE20A811F4B66F00915DFA /* JSIDBCursor.h */,
C585A66A11D4FB07004C3E4B /* JSIDBDatabase.cpp */,
C585A66B11D4FB07004C3E4B /* JSIDBDatabase.h */,
C585A66611D4FB07004C3E4B /* JSIDBDatabaseError.cpp */,
@@ -20004,6 +20027,10 @@
CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
B656626B120B115A006EA85C /* IDBTransaction.h in Headers */,
B6566270120B1227006EA85C /* JSIDBTransaction.h in Headers */,
+ 81BE209711F4AB8D00915DFA /* IDBCursor.h in Headers */,
+ 81BE209911F4AB8D00915DFA /* IDBCursorBackendImpl.h in Headers */,
+ 81BE209B11F4AB8D00915DFA /* IDBCursorBackendInterface.h in Headers */,
+ 81BE20D311F4BC3200915DFA /* JSIDBCursor.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -22410,6 +22437,9 @@
A8BCFD05120A046100B5F122 /* SVGPathSeg.cpp in Sources */,
B656626A120B115A006EA85C /* IDBTransaction.cpp in Sources */,
B6566271120B1227006EA85C /* JSIDBTransaction.cpp in Sources */,
+ 81BE209811F4AB8D00915DFA /* IDBCursor.cpp in Sources */,
+ 81BE209811F4AB8D00915DFA /* IDBCursorBackendImpl.cpp in Sources */,
+ 81BE20D211F4BC3200915DFA /* JSIDBCursor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
index 1abe870..3dffeb5 100644
--- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
@@ -32,6 +32,7 @@
#include "V8IDBAny.h"
#include "SerializedScriptValue.h"
+#include "V8IDBCursor.h"
#include "V8IDBDatabase.h"
#include "V8IDBFactory.h"
#include "V8IDBIndex.h"
@@ -50,6 +51,8 @@ v8::Handle<v8::Value> toV8(IDBAny* impl)
return v8::Undefined();
case IDBAny::NullType:
return v8::Null();
+ case IDBAny::IDBCursorType:
+ return toV8(impl->idbCursor());
case IDBAny::IDBDatabaseType:
return toV8(impl->idbDatabase());
case IDBAny::IDBIndexType:
diff --git a/WebCore/storage/IDBAny.cpp b/WebCore/storage/IDBAny.cpp
index 852e831..93d2633 100644
--- a/WebCore/storage/IDBAny.cpp
+++ b/WebCore/storage/IDBAny.cpp
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "IDBCursor.h"
#include "IDBDatabase.h"
#include "IDBFactory.h"
#include "IDBIndex.h"
@@ -50,6 +51,12 @@ IDBAny::~IDBAny()
{
}
+PassRefPtr<IDBCursor> IDBAny::idbCursor()
+{
+ ASSERT(m_type == IDBCursorType);
+ return m_idbCursor;
+}
+
PassRefPtr<IDBDatabase> IDBAny::idbDatabase()
{
ASSERT(m_type == IDBDatabaseType);
@@ -92,6 +99,13 @@ void IDBAny::set()
m_type = NullType;
}
+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);
diff --git a/WebCore/storage/IDBAny.h b/WebCore/storage/IDBAny.h
index 1f96500..950660a 100644
--- a/WebCore/storage/IDBAny.h
+++ b/WebCore/storage/IDBAny.h
@@ -34,6 +34,7 @@
namespace WebCore {
+class IDBCursor;
class IDBDatabase;
class IDBIndex;
class IDBKey;
@@ -56,6 +57,7 @@ public:
enum Type {
UndefinedType = 0,
NullType,
+ IDBCursorType,
IDBDatabaseType,
IDBFactoryType,
IDBIndexType,
@@ -66,6 +68,7 @@ public:
Type type() const { return m_type; }
// Use type() to figure out which one of these you're allowed to call.
+ PassRefPtr<IDBCursor> idbCursor();
PassRefPtr<IDBDatabase> idbDatabase();
PassRefPtr<IDBFactory> idbFactory();
PassRefPtr<IDBIndex> idbIndex();
@@ -75,6 +78,7 @@ public:
// Set can only be called once.
void set(); // For "null".
+ void set(PassRefPtr<IDBCursor>);
void set(PassRefPtr<IDBDatabase>);
void set(PassRefPtr<IDBFactory>);
void set(PassRefPtr<IDBIndex>);
@@ -88,6 +92,7 @@ private:
Type m_type;
// Only one of the following should ever be in use at any given time.
+ RefPtr<IDBCursor> m_idbCursor;
RefPtr<IDBDatabase> m_idbDatabase;
RefPtr<IDBFactory> m_idbFactory;
RefPtr<IDBIndex> m_idbIndex;
diff --git a/WebCore/storage/IDBCallbacks.h b/WebCore/storage/IDBCallbacks.h
index 47c3694..bc48477 100644
--- a/WebCore/storage/IDBCallbacks.h
+++ b/WebCore/storage/IDBCallbacks.h
@@ -29,6 +29,7 @@
#ifndef IDBCallbacks_h
#define IDBCallbacks_h
+#include "IDBCursorBackendInterface.h"
#include "IDBDatabaseBackendInterface.h"
#include "IDBDatabaseError.h"
#include "IDBIndexBackendInterface.h"
@@ -47,6 +48,7 @@ public:
virtual void onError(PassRefPtr<IDBDatabaseError>) = 0;
virtual void onSuccess() = 0; // For "null".
+ virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>) = 0;
virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) = 0;
virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>) = 0;
virtual void onSuccess(PassRefPtr<IDBKey>) = 0;
diff --git a/WebCore/storage/IDBCursor.cpp b/WebCore/storage/IDBCursor.cpp
new file mode 100644
index 0000000..de752f5
--- /dev/null
+++ b/WebCore/storage/IDBCursor.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 "IDBCursor.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBAny.h"
+#include "IDBCallbacks.h"
+#include "IDBCursorBackendInterface.h"
+#include "IDBKey.h"
+#include "IDBRequest.h"
+#include "ScriptExecutionContext.h"
+#include "SerializedScriptValue.h"
+
+namespace WebCore {
+
+IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackendInterface> backend)
+ : m_backend(backend)
+{
+}
+
+IDBCursor::~IDBCursor()
+{
+}
+
+unsigned short IDBCursor::direction() const
+{
+ return m_backend->direction();
+}
+
+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_backend->update(value, request);
+ return request.release();
+}
+
+PassRefPtr<IDBRequest> IDBCursor::continueFunction(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+{
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+ m_backend->continueFunction(key, request);
+ return request.release();
+}
+
+PassRefPtr<IDBRequest> IDBCursor::remove(ScriptExecutionContext* context)
+{
+ RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+ m_backend->remove(request);
+ return request.release();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBCursor.h b/WebCore/storage/IDBCursor.h
new file mode 100644
index 0000000..ccce001
--- /dev/null
+++ b/WebCore/storage/IDBCursor.h
@@ -0,0 +1,78 @@
+/*
+ * 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 IDBCursor_h
+#define IDBCursor_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+class IDBAny;
+class IDBCallbacks;
+class IDBCursorBackendInterface;
+class IDBKey;
+class IDBRequest;
+class ScriptExecutionContext;
+class SerializedScriptValue;
+
+class IDBCursor : public ThreadSafeShared<IDBCursor> {
+public:
+ enum Direction {
+ NEXT = 0,
+ NEXT_NO_DUPLICATE = 1,
+ PREV = 2,
+ PREV_NO_DUPLICATE = 3,
+ };
+ static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface> backend)
+ {
+ return adoptRef(new IDBCursor(backend));
+ }
+ virtual ~IDBCursor();
+
+ // Implement the IDL
+ 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:
+ explicit IDBCursor(PassRefPtr<IDBCursorBackendInterface>);
+
+ RefPtr<IDBCursorBackendInterface> m_backend;
+};
+
+} // namespace WebCore
+
+#endif
+
+#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/IDBCursorBackendInterface.h b/WebCore/storage/IDBCursorBackendInterface.h
new file mode 100644
index 0000000..4b209c4
--- /dev/null
+++ b/WebCore/storage/IDBCursorBackendInterface.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBCursorBackendInterface_h
+#define IDBCursorBackendInterface_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+class IDBAny;
+class IDBCallbacks;
+class IDBKey;
+class IDBRequest;
+class SerializedScriptValue;
+
+class IDBCursorBackendInterface : public ThreadSafeShared<IDBCursorBackendInterface> {
+public:
+ virtual ~IDBCursorBackendInterface() {}
+
+ virtual unsigned short direction() const = 0;
+ virtual PassRefPtr<IDBKey> key() const = 0;
+ virtual PassRefPtr<IDBAny> value() const = 0;
+
+ 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 // IDBCursorBackendInterface_h
diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp
index 4b1de0a..b457cd1 100644
--- a/WebCore/storage/IDBObjectStore.cpp
+++ b/WebCore/storage/IDBObjectStore.cpp
@@ -30,6 +30,7 @@
#include "IDBAny.h"
#include "IDBIndex.h"
#include "IDBKey.h"
+#include "IDBKeyRange.h"
#include "SerializedScriptValue.h"
#include <wtf/UnusedParam.h>
@@ -108,6 +109,13 @@ PassRefPtr<IDBRequest> IDBObjectStore::removeIndex(ScriptExecutionContext* conte
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 e354273..8b1d841 100644
--- a/WebCore/storage/IDBObjectStore.h
+++ b/WebCore/storage/IDBObjectStore.h
@@ -26,6 +26,7 @@
#ifndef IDBObjectStore_h
#define IDBObjectStore_h
+#include "IDBCursor.h"
#include "IDBObjectStoreBackendInterface.h"
#include "IDBRequest.h"
#include "PlatformString.h"
@@ -40,6 +41,7 @@ namespace WebCore {
class DOMStringList;
class IDBAny;
class IDBIndexRequest;
+class IDBKeyRange;
class IDBKey;
class SerializedScriptValue;
@@ -64,6 +66,8 @@ public:
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>);
diff --git a/WebCore/storage/IDBObjectStore.idl b/WebCore/storage/IDBObjectStore.idl
index 0a57c7d..1649a1d 100644
--- a/WebCore/storage/IDBObjectStore.idl
+++ b/WebCore/storage/IDBObjectStore.idl
@@ -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/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index f6120ae..9732bc1 100755
--- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -29,8 +29,10 @@
#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)
@@ -130,6 +132,16 @@ void IDBObjectStoreBackendImpl::removeIndex(const String& name, PassRefPtr<IDBCa
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/IDBObjectStoreBackendImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h
index b0976c2..fc63658 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.h
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.h
@@ -56,6 +56,8 @@ 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:
IDBObjectStoreBackendImpl(const String& name, const String& keyPath, bool autoIncrement);
diff --git a/WebCore/storage/IDBObjectStoreBackendInterface.h b/WebCore/storage/IDBObjectStoreBackendInterface.h
index 66f9a71..200ac29 100644
--- a/WebCore/storage/IDBObjectStoreBackendInterface.h
+++ b/WebCore/storage/IDBObjectStoreBackendInterface.h
@@ -37,6 +37,7 @@ class DOMStringList;
class IDBCallbacks;
class IDBIndexBackendInterface;
class IDBKey;
+class IDBKeyRange;
class SerializedScriptValue;
class IDBObjectStoreBackendInterface : public ThreadSafeShared<IDBObjectStoreBackendInterface> {
@@ -54,6 +55,8 @@ public:
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
diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp
index e902d20..94ef7e5 100644
--- a/WebCore/storage/IDBRequest.cpp
+++ b/WebCore/storage/IDBRequest.cpp
@@ -35,6 +35,7 @@
#include "EventException.h"
#include "EventListener.h"
#include "EventNames.h"
+#include "IDBCursor.h"
#include "IDBDatabase.h"
#include "IDBIndex.h"
#include "IDBErrorEvent.h"
@@ -72,6 +73,12 @@ void IDBRequest::onSuccess()
m_result->set();
}
+void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend)
+{
+ onEventCommon();
+ m_result->set(IDBCursor::create(backend));
+}
+
void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend)
{
onEventCommon();
@@ -147,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));
}
}
diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h
index d7531c2..ddfdcf3 100644
--- a/WebCore/storage/IDBRequest.h
+++ b/WebCore/storage/IDBRequest.h
@@ -63,6 +63,7 @@ public:
virtual void onError(PassRefPtr<IDBDatabaseError>);
virtual void onSuccess(); // For "null".
virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>);
+ virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBKey>);
virtual void onSuccess(PassRefPtr<IDBObjectStoreBackendInterface>);
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index e198f2a..f7d9078 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,69 @@
+2010-08-05 Marcus Bulach <bulach at chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Initial bindings and plumbing for IDBCursor.
+ https://bugs.webkit.org/show_bug.cgi?id=41888
+
+ Test: storage/indexeddb/idb-opencursor.html
+
+ * WebKit.gyp:
+ * public/WebIDBCallbacks.h:
+ (WebKit::WebIDBCallbacks::onSuccess):
+ * public/WebIDBCursor.h: Added.
+ (WebKit::WebIDBCursor::~WebIDBCursor):
+ (WebKit::WebIDBCursor::direction):
+ (WebKit::WebIDBCursor::key):
+ (WebKit::WebIDBCursor::value):
+ (WebKit::WebIDBCursor::update):
+ (WebKit::WebIDBCursor::continueFunction):
+ (WebKit::WebIDBCursor::remove):
+ * public/WebIDBKeyRange.h: Added.
+ (WebKit::WebIDBKeyRange::~WebIDBKeyRange):
+ (WebKit::WebIDBKeyRange::WebIDBKeyRange):
+ * public/WebIDBObjectStore.h:
+ (WebKit::WebIDBObjectStore::openCursor):
+ * src/IDBCallbacksProxy.cpp:
+ (WebCore::IDBCallbacksProxy::onSuccess):
+ * src/IDBCallbacksProxy.h:
+ * src/IDBCursorBackendProxy.cpp: Added.
+ (WebCore::IDBCursorBackendProxy::create):
+ (WebCore::IDBCursorBackendProxy::IDBCursorBackendProxy):
+ (WebCore::IDBCursorBackendProxy::~IDBCursorBackendProxy):
+ (WebCore::IDBCursorBackendProxy::direction):
+ (WebCore::IDBCursorBackendProxy::key):
+ (WebCore::IDBCursorBackendProxy::value):
+ (WebCore::IDBCursorBackendProxy::update):
+ (WebCore::IDBCursorBackendProxy::continueFunction):
+ (WebCore::IDBCursorBackendProxy::remove):
+ * src/IDBCursorBackendProxy.h: Added.
+ * src/IDBObjectStoreProxy.cpp:
+ (WebCore::IDBObjectStoreProxy::openCursor):
+ * src/IDBObjectStoreProxy.h:
+ * src/WebIDBCallbacksImpl.cpp:
+ (WebCore::WebIDBCallbacksImpl::onSuccess):
+ * src/WebIDBCallbacksImpl.h:
+ * src/WebIDBCursorImpl.cpp: Added.
+ (WebKit::WebIDBCursorImpl::WebIDBCursorImpl):
+ (WebKit::WebIDBCursorImpl::~WebIDBCursorImpl):
+ (WebKit::WebIDBCursorImpl::direction):
+ (WebKit::WebIDBCursorImpl::key):
+ (WebKit::WebIDBCursorImpl::value):
+ (WebKit::WebIDBCursorImpl::update):
+ (WebKit::WebIDBCursorImpl::continueFunction):
+ (WebKit::WebIDBCursorImpl::remove):
+ * src/WebIDBCursorImpl.h: Added.
+ * src/WebIDBKeyRange.cpp: Added.
+ (WebKit::WebIDBKeyRange::WebIDBKeyRange):
+ (WebKit::WebIDBKeyRange::assign):
+ (WebKit::WebIDBKeyRange::reset):
+ (WebKit::WebIDBKeyRange::left):
+ (WebKit::WebIDBKeyRange::right):
+ (WebKit::WebIDBKeyRange::flags):
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::openCursor):
+ * src/WebIDBObjectStoreImpl.h:
+
2010-08-05 Andrei Popescu <andreip at dhcp-172-16-14-12.lon.corp.google.com>
Reviewed by Jeremy Orlow.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 2a60467..06fd82c 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -174,9 +174,11 @@
'public/WebImage.h',
'public/WebImageDecoder.h',
'public/WebIDBCallbacks.h',
+ 'public/WebIDBCursor.h',
'public/WebIDBDatabase.h',
'public/WebIDBDatabaseError.h',
'public/WebIDBFactory.h',
+ 'public/WebIDBKeyRange.h',
'public/WebIDBIndex.h',
'public/WebIDBKey.h',
'public/WebIDBObjectStore.h',
@@ -314,6 +316,8 @@
'src/gtk/WebInputEventFactory.cpp',
'src/IDBCallbacksProxy.cpp',
'src/IDBCallbacksProxy.h',
+ 'src/IDBCursorBackendProxy.cpp',
+ 'src/IDBCursorBackendProxy.h',
'src/IDBDatabaseProxy.cpp',
'src/IDBDatabaseProxy.h',
'src/IDBFactoryBackendProxy.cpp',
@@ -405,6 +409,8 @@
'src/WebHTTPBody.cpp',
'src/WebIDBCallbacksImpl.cpp',
'src/WebIDBCallbacksImpl.h',
+ 'src/WebIDBCursorImpl.cpp',
+ 'src/WebIDBCursorImpl.h',
'src/WebIDBDatabaseError.cpp',
'src/WebIDBDatabaseImpl.cpp',
'src/WebIDBDatabaseImpl.h',
@@ -413,6 +419,7 @@
'src/WebIDBIndexImpl.cpp',
'src/WebIDBIndexImpl.h',
'src/WebIDBKey.cpp',
+ 'src/WebIDBKeyRange.cpp',
'src/WebIDBObjectStoreImpl.cpp',
'src/WebIDBObjectStoreImpl.h',
'src/WebImageCG.cpp',
diff --git a/WebKit/chromium/public/WebIDBCallbacks.h b/WebKit/chromium/public/WebIDBCallbacks.h
index cee8612..2e2c4d2 100644
--- a/WebKit/chromium/public/WebIDBCallbacks.h
+++ b/WebKit/chromium/public/WebIDBCallbacks.h
@@ -30,6 +30,7 @@
namespace WebKit {
+class WebIDBCursor;
class WebIDBDatabase;
class WebIDBDatabaseError;
class WebIDBKey;
@@ -45,6 +46,7 @@ public:
// For the rest, pass ownership to the callee via a pointer.
virtual void onError(const WebIDBDatabaseError&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void onSuccess() { WEBKIT_ASSERT_NOT_REACHED(); } // For "null".
+ virtual void onSuccess(WebIDBCursor*) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void onSuccess(WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void onSuccess(const WebIDBKey&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void onSuccess(WebIDBIndex*) { WEBKIT_ASSERT_NOT_REACHED(); }
diff --git a/WebKit/chromium/public/WebIDBCursor.h b/WebKit/chromium/public/WebIDBCursor.h
new file mode 100644
index 0000000..27eb924
--- /dev/null
+++ b/WebKit/chromium/public/WebIDBCursor.h
@@ -0,0 +1,78 @@
+/*
+ * 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 WebIDBCursor_h
+#define WebIDBCursor_h
+
+#include "WebCommon.h"
+#include "WebIDBCallbacks.h"
+#include "WebIDBKey.h"
+#include "WebSerializedScriptValue.h"
+#include "WebString.h"
+
+namespace WebKit {
+
+// See comment in WebIndexedDatabase for a high level overview these classes.
+class WebIDBCursor {
+public:
+ virtual ~WebIDBCursor() { }
+
+ virtual unsigned short direction() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return 0;
+ }
+
+ virtual WebIDBKey key() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return WebIDBKey("");
+ }
+
+ virtual WebSerializedScriptValue value() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return WebSerializedScriptValue();
+ }
+
+ virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*)
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ }
+
+ virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*)
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ }
+
+ virtual void remove(WebIDBCallbacks*)
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ }
+};
+
+} // namespace WebKit
+
+#endif // WebIDBCursor_h
diff --git a/WebKit/chromium/public/WebIDBKeyRange.h b/WebKit/chromium/public/WebIDBKeyRange.h
new file mode 100644
index 0000000..82953ce
--- /dev/null
+++ b/WebKit/chromium/public/WebIDBKeyRange.h
@@ -0,0 +1,66 @@
+/*
+ * 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 WebIDBKeyRange_h
+#define WebIDBKeyRange_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore { class IDBKeyRange; }
+
+namespace WebKit {
+
+class WebIDBKey;
+class WebString;
+
+class WebIDBKeyRange {
+public:
+ ~WebIDBKeyRange() { reset(); }
+
+ WebIDBKeyRange(const WebIDBKeyRange& keyRange) { assign(keyRange); }
+ WebIDBKeyRange(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags) { assign(left, right, flags); }
+
+ WEBKIT_API WebIDBKey left() const;
+ WEBKIT_API WebIDBKey right() const;
+ WEBKIT_API unsigned short flags() const;
+
+ WEBKIT_API void assign(const WebIDBKeyRange&);
+ WEBKIT_API void assign(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags);
+ WEBKIT_API void reset();
+
+#if WEBKIT_IMPLEMENTATION
+ WebIDBKeyRange(const WTF::PassRefPtr<WebCore::IDBKeyRange>&);
+ WebIDBKeyRange& operator=(const WTF::PassRefPtr<WebCore::IDBKeyRange>&);
+ operator WTF::PassRefPtr<WebCore::IDBKeyRange>() const;
+#endif
+
+private:
+ WebPrivatePtr<WebCore::IDBKeyRange> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebIDBKeyRange_h
diff --git a/WebKit/chromium/public/WebIDBObjectStore.h b/WebKit/chromium/public/WebIDBObjectStore.h
index fb81fb9..7452be9 100755
--- a/WebKit/chromium/public/WebIDBObjectStore.h
+++ b/WebKit/chromium/public/WebIDBObjectStore.h
@@ -33,6 +33,8 @@
namespace WebKit {
+class WebIDBKeyRange;
+
// See comment in WebIndexedDatabase for a high level overview these classes.
class WebIDBObjectStore {
public:
@@ -79,6 +81,10 @@ public:
{
WEBKIT_ASSERT_NOT_REACHED();
}
+ virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*)
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ }
// FIXME: finish.
};
diff --git a/WebKit/chromium/src/IDBCallbacksProxy.cpp b/WebKit/chromium/src/IDBCallbacksProxy.cpp
index 0375c6b..3eab622 100644
--- a/WebKit/chromium/src/IDBCallbacksProxy.cpp
+++ b/WebKit/chromium/src/IDBCallbacksProxy.cpp
@@ -32,6 +32,7 @@
#include "IDBDatabaseError.h"
#include "IDBDatabaseProxy.h"
#include "WebIDBCallbacks.h"
+#include "WebIDBCursorImpl.h"
#include "WebIDBDatabaseImpl.h"
#include "WebIDBDatabaseError.h"
#include "WebIDBIndexImpl.h"
@@ -69,6 +70,12 @@ void IDBCallbacksProxy::onSuccess()
m_callbacks.clear();
}
+void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend)
+{
+ m_callbacks->onSuccess(new WebKit::WebIDBCursorImpl(idbCursorBackend));
+ m_callbacks.clear();
+}
+
void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend)
{
m_callbacks->onSuccess(new WebKit::WebIDBDatabaseImpl(backend));
diff --git a/WebKit/chromium/src/IDBCallbacksProxy.h b/WebKit/chromium/src/IDBCallbacksProxy.h
index 40bb947..506dbb0 100644
--- a/WebKit/chromium/src/IDBCallbacksProxy.h
+++ b/WebKit/chromium/src/IDBCallbacksProxy.h
@@ -49,6 +49,7 @@ public:
virtual void onError(PassRefPtr<IDBDatabaseError>);
virtual void onSuccess(); // For "null".
+ virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>);
virtual void onSuccess(PassRefPtr<IDBKey>);
diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/WebKit/chromium/src/IDBCursorBackendProxy.cpp
new file mode 100644
index 0000000..fff00b7
--- /dev/null
+++ b/WebKit/chromium/src/IDBCursorBackendProxy.cpp
@@ -0,0 +1,86 @@
+/*
+ * 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 "IDBCursorBackendProxy.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBAny.h"
+#include "IDBCallbacks.h"
+#include "SerializedScriptValue.h"
+#include "WebIDBCallbacksImpl.h"
+#include "WebIDBKey.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBCursorBackendInterface> IDBCursorBackendProxy::create(PassOwnPtr<WebKit::WebIDBCursor> idbCursor)
+{
+ return adoptRef(new IDBCursorBackendProxy(idbCursor));
+}
+
+IDBCursorBackendProxy::IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor> idbCursor)
+ : m_idbCursor(idbCursor)
+{
+}
+
+IDBCursorBackendProxy::~IDBCursorBackendProxy()
+{
+}
+
+unsigned short IDBCursorBackendProxy::direction() const
+{
+ return m_idbCursor->direction();
+}
+
+PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const
+{
+ return m_idbCursor->key();
+}
+
+PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const
+{
+ RefPtr<SerializedScriptValue> value = PassRefPtr<SerializedScriptValue>(m_idbCursor->value());
+ return IDBAny::create(value.get());
+}
+
+void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBCursorBackendProxy::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_idbCursor->continueFunction(key, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBCursorBackendProxy::remove(PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_idbCursor->remove(new WebIDBCallbacksImpl(callbacks));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.h b/WebKit/chromium/src/IDBCursorBackendProxy.h
new file mode 100644
index 0000000..d8b621a
--- /dev/null
+++ b/WebKit/chromium/src/IDBCursorBackendProxy.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 IDBCursorBackendProxy_h
+#define IDBCursorBackendProxy_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBCursorBackendInterface.h"
+#include "WebIDBCursor.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBCursorBackendProxy : public IDBCursorBackendInterface {
+public:
+ static PassRefPtr<IDBCursorBackendInterface> create(PassOwnPtr<WebKit::WebIDBCursor>);
+ virtual ~IDBCursorBackendProxy();
+
+ 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:
+ IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor>);
+
+ OwnPtr<WebKit::WebIDBCursor> m_idbCursor;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBCursorBackendProxy_h
diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp
index 0e1a599..ad27fa3 100755
--- a/WebKit/chromium/src/IDBObjectStoreProxy.cpp
+++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp
@@ -29,7 +29,9 @@
#include "DOMStringList.h"
#include "IDBCallbacks.h"
#include "IDBIndexBackendProxy.h"
+#include "IDBKeyRange.h"
#include "WebIDBCallbacksImpl.h"
+#include "WebIDBKeyRange.h"
#include "WebIDBIndex.h"
#include "WebIDBKey.h"
#include "WebIDBObjectStore.h"
@@ -101,6 +103,11 @@ void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallback
m_webIDBObjectStore->removeIndex(name, new WebIDBCallbacksImpl(callbacks));
}
+void IDBObjectStoreProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks)
+{
+ m_webIDBObjectStore->openCursor(range, direction, new WebIDBCallbacksImpl(callbacks));
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h
index f569166..a334572 100755
--- a/WebKit/chromium/src/IDBObjectStoreProxy.h
+++ b/WebKit/chromium/src/IDBObjectStoreProxy.h
@@ -54,6 +54,8 @@ public:
PassRefPtr<IDBIndexBackendInterface> index(const String& name);
void removeIndex(const String& name, PassRefPtr<IDBCallbacks>);
+ virtual void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>);
+
private:
IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore>);
diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
index dbf7d85..e543123 100644
--- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
+++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
@@ -27,6 +27,7 @@
#include "WebIDBCallbacksImpl.h"
#include "IDBCallbacks.h"
+#include "IDBCursorBackendProxy.h"
#include "IDBDatabaseError.h"
#include "IDBDatabaseProxy.h"
#include "IDBIndexBackendProxy.h"
@@ -65,6 +66,12 @@ void WebIDBCallbacksImpl::onSuccess()
m_callbacks.clear();
}
+void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBCursor* cursor)
+{
+ m_callbacks->onSuccess(IDBCursorBackendProxy::create(cursor));
+ m_callbacks.clear();
+}
+
void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance)
{
m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance));
diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.h b/WebKit/chromium/src/WebIDBCallbacksImpl.h
index a4d53b5..1835c60 100644
--- a/WebKit/chromium/src/WebIDBCallbacksImpl.h
+++ b/WebKit/chromium/src/WebIDBCallbacksImpl.h
@@ -43,6 +43,7 @@ public:
virtual void onError(const WebKit::WebIDBDatabaseError&);
virtual void onSuccess(); // For "null".
+ virtual void onSuccess(WebKit::WebIDBCursor*);
virtual void onSuccess(WebKit::WebIDBDatabase*);
virtual void onSuccess(const WebKit::WebIDBKey&);
virtual void onSuccess(WebKit::WebIDBIndex*);
diff --git a/WebKit/chromium/src/WebIDBCursorImpl.cpp b/WebKit/chromium/src/WebIDBCursorImpl.cpp
new file mode 100644
index 0000000..1ade687
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBCursorImpl.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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 "WebIDBCursorImpl.h"
+
+#include "IDBAny.h"
+#include "IDBCallbacksProxy.h"
+#include "IDBCursorBackendInterface.h"
+#include "IDBKey.h"
+#include "WebIDBKey.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebIDBCursorImpl::WebIDBCursorImpl(PassRefPtr<IDBCursorBackendInterface> idbCursorBackend)
+ : m_idbCursorBackend(idbCursorBackend)
+{
+}
+
+WebIDBCursorImpl::~WebIDBCursorImpl()
+{
+}
+
+unsigned short WebIDBCursorImpl::direction() const
+{
+ return m_idbCursorBackend->direction();
+}
+
+WebIDBKey WebIDBCursorImpl::key() const
+{
+ return WebIDBKey(m_idbCursorBackend->key());
+}
+
+WebSerializedScriptValue WebIDBCursorImpl::value() const
+{
+ return m_idbCursorBackend->value()->serializedScriptValue();
+}
+
+void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks)
+{
+ m_idbCursorBackend->update(value, IDBCallbacksProxy::create(callbacks));
+}
+
+void WebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks)
+{
+ m_idbCursorBackend->continueFunction(key, IDBCallbacksProxy::create(callbacks));
+}
+
+void WebIDBCursorImpl::remove(WebIDBCallbacks* callbacks)
+{
+ m_idbCursorBackend->remove(IDBCallbacksProxy::create(callbacks));
+}
+
+} // namespace WebCore
diff --git a/WebKit/chromium/src/WebIDBCursorImpl.h b/WebKit/chromium/src/WebIDBCursorImpl.h
new file mode 100644
index 0000000..565e86a
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBCursorImpl.h
@@ -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.
+ */
+
+#ifndef WebIDBCursorImpl_h
+#define WebIDBCursorImpl_h
+
+#include "WebCommon.h"
+#include "WebIDBCursor.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore { class IDBCursorBackendInterface; }
+
+namespace WebKit {
+
+// See comment in WebIndexedObjectStore for a high level overview these classes.
+class WebIDBCursorImpl : public WebIDBCursor {
+public:
+ WebIDBCursorImpl(WTF::PassRefPtr<WebCore::IDBCursorBackendInterface>);
+ virtual ~WebIDBCursorImpl();
+
+ virtual unsigned short direction() const;
+ virtual WebIDBKey key() const;
+ virtual WebSerializedScriptValue value() const;
+ virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*);
+ virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*);
+ virtual void remove(WebIDBCallbacks*);
+
+ private:
+ WTF::RefPtr<WebCore::IDBCursorBackendInterface> m_idbCursorBackend;
+};
+
+} // namespace WebKit
+
+#endif // WebIDBCursorImpl_h
diff --git a/WebKit/chromium/src/WebIDBKeyRange.cpp b/WebKit/chromium/src/WebIDBKeyRange.cpp
new file mode 100644
index 0000000..4ce9452
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBKeyRange.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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 "WebIDBKeyRange.h"
+
+#include "IDBKey.h"
+#include "IDBKeyRange.h"
+#include "WebIDBKey.h"
+
+using WebCore::IDBKeyRange;
+
+namespace WebKit {
+
+void WebIDBKeyRange::assign(const WebIDBKeyRange& other)
+{
+ m_private = other.m_private;
+}
+
+void WebIDBKeyRange::assign(const WebIDBKey& left, const WebIDBKey& right, unsigned short flags)
+{
+ m_private = IDBKeyRange::create(left, right, flags);
+}
+
+void WebIDBKeyRange::reset()
+{
+ m_private.reset();
+}
+
+WebIDBKey WebIDBKeyRange::left() const
+{
+ return m_private->left();
+}
+
+WebIDBKey WebIDBKeyRange::right() const
+{
+ return m_private->right();
+}
+
+unsigned short WebIDBKeyRange::flags() const
+{
+ return m_private->flags();
+}
+
+WebIDBKeyRange::WebIDBKeyRange(const PassRefPtr<IDBKeyRange>& value)
+ : m_private(value)
+{
+}
+
+WebIDBKeyRange& WebIDBKeyRange::operator=(const PassRefPtr<IDBKeyRange>& value)
+{
+ m_private = value;
+ return *this;
+}
+
+WebIDBKeyRange::operator PassRefPtr<IDBKeyRange>() const
+{
+ return m_private.get();
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
index 2c347a8..1ad1d9f 100755
--- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
+++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
@@ -28,9 +28,11 @@
#include "DOMStringList.h"
#include "IDBCallbacksProxy.h"
+#include "IDBKeyRange.h"
#include "IDBObjectStoreBackendInterface.h"
#include "WebIDBIndexImpl.h"
#include "WebIDBKey.h"
+#include "WebIDBKeyRange.h"
#include "WebSerializedScriptValue.h"
#if ENABLE(INDEXED_DATABASE)
@@ -96,6 +98,11 @@ void WebIDBObjectStoreImpl::removeIndex(const WebString& name, WebIDBCallbacks*
m_objectStore->removeIndex(name, IDBCallbacksProxy::create(callbacks));
}
+void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks)
+{
+ m_objectStore->openCursor(IDBKeyRange::create(keyRange.left(), keyRange.right(), keyRange.flags()), direction, IDBCallbacksProxy::create(callbacks));
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h
index 6fd345a..9f31369 100755
--- a/WebKit/chromium/src/WebIDBObjectStoreImpl.h
+++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h
@@ -55,6 +55,8 @@ public:
WebIDBIndex* index(const WebString& name);
void removeIndex(const WebString& name, WebIDBCallbacks* callbacks);
+ void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*);
+
private:
WTF::RefPtr<WebCore::IDBObjectStoreBackendInterface> m_objectStore;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list