diff options
author | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 02:35:33 +0000 |
---|---|---|
committer | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 02:35:33 +0000 |
commit | 9fee277fa201cc1c1290dad08d5898130308cef4 (patch) | |
tree | f6f222ce99ee1dd57e0b4411ec79b723ae34985f /content/common | |
parent | 05b6a82cc9bb9215c8e86ce6113c537e9da1064d (diff) | |
download | chromium_src-9fee277fa201cc1c1290dad08d5898130308cef4.zip chromium_src-9fee277fa201cc1c1290dad08d5898130308cef4.tar.gz chromium_src-9fee277fa201cc1c1290dad08d5898130308cef4.tar.bz2 |
IndexedDB: Support get/getKey(keyRange)
This is the Chromium IPC plumbing to talk to the WebKit API.
This won't be used until https://bugs.webkit.org/show_bug.cgi?id=83638
is fixed.
BUG=92047
Review URL: http://codereview.chromium.org/10083053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
7 files changed, 144 insertions, 0 deletions
diff --git a/content/common/indexed_db/indexed_db_dispatcher.cc b/content/common/indexed_db/indexed_db_dispatcher.cc index a914f9e..ccb123f 100644 --- a/content/common/indexed_db/indexed_db_dispatcher.cc +++ b/content/common/indexed_db/indexed_db_dispatcher.cc @@ -369,6 +369,23 @@ void IndexedDBDispatcher::RequestIDBIndexGetObject( pending_callbacks_.Remove(response_id); } +void IndexedDBDispatcher::RequestIDBIndexGetObjectByRange( + const IndexedDBKeyRange& key_range, + WebIDBCallbacks* callbacks_ptr, + int32 idb_index_id, + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { + ResetCursorPrefetchCaches(); + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); + Send(new IndexedDBHostMsg_IndexGetObjectByRange( + idb_index_id, CurrentWorkerId(), + response_id, key_range, + TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); +} + void IndexedDBDispatcher::RequestIDBIndexGetKey( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, @@ -385,6 +402,22 @@ void IndexedDBDispatcher::RequestIDBIndexGetKey( pending_callbacks_.Remove(response_id); } +void IndexedDBDispatcher::RequestIDBIndexGetKeyByRange( + const IndexedDBKeyRange& key_range, + WebIDBCallbacks* callbacks_ptr, + int32 idb_index_id, + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { + ResetCursorPrefetchCaches(); + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + int32 response_id = pending_callbacks_.Add(callbacks.release()); + Send(new IndexedDBHostMsg_IndexGetKeyByRange( + idb_index_id, CurrentWorkerId(), response_id, key_range, + TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); +} + void IndexedDBDispatcher::RequestIDBObjectStoreGet( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, @@ -402,6 +435,23 @@ void IndexedDBDispatcher::RequestIDBObjectStoreGet( pending_callbacks_.Remove(response_id); } +void IndexedDBDispatcher::RequestIDBObjectStoreGetByRange( + const IndexedDBKeyRange& key_range, + WebIDBCallbacks* callbacks_ptr, + int32 idb_object_store_id, + const WebIDBTransaction& transaction, + WebExceptionCode* ec) { + ResetCursorPrefetchCaches(); + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + + int32 response_id = pending_callbacks_.Add(callbacks.release()); + Send(new IndexedDBHostMsg_ObjectStoreGetByRange( + idb_object_store_id, CurrentWorkerId(), response_id, + key_range, TransactionId(transaction), ec)); + if (*ec) + pending_callbacks_.Remove(response_id); +} + void IndexedDBDispatcher::RequestIDBObjectStorePut( const content::SerializedScriptValue& value, const IndexedDBKey& key, diff --git a/content/common/indexed_db/indexed_db_dispatcher.h b/content/common/indexed_db/indexed_db_dispatcher.h index 761c035..5c6d705 100644 --- a/content/common/indexed_db/indexed_db_dispatcher.h +++ b/content/common/indexed_db/indexed_db_dispatcher.h @@ -148,18 +148,39 @@ class CONTENT_EXPORT IndexedDBDispatcher const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode* ec); + void RequestIDBIndexGetObjectByRange( + const IndexedDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + int32 idb_index_id, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); + void RequestIDBIndexGetKey(const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, int32 idb_index_id, const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode* ec); + void RequestIDBIndexGetKeyByRange( + const IndexedDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + int32 idb_index_id, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); + void RequestIDBObjectStoreGet(const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks, int32 idb_object_store_id, const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode* ec); + void RequestIDBObjectStoreGetByRange( + const IndexedDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + int32 idb_object_store_id, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode* ec); + void RequestIDBObjectStorePut(const content::SerializedScriptValue& value, const IndexedDBKey& key, WebKit::WebIDBObjectStore::PutMode putMode, diff --git a/content/common/indexed_db/indexed_db_messages.h b/content/common/indexed_db/indexed_db_messages.h index 6ca348f..f24e79a 100644 --- a/content/common/indexed_db/indexed_db_messages.h +++ b/content/common/indexed_db/indexed_db_messages.h @@ -433,6 +433,15 @@ IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetObject, int32, /* transaction_id */ WebKit::WebExceptionCode /* ec */) +// WebIDBIndex::getObjectByRange() message. +IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetObjectByRange, + int32, /* idb_index_id */ + int32, /* thread_id */ + int32, /* response_id */ + IndexedDBKeyRange, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + // WebIDBIndex::getKey() message. IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetKey, int32, /* idb_index_id */ @@ -442,6 +451,15 @@ IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetKey, int32, /* transaction_id */ WebKit::WebExceptionCode /* ec */) +// WebIDBIndex::getKeyByRange() message. +IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_IndexGetKeyByRange, + int32, /* idb_index_id */ + int32, /* thread_id */ + int32, /* response_id */ + IndexedDBKeyRange, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + // WebIDBIndex::~WebIDBIndex() message. IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_IndexDestroyed, int32 /* idb_index_id */) @@ -470,6 +488,15 @@ IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_ObjectStoreGet, int32, /* transaction_id */ WebKit::WebExceptionCode /* ec */) +// WebIDBObjectStore::get() message. +IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_ObjectStoreGetByRange, + int32, /* idb_object_store_id */ + int32, /* thread_id */ + int32, /* response_id */ + IndexedDBKeyRange, /* key_range */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + // WebIDBObjectStore::put() message. IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStorePut, IndexedDBHostMsg_ObjectStorePut_Params, diff --git a/content/common/indexed_db/proxy_webidbindex_impl.cc b/content/common/indexed_db/proxy_webidbindex_impl.cc index af9034d..9171e27 100644 --- a/content/common/indexed_db/proxy_webidbindex_impl.cc +++ b/content/common/indexed_db/proxy_webidbindex_impl.cc @@ -110,6 +110,17 @@ void RendererWebIDBIndexImpl::getObject( IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); } +void RendererWebIDBIndexImpl::getObject( + const WebKit::WebIDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + IndexedDBDispatcher::ThreadSpecificInstance(); + dispatcher->RequestIDBIndexGetObjectByRange( + IndexedDBKeyRange(key_range), callbacks, idb_index_id_, transaction, &ec); +} + void RendererWebIDBIndexImpl::getKey( const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, @@ -120,3 +131,14 @@ void RendererWebIDBIndexImpl::getKey( dispatcher->RequestIDBIndexGetKey( IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); } + +void RendererWebIDBIndexImpl::getKey( + const WebKit::WebIDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + const WebKit::WebIDBTransaction& transaction, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + IndexedDBDispatcher::ThreadSpecificInstance(); + dispatcher->RequestIDBIndexGetKeyByRange( + IndexedDBKeyRange(key_range), callbacks, idb_index_id_, transaction, &ec); +} diff --git a/content/common/indexed_db/proxy_webidbindex_impl.h b/content/common/indexed_db/proxy_webidbindex_impl.h index 59eafb2..a5e3dda 100644 --- a/content/common/indexed_db/proxy_webidbindex_impl.h +++ b/content/common/indexed_db/proxy_webidbindex_impl.h @@ -40,10 +40,18 @@ class RendererWebIDBIndexImpl : public WebKit::WebIDBIndex { WebKit::WebIDBCallbacks* callbacks, const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode& ec); + virtual void getObject(const WebKit::WebIDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void getKey(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callbacks, const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode& ec); + virtual void getKey(const WebKit::WebIDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); private: int32 idb_index_id_; diff --git a/content/common/indexed_db/proxy_webidbobjectstore_impl.cc b/content/common/indexed_db/proxy_webidbobjectstore_impl.cc index 1259bbc6..4bcfddf 100644 --- a/content/common/indexed_db/proxy_webidbobjectstore_impl.cc +++ b/content/common/indexed_db/proxy_webidbobjectstore_impl.cc @@ -80,6 +80,18 @@ void RendererWebIDBObjectStoreImpl::get( IndexedDBKey(key), callbacks, idb_object_store_id_, transaction, &ec); } +void RendererWebIDBObjectStoreImpl::get( + const WebIDBKeyRange& key_range, + WebIDBCallbacks* callbacks, + const WebIDBTransaction& transaction, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + IndexedDBDispatcher::ThreadSpecificInstance(); + dispatcher->RequestIDBObjectStoreGetByRange( + IndexedDBKeyRange(key_range), callbacks, + idb_object_store_id_, transaction, &ec); +} + void RendererWebIDBObjectStoreImpl::put( const WebSerializedScriptValue& value, const WebIDBKey& key, diff --git a/content/common/indexed_db/proxy_webidbobjectstore_impl.h b/content/common/indexed_db/proxy_webidbobjectstore_impl.h index 3c54907..610d698 100644 --- a/content/common/indexed_db/proxy_webidbobjectstore_impl.h +++ b/content/common/indexed_db/proxy_webidbobjectstore_impl.h @@ -32,6 +32,10 @@ class RendererWebIDBObjectStoreImpl : public WebKit::WebIDBObjectStore { WebKit::WebIDBCallbacks* callbacks, const WebKit::WebIDBTransaction& transaction, WebKit::WebExceptionCode& ec); + virtual void get(const WebKit::WebIDBKeyRange& key_range, + WebKit::WebIDBCallbacks* callbacks, + const WebKit::WebIDBTransaction& transaction, + WebKit::WebExceptionCode& ec); virtual void put(const WebKit::WebSerializedScriptValue& value, const WebKit::WebIDBKey& key, PutMode put_mode, |