Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 10197001: IndexedDB: chromium side of IDBCursor.advance(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Additional key/value/primarykey for the current cursor Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/indexed_db/indexed_db_dispatcher.cc
diff --git a/content/common/indexed_db/indexed_db_dispatcher.cc b/content/common/indexed_db/indexed_db_dispatcher.cc
index b725a7d7d400d3a7e9341bd69f2628320bd9c826..f3f4a27d68159847b091d91adc5fbb934d042c9e 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,
+ OnSuccessCursorAdvance)
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,
@@ -624,6 +643,19 @@ void IndexedDBDispatcher::OnSuccessOpenCursor(
pending_callbacks_.Remove(response_id);
}
+void IndexedDBDispatcher::OnSuccessCursorAdvance(
+ const IndexedDBMsg_CallbacksSuccessCursorAdvance_Params& p) {
+ DCHECK_EQ(p.thread_id, CurrentWorkerId());
+ int32 response_id = p.response_id;
jsbell 2012/04/24 15:41:08 This method is much simpler than OnSuccessCursorCo
alecflett 2012/04/24 16:34:22 Oops, I removed this as an experiment, and thought
+
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
+ if (!callbacks)
+ return;
+ callbacks->onSuccessWithContinuation();
+
+ pending_callbacks_.Remove(response_id);
+}
+
void IndexedDBDispatcher::OnSuccessCursorContinue(
const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) {
DCHECK_EQ(p.thread_id, CurrentWorkerId());

Powered by Google App Engine
This is Rietveld 408576698