diff options
author | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-24 20:34:42 +0000 |
---|---|---|
committer | alecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-24 20:34:42 +0000 |
commit | bbe42cfd146b6b89eafc5064e4d0a25c779edf88 (patch) | |
tree | f4903c32878147fd9b46d3640c2d3597d454ae1b /content/common | |
parent | a388369d947de7f2562cd66781af8aa40c704bea (diff) | |
download | chromium_src-bbe42cfd146b6b89eafc5064e4d0a25c779edf88.zip chromium_src-bbe42cfd146b6b89eafc5064e4d0a25c779edf88.tar.gz chromium_src-bbe42cfd146b6b89eafc5064e4d0a25c779edf88.tar.bz2 |
IndexedDB: chromium side of IDBCursor.advance().
This just implements the proxy and IPC code for advance(), modeled after
IDBCursor.continue().
BUG=90647
Review URL: http://codereview.chromium.org/10197001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133757 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
5 files changed, 50 insertions, 0 deletions
diff --git a/content/common/indexed_db/indexed_db_dispatcher.cc b/content/common/indexed_db/indexed_db_dispatcher.cc index b725a7d..cc5d18c 100644 --- a/content/common/indexed_db/indexed_db_dispatcher.cc +++ b/content/common/indexed_db/indexed_db_dispatcher.cc @@ -80,6 +80,8 @@ void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, OnSuccessOpenCursor) + IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorAdvance, + OnSuccessCursorContinue) IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinue, OnSuccessCursorContinue) IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorPrefetch, @@ -136,6 +138,23 @@ void IndexedDBDispatcher::RequestIDBCursorUpdate( pending_callbacks_.Remove(response_id); } +void IndexedDBDispatcher::RequestIDBCursorAdvance( + unsigned long count, + WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id, + WebExceptionCode* ec) { + // Reset all cursor prefetch caches except for this cursor. + ResetCursorPrefetchCaches(idb_cursor_id); + + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + + int32 response_id = pending_callbacks_.Add(callbacks.release()); + Send(new IndexedDBHostMsg_CursorAdvance(idb_cursor_id, CurrentWorkerId(), + response_id, count, ec)); + if (*ec) + pending_callbacks_.Remove(response_id); +} + void IndexedDBDispatcher::RequestIDBCursorContinue( const IndexedDBKey& key, WebIDBCallbacks* callbacks_ptr, diff --git a/content/common/indexed_db/indexed_db_dispatcher.h b/content/common/indexed_db/indexed_db_dispatcher.h index bbaa19c..0b29349 100644 --- a/content/common/indexed_db/indexed_db_dispatcher.h +++ b/content/common/indexed_db/indexed_db_dispatcher.h @@ -86,6 +86,12 @@ class CONTENT_EXPORT IndexedDBDispatcher int32 idb_cursor_id, WebKit::WebExceptionCode* ec); + void RequestIDBCursorAdvance( + unsigned long count, + WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id, + WebKit::WebExceptionCode* ec); + void RequestIDBCursorContinue( const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr, diff --git a/content/common/indexed_db/indexed_db_messages.h b/content/common/indexed_db/indexed_db_messages.h index ef12c4a..b9d294bb 100644 --- a/content/common/indexed_db/indexed_db_messages.h +++ b/content/common/indexed_db/indexed_db_messages.h @@ -220,6 +220,9 @@ IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessIDBCursor, IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessCursorContinue, IndexedDBMsg_CallbacksSuccessCursorContinue_Params) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessCursorAdvance, + IndexedDBMsg_CallbacksSuccessCursorContinue_Params) + IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessCursorPrefetch, IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params) @@ -280,6 +283,14 @@ IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_CursorUpdate, content::SerializedScriptValue, /* value */ WebKit::WebExceptionCode /* ec */) +// WebIDBCursor::advance() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_CursorAdvance, + int32, /* idb_cursor_id */ + int32, /* thread_id */ + int32, /* response_id */ + unsigned long, /* count */ + WebKit::WebExceptionCode /* ec */) + // WebIDBCursor::continue() message. IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_CursorContinue, int32, /* idb_cursor_id */ diff --git a/content/common/indexed_db/proxy_webidbcursor_impl.cc b/content/common/indexed_db/proxy_webidbcursor_impl.cc index a86a74e..cf2260d 100644 --- a/content/common/indexed_db/proxy_webidbcursor_impl.cc +++ b/content/common/indexed_db/proxy_webidbcursor_impl.cc @@ -61,6 +61,17 @@ void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, content::SerializedScriptValue(value), callbacks, idb_cursor_id_, &ec); } +void RendererWebIDBCursorImpl::advance(unsigned long count, + WebIDBCallbacks* callbacks_ptr, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + IndexedDBDispatcher::ThreadSpecificInstance(); + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + ResetPrefetchCache(); + dispatcher->RequestIDBCursorAdvance(count, callbacks.release(), + idb_cursor_id_, &ec); +} + void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks_ptr, WebExceptionCode& ec) { diff --git a/content/common/indexed_db/proxy_webidbcursor_impl.h b/content/common/indexed_db/proxy_webidbcursor_impl.h index 31c8632..74265a8 100644 --- a/content/common/indexed_db/proxy_webidbcursor_impl.h +++ b/content/common/indexed_db/proxy_webidbcursor_impl.h @@ -27,6 +27,9 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor { virtual void update(const WebKit::WebSerializedScriptValue& value, WebKit::WebIDBCallbacks* callback, WebKit::WebExceptionCode& ec); + virtual void advance(unsigned long count, + WebKit::WebIDBCallbacks* callback, + WebKit::WebExceptionCode& ec); virtual void continueFunction(const WebKit::WebIDBKey& key, WebKit::WebIDBCallbacks* callback, WebKit::WebExceptionCode& ec); |