Title: [137381] trunk/Source
Revision
137381
Author
alecfl...@chromium.org
Date
2012-12-11 16:29:01 -0800 (Tue, 11 Dec 2012)

Log Message

IndexedDB: Stub out data operations on IDBDatabaseBackendInterface
https://bugs.webkit.org/show_bug.cgi?id=104592

Reviewed by Dimitri Glazkov.

Source/WebCore:

In preparation for removing objectStore/index backend
interfaces, stub out the basic data operations around
get, put, cursors, etc. on IDBDatabaseBackendInterface.

No new tests, this is just preparation for refactoring.

* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::get):
(WebCore):
(WebCore::IDBDatabaseBackendImpl::put):
(WebCore::IDBDatabaseBackendImpl::setIndexKeys):
(WebCore::IDBDatabaseBackendImpl::setIndexesReady):
(WebCore::IDBDatabaseBackendImpl::openCursor):
(WebCore::IDBDatabaseBackendImpl::count):
(WebCore::IDBDatabaseBackendImpl::deleteRange):
(WebCore::IDBDatabaseBackendImpl::clear):
* Modules/indexeddb/IDBDatabaseBackendImpl.h:
(IDBDatabaseBackendImpl):
* Modules/indexeddb/IDBDatabaseBackendInterface.h:
(WebCore):
(IDBDatabaseBackendInterface):

Source/WebKit/chromium:

Stub out chromium side of data operations for refactor.

* public/WebIDBDatabase.h:
(WebKit):
(WebKit::WebIDBDatabase::get):
(WebKit::WebIDBDatabase::put):
(WebKit::WebIDBDatabase::setIndexKeys):
(WebKit::WebIDBDatabase::setIndexesReady):
(WebKit::WebIDBDatabase::openCursor):
(WebKit::WebIDBDatabase::count):
(WebKit::WebIDBDatabase::deleteRange):
(WebKit::WebIDBDatabase::clear):
(WebIDBDatabase):
* src/IDBDatabaseBackendProxy.cpp:
(WebKit::IDBDatabaseBackendProxy::openCursor):
(WebKit):
(WebKit::IDBDatabaseBackendProxy::count):
(WebKit::IDBDatabaseBackendProxy::get):
(WebKit::IDBDatabaseBackendProxy::put):
(WebKit::IDBDatabaseBackendProxy::setIndexKeys):
(WebKit::IDBDatabaseBackendProxy::setIndexesReady):
(WebKit::IDBDatabaseBackendProxy::deleteRange):
(WebKit::IDBDatabaseBackendProxy::clear):
* src/IDBDatabaseBackendProxy.h:
(IDBDatabaseBackendProxy):
* src/WebIDBDatabaseImpl.cpp:
(WebKit):
(WebKit::WebIDBDatabaseImpl::openCursor):
(WebKit::WebIDBDatabaseImpl::count):
(WebKit::WebIDBDatabaseImpl::get):
(WebKit::WebIDBDatabaseImpl::put):
(WebKit::WebIDBDatabaseImpl::setIndexKeys):
(WebKit::WebIDBDatabaseImpl::setIndexesReady):
(WebKit::WebIDBDatabaseImpl::deleteRange):
(WebKit::WebIDBDatabaseImpl::clear):
* src/WebIDBDatabaseImpl.h:
(WebIDBDatabaseImpl):
* tests/IDBDatabaseBackendTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137380 => 137381)


--- trunk/Source/WebCore/ChangeLog	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebCore/ChangeLog	2012-12-12 00:29:01 UTC (rev 137381)
@@ -1,3 +1,32 @@
+2012-12-11  Alec Flett  <alecfl...@chromium.org>
+
+        IndexedDB: Stub out data operations on IDBDatabaseBackendInterface
+        https://bugs.webkit.org/show_bug.cgi?id=104592
+
+        Reviewed by Dimitri Glazkov.
+
+        In preparation for removing objectStore/index backend
+        interfaces, stub out the basic data operations around
+        get, put, cursors, etc. on IDBDatabaseBackendInterface.
+
+        No new tests, this is just preparation for refactoring.
+
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::get):
+        (WebCore):
+        (WebCore::IDBDatabaseBackendImpl::put):
+        (WebCore::IDBDatabaseBackendImpl::setIndexKeys):
+        (WebCore::IDBDatabaseBackendImpl::setIndexesReady):
+        (WebCore::IDBDatabaseBackendImpl::openCursor):
+        (WebCore::IDBDatabaseBackendImpl::count):
+        (WebCore::IDBDatabaseBackendImpl::deleteRange):
+        (WebCore::IDBDatabaseBackendImpl::clear):
+        * Modules/indexeddb/IDBDatabaseBackendImpl.h:
+        (IDBDatabaseBackendImpl):
+        * Modules/indexeddb/IDBDatabaseBackendInterface.h:
+        (WebCore):
+        (IDBDatabaseBackendInterface):
+
 2012-12-11  Roger Fong  <roger_f...@apple.com>
 
         Make Video Track compile on Windows in debug mode.

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (137380 => 137381)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp	2012-12-12 00:29:01 UTC (rev 137381)
@@ -338,7 +338,46 @@
     m_transactions.get(transactionId)->abort();
 }
 
+void IDBDatabaseBackendImpl::get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, bool keyOnly, PassRefPtr<IDBCallbacks>)
+{
+    ASSERT_NOT_REACHED();
+}
 
+void IDBDatabaseBackendImpl::put(int64_t transactionId, int64_t objectStoreId, const Vector<uint8_t>&, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void IDBDatabaseBackendImpl::setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void IDBDatabaseBackendImpl::setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void IDBDatabaseBackendImpl::openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, bool keyOnly, TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void IDBDatabaseBackendImpl::count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void IDBDatabaseBackendImpl::deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void IDBDatabaseBackendImpl::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>)
+{
+    ASSERT_NOT_REACHED();
+}
+
 void IDBDatabaseBackendImpl::DeleteObjectStoreOperation::perform(IDBTransactionBackendImpl* transaction)
 {
     IDB_TRACE("DeleteObjectStoreOperation");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h (137380 => 137381)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h	2012-12-12 00:29:01 UTC (rev 137381)
@@ -78,6 +78,15 @@
     void transactionFinishedAndCompleteFired(PassRefPtr<IDBTransactionBackendImpl>);
     void transactionFinishedAndAbortFired(PassRefPtr<IDBTransactionBackendImpl>);
 
+    virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, bool keyOnly, PassRefPtr<IDBCallbacks>) OVERRIDE;
+    virtual void put(int64_t transactionId, int64_t objectStoreId, const Vector<uint8_t>&, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE;
+    virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE;
+    virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds) OVERRIDE;
+    virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, unsigned short direction, bool keyOnly, TaskType, PassRefPtr<IDBCallbacks>) OVERRIDE;
+    virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) OVERRIDE;
+    virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) OVERRIDE;
+    virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>) OVERRIDE;
+
 private:
     IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h (137380 => 137381)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h	2012-12-12 00:29:01 UTC (rev 137381)
@@ -37,14 +37,15 @@
 
 class IDBCallbacks;
 class IDBDatabaseCallbacks;
+class IDBKey;
 class IDBKeyPath;
+class IDBKeyRange;
 class IDBObjectStoreBackendInterface;
 class IDBTransactionBackendInterface;
 struct IDBDatabaseMetadata;
 
 typedef int ExceptionCode;
 
-// 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.
@@ -64,6 +65,30 @@
     // Transaction-specific operations.
     virtual void commit(int64_t transactionId) = 0;
     virtual void abort(int64_t transactionId) = 0;
+
+    enum TaskType {
+        NormalTask = 0,
+        PreemptiveTask
+    };
+
+    enum PutMode {
+        AddOrUpdate,
+        AddOnly,
+        CursorUpdate
+    };
+
+    typedef Vector<RefPtr<IDBKey> > IndexKeys;
+
+    virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, bool keyOnly, PassRefPtr<IDBCallbacks>) = 0;
+    virtual void put(int64_t transactionId, int64_t objectStoreId, const Vector<uint8_t>&, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) = 0;
+    virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) = 0;
+    virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds) = 0;
+    virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, unsigned short direction, bool keyOnly, TaskType, PassRefPtr<IDBCallbacks>) = 0;
+    virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0;
+    virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0;
+    virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>) = 0;
+
+
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/chromium/ChangeLog (137380 => 137381)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-12-12 00:29:01 UTC (rev 137381)
@@ -1,3 +1,49 @@
+2012-12-11  Alec Flett  <alecfl...@chromium.org>
+
+        IndexedDB: Stub out data operations on IDBDatabaseBackendInterface
+        https://bugs.webkit.org/show_bug.cgi?id=104592
+
+        Reviewed by Dimitri Glazkov.
+
+        Stub out chromium side of data operations for refactor.
+
+        * public/WebIDBDatabase.h:
+        (WebKit):
+        (WebKit::WebIDBDatabase::get):
+        (WebKit::WebIDBDatabase::put):
+        (WebKit::WebIDBDatabase::setIndexKeys):
+        (WebKit::WebIDBDatabase::setIndexesReady):
+        (WebKit::WebIDBDatabase::openCursor):
+        (WebKit::WebIDBDatabase::count):
+        (WebKit::WebIDBDatabase::deleteRange):
+        (WebKit::WebIDBDatabase::clear):
+        (WebIDBDatabase):
+        * src/IDBDatabaseBackendProxy.cpp:
+        (WebKit::IDBDatabaseBackendProxy::openCursor):
+        (WebKit):
+        (WebKit::IDBDatabaseBackendProxy::count):
+        (WebKit::IDBDatabaseBackendProxy::get):
+        (WebKit::IDBDatabaseBackendProxy::put):
+        (WebKit::IDBDatabaseBackendProxy::setIndexKeys):
+        (WebKit::IDBDatabaseBackendProxy::setIndexesReady):
+        (WebKit::IDBDatabaseBackendProxy::deleteRange):
+        (WebKit::IDBDatabaseBackendProxy::clear):
+        * src/IDBDatabaseBackendProxy.h:
+        (IDBDatabaseBackendProxy):
+        * src/WebIDBDatabaseImpl.cpp:
+        (WebKit):
+        (WebKit::WebIDBDatabaseImpl::openCursor):
+        (WebKit::WebIDBDatabaseImpl::count):
+        (WebKit::WebIDBDatabaseImpl::get):
+        (WebKit::WebIDBDatabaseImpl::put):
+        (WebKit::WebIDBDatabaseImpl::setIndexKeys):
+        (WebKit::WebIDBDatabaseImpl::setIndexesReady):
+        (WebKit::WebIDBDatabaseImpl::deleteRange):
+        (WebKit::WebIDBDatabaseImpl::clear):
+        * src/WebIDBDatabaseImpl.h:
+        (WebIDBDatabaseImpl):
+        * tests/IDBDatabaseBackendTest.cpp:
+
 2012-12-11  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r137330.

Modified: trunk/Source/WebKit/chromium/public/WebIDBDatabase.h (137380 => 137381)


--- trunk/Source/WebKit/chromium/public/WebIDBDatabase.h	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/public/WebIDBDatabase.h	2012-12-12 00:29:01 UTC (rev 137381)
@@ -29,6 +29,7 @@
 #include "WebDOMStringList.h"
 #include "WebExceptionCode.h"
 #include "WebIDBMetadata.h"
+#include "WebIDBTransaction.h"
 #include "platform/WebCommon.h"
 
 namespace WebKit {
@@ -36,7 +37,9 @@
 class WebFrame;
 class WebIDBCallbacks;
 class WebIDBDatabaseCallbacks;
+class WebIDBKey;
 class WebIDBKeyPath;
+class WebIDBKeyRange;
 class WebIDBObjectStore;
 class WebIDBTransaction;
 
@@ -65,6 +68,28 @@
     virtual void abort(long long transactionId) { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void commit(long long transactionId) { WEBKIT_ASSERT_NOT_REACHED(); }
 
+    enum TaskType {
+        NormalTask = 0,
+        PreemptiveTask
+    };
+
+    enum PutMode {
+        AddOrUpdate,
+        AddOnly,
+        CursorUpdate
+    };
+
+    typedef WebVector<WebIDBKey> WebIndexKeys;
+
+    virtual void get(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, bool keyOnly, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void put(long long transactionId, long long objectStoreId, const WebVector<unsigned char>& value, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void setIndexKeys(long long transactionId, long long objectStoreId, const WebIDBKey&, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void setIndexesReady(long long transactionId, long long objectStoreId, const WebVector<long long>& indexIds) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void openCursor(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, unsigned short direction, bool keyOnly, TaskType, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void count(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void deleteRange(long long transactionId, long long objectStoreId, const WebIDBKeyRange&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void clear(long long transactionId, long long objectStoreId, WebIDBCallbacks*)  { WEBKIT_ASSERT_NOT_REACHED(); }
+
 protected:
     WebIDBDatabase() { }
 };

Modified: trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp (137380 => 137381)


--- trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp	2012-12-12 00:29:01 UTC (rev 137381)
@@ -31,6 +31,7 @@
 #include "DOMStringList.h"
 #include "IDBCallbacks.h"
 #include "IDBDatabaseCallbacks.h"
+#include "IDBKeyRange.h"
 #include "IDBMetadata.h"
 #include "IDBObjectStoreBackendProxy.h"
 #include "IDBTransactionBackendProxy.h"
@@ -40,6 +41,7 @@
 #include "WebIDBDatabase.h"
 #include "WebIDBDatabaseCallbacksImpl.h"
 #include "WebIDBDatabaseError.h"
+#include "WebIDBKeyRange.h"
 #include "WebIDBObjectStore.h"
 #include "WebIDBTransaction.h"
 
@@ -109,7 +111,53 @@
     m_webIDBDatabase->abort(transactionId);
 }
 
+void IDBDatabaseBackendProxy::openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, bool keyOnly, TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
+{
+    m_webIDBDatabase->openCursor(transactionId, objectStoreId, indexId, keyRange, static_cast<WebIDBCursor::Direction>(direction), keyOnly, static_cast<WebIDBDatabase::TaskType>(taskType), new WebIDBCallbacksImpl(callbacks));
+}
 
+void IDBDatabaseBackendProxy::count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->count(transactionId, objectStoreId, indexId, keyRange, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBDatabaseBackendProxy::get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBCallbacks> callbacks)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->get(transactionId, objectStoreId, indexId, keyRange, keyOnly, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId, const Vector<uint8_t>& buffer, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->put(transactionId, objectStoreId, buffer, key, static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), indexIds, indexKeys);
+}
+
+void IDBDatabaseBackendProxy::setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> primaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->setIndexKeys(transactionId, objectStoreId, primaryKey, indexIds, indexKeys);
+}
+
+void IDBDatabaseBackendProxy::setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->setIndexesReady(transactionId, objectStoreId, indexIds);
+}
+
+void IDBDatabaseBackendProxy::deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->deleteRange(transactionId, objectStoreId, keyRange, new WebIDBCallbacksImpl(callbacks));
+}
+
+void IDBDatabaseBackendProxy::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
+{
+    if (m_webIDBDatabase)
+        m_webIDBDatabase->clear(transactionId, objectStoreId, new WebIDBCallbacksImpl(callbacks));
+}
+
 void IDBDatabaseBackendProxy::close(PassRefPtr<IDBDatabaseCallbacks>)
 {
     m_webIDBDatabase->close();

Modified: trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h (137380 => 137381)


--- trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h	2012-12-12 00:29:01 UTC (rev 137381)
@@ -54,6 +54,15 @@
     virtual void commit(int64_t);
     virtual void abort(int64_t);
 
+    virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, bool keyOnly, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void put(int64_t transactionId, int64_t objectStoreId, const Vector<uint8_t>& value, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE;
+    virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE;
+    virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds) OVERRIDE;
+    virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, unsigned short direction, bool keyOnly, TaskType, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+    virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<WebCore::IDBCallbacks>) OVERRIDE;
+
 private:
     IDBDatabaseBackendProxy(PassOwnPtr<WebIDBDatabase>);
 

Modified: trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp (137380 => 137381)


--- trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp	2012-12-12 00:29:01 UTC (rev 137381)
@@ -32,11 +32,13 @@
 #include "IDBCallbacksProxy.h"
 #include "IDBDatabaseBackendInterface.h"
 #include "IDBDatabaseCallbacksProxy.h"
+#include "IDBKeyRange.h"
 #include "IDBMetadata.h"
 #include "IDBObjectStoreBackendInterface.h"
 #include "IDBTransactionBackendInterface.h"
 #include "WebIDBCallbacks.h"
 #include "WebIDBDatabaseCallbacks.h"
+#include "WebIDBKeyRange.h"
 #include "WebIDBMetadata.h"
 #include "WebIDBObjectStoreImpl.h"
 #include "WebIDBTransactionImpl.h"
@@ -126,6 +128,89 @@
         m_databaseBackend->commit(transactionId);
 }
 
+
+void WebIDBDatabaseImpl::openCursor(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange& keyRange, unsigned short direction, bool keyOnly, TaskType taskType, WebIDBCallbacks* callbacks)
+{
+    if (m_databaseBackend)
+        m_databaseBackend->openCursor(transactionId, objectStoreId, indexId, keyRange, static_cast<IDBCursor::Direction>(direction), keyOnly, static_cast<IDBDatabaseBackendInterface::TaskType>(taskType), IDBCallbacksProxy::create(adoptPtr(callbacks)));
+}
+
+void WebIDBDatabaseImpl::count(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks)
+{
+    if (m_databaseBackend)
+        m_databaseBackend->count(transactionId, objectStoreId, indexId, keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)));
+}
+
+void WebIDBDatabaseImpl::get(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange& keyRange, bool keyOnly, WebIDBCallbacks* callbacks)
+{
+    if (m_databaseBackend)
+        m_databaseBackend->get(transactionId, objectStoreId, indexId, keyRange, keyOnly, IDBCallbacksProxy::create(adoptPtr(callbacks)));
+}
+
+void WebIDBDatabaseImpl::put(long long transactionId, long long objectStoreId, const WebVector<unsigned char>& value, const WebIDBKey& key, PutMode putMode, WebIDBCallbacks* callbacks, const WebVector<long long>& webIndexIds, const WebVector<WebIndexKeys>& webIndexKeys)
+{
+    if (!m_databaseBackend)
+        return;
+
+    ASSERT(webIndexIds.size() == webIndexKeys.size());
+    Vector<int64_t> indexIds(webIndexIds.size());
+    Vector<IDBObjectStoreBackendInterface::IndexKeys> indexKeys(webIndexKeys.size());
+
+    for (size_t i = 0; i < webIndexIds.size(); ++i) {
+        indexIds[i] = webIndexIds[i];
+        Vector<RefPtr<IDBKey> > indexKeyList(webIndexKeys[i].size());
+        for (size_t j = 0; j < webIndexKeys[i].size(); ++j)
+            indexKeyList[j] = webIndexKeys[i][j];
+        indexKeys[i] = indexKeyList;
+    }
+
+    Vector<uint8_t> valueBuffer;
+    valueBuffer.append(value.data(), value.size());
+    m_databaseBackend->put(transactionId, objectStoreId, valueBuffer, key, static_cast<IDBDatabaseBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), indexIds, indexKeys);
+}
+
+void WebIDBDatabaseImpl::setIndexKeys(long long transactionId, long long objectStoreId, const WebIDBKey& primaryKey, const WebVector<long long>& webIndexIds, const WebVector<WebIndexKeys>& webIndexKeys)
+{
+    if (!m_databaseBackend)
+        return;
+
+    ASSERT(webIndexIds.size() == webIndexKeys.size());
+    Vector<int64_t> indexIds(webIndexIds.size());
+    Vector<IDBObjectStoreBackendInterface::IndexKeys> indexKeys(webIndexKeys.size());
+
+    for (size_t i = 0; i < webIndexIds.size(); ++i) {
+        indexIds[i] = webIndexIds[i];
+        Vector<RefPtr<IDBKey> > indexKeyList(webIndexKeys[i].size());
+        for (size_t j = 0; j < webIndexKeys[i].size(); ++j)
+            indexKeyList[j] = webIndexKeys[i][j];
+        indexKeys[i] = indexKeyList;
+    }
+    m_databaseBackend->setIndexKeys(transactionId, objectStoreId, primaryKey, indexIds, indexKeys);
+}
+
+void WebIDBDatabaseImpl::setIndexesReady(long long transactionId, long long objectStoreId, const WebVector<long long>& webIndexIds)
+{
+    if (!m_databaseBackend)
+        return;
+
+    Vector<int64_t> indexIds(webIndexIds.size());
+    for (size_t i = 0; i < webIndexIds.size(); ++i)
+        indexIds[i] = webIndexIds[i];
+    m_databaseBackend->setIndexesReady(transactionId, objectStoreId, indexIds);
+}
+
+void WebIDBDatabaseImpl::deleteRange(long long transactionId, long long objectStoreId, const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks)
+{
+    if (m_databaseBackend)
+        m_databaseBackend->deleteRange(transactionId, objectStoreId, keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)));
+}
+
+void WebIDBDatabaseImpl::clear(long long transactionId, long long objectStoreId, WebIDBCallbacks* callbacks)
+{
+    if (m_databaseBackend)
+        m_databaseBackend->clear(transactionId, objectStoreId, IDBCallbacksProxy::create(adoptPtr(callbacks)));
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(INDEXED_DATABASE)

Modified: trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h (137380 => 137381)


--- trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h	2012-12-12 00:29:01 UTC (rev 137381)
@@ -29,9 +29,10 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "IDBDatabaseCallbacksProxy.h"
-#include "platform/WebCommon.h"
 #include "WebExceptionCode.h"
 #include "WebIDBDatabase.h"
+#include "WebIDBTransaction.h"
+#include "platform/WebCommon.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
@@ -62,6 +63,15 @@
     virtual void abort(long long transactionId);
     virtual void commit(long long transactionId);
 
+    virtual void get(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, bool keyOnly, WebIDBCallbacks*) OVERRIDE;
+    virtual void put(long long transactionId, long long objectStoreId, const WebVector<unsigned char>& value, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) OVERRIDE;
+    virtual void setIndexKeys(long long transactionId, long long objectStoreId, const WebIDBKey&, const WebVector<long long>& indexIds, const WebVector<WebIndexKeys>&) OVERRIDE;
+    virtual void setIndexesReady(long long transactionId, long long objectStoreId, const WebVector<long long>& indexIds) OVERRIDE;
+    virtual void openCursor(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, unsigned short direction, bool keyOnly, TaskType, WebIDBCallbacks*) OVERRIDE;
+    virtual void count(long long transactionId, long long objectStoreId, long long indexId, const WebIDBKeyRange&, WebIDBCallbacks*) OVERRIDE;
+    virtual void deleteRange(long long transactionId, long long objectStoreId, const WebIDBKeyRange&, WebIDBCallbacks*) OVERRIDE;
+    virtual void clear(long long transactionId, long long objectStoreId, WebIDBCallbacks*) OVERRIDE;
+
 private:
     WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend;
     WTF::RefPtr<IDBDatabaseCallbacksProxy> m_databaseCallbacks;

Modified: trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp (137380 => 137381)


--- trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp	2012-12-12 00:28:07 UTC (rev 137380)
+++ trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp	2012-12-12 00:29:01 UTC (rev 137381)
@@ -155,18 +155,27 @@
     virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) { }
     virtual void deleteObjectStore(int64_t, IDBTransactionBackendInterface*, ExceptionCode&) { }
     // FIXME: Remove this method in https://bugs.webkit.org/show_bug.cgi?id=103923.
-    virtual PassRefPtr<IDBTransactionBackendInterface> createTransaction(int64_t, const Vector<int64_t>&, IDBTransaction::Mode) { return 0; }
-    void createTransaction(int64_t, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, unsigned short mode) { }
+    virtual PassRefPtr<IDBTransactionBackendInterface> createTransaction(int64_t, const Vector<int64_t>&, IDBTransaction::Mode) OVERRIDE { return 0; }
+    virtual void createTransaction(int64_t, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, unsigned short mode) OVERRIDE { }
 
-    virtual void close(PassRefPtr<IDBDatabaseCallbacks>)
+    virtual void close(PassRefPtr<IDBDatabaseCallbacks>) OVERRIDE
     {
         m_wasCloseCalled = true;
         m_webDatabase.close();
     }
 
-    virtual void abort(int64_t transactionId) { }
-    virtual void commit(int64_t transactionId) { }
+    virtual void abort(int64_t transactionId) OVERRIDE { }
+    virtual void commit(int64_t transactionId) OVERRIDE { }
 
+    virtual void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, unsigned short direction, bool keyOnly, TaskType, PassRefPtr<IDBCallbacks>) OVERRIDE { }
+    virtual void count(int64_t objectStoreId, int64_t indexId, int64_t transactionId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) OVERRIDE { }
+    virtual void get(int64_t objectStoreId, int64_t indexId, int64_t transactionId, PassRefPtr<IDBKeyRange>, bool keyOnly, PassRefPtr<IDBCallbacks>) OVERRIDE { }
+    virtual void put(int64_t transactionId, int64_t objectStoreId, const Vector<uint8_t>&, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE { }
+    virtual void setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE { }
+    virtual void setIndexesReady(int64_t transactionId, int64_t objectStoreId, const Vector<int64_t>& indexIds) OVERRIDE { }
+    virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) OVERRIDE { }
+    virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>) OVERRIDE { }
+
 private:
     MockIDBDatabaseBackendProxy(WebIDBDatabaseImpl& webDatabase)
         : m_wasCloseCalled(false)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to