Index: content/renderer/indexed_db_dispatcher.cc |
diff --git a/content/renderer/indexed_db_dispatcher.cc b/content/renderer/indexed_db_dispatcher.cc |
index c3eea0e949e87aa64a1326f261f215cdc2ec8a60..e2b7d304719b16281dc93f83c1932568f4069433 100644 |
--- a/content/renderer/indexed_db_dispatcher.cc |
+++ b/content/renderer/indexed_db_dispatcher.cc |
@@ -42,6 +42,8 @@ bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, |
OnSuccessOpenCursor) |
+ IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinue, |
+ OnSuccessCursorContinue) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, |
OnSuccessIDBDatabase) |
IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, |
@@ -85,10 +87,13 @@ void IndexedDBDispatcher::RequestIDBCursorContinue( |
scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
int32 response_id = pending_callbacks_.Add(callbacks.release()); |
+ pending_cursor_continues_[response_id] = idb_cursor_id; |
RenderThreadImpl::current()->Send( |
new IndexedDBHostMsg_CursorContinue(idb_cursor_id, response_id, key, ec)); |
- if (*ec) |
+ if (*ec) { |
pending_callbacks_.Remove(response_id); |
+ pending_cursor_continues_.erase(idb_cursor_id); |
+ } |
} |
void IndexedDBDispatcher::RequestIDBCursorDelete( |
@@ -432,9 +437,32 @@ void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id, |
pending_callbacks_.Lookup(repsonse_id); |
callbacks->onSuccess(new RendererWebIDBCursorImpl(object_id, key, |
primaryKey, value)); |
dgrogan
2011/10/29 00:54:28
You can remove the non-object_id parameters.
hans
2011/10/31 16:11:52
Done.
|
+ |
+ cursor_key_[object_id] = key; |
dgrogan
2011/10/29 00:54:28
If the onSuccess call is synchronous, shouldn't th
hans
2011/10/31 16:11:52
It's not synchronous, but it certainly looks weird
|
+ cursor_primary_key_[object_id] = primaryKey; |
+ cursor_value_[object_id] = value; |
+ |
pending_callbacks_.Remove(repsonse_id); |
} |
+void IndexedDBDispatcher::OnSuccessCursorContinue( |
+ int32 response_id, |
michaeln
2011/10/30 21:54:06
cursor_id could be a useful here, i think you woul
hans
2011/10/31 16:11:52
Done.
|
+ const IndexedDBKey& key, |
+ const IndexedDBKey& primary_key, |
+ const content::SerializedScriptValue& value) { |
+ int32 cursor_id = pending_cursor_continues_[response_id]; |
+ |
michaeln
2011/10/30 21:54:06
Is there any chance the cursor was deleted prior t
hans
2011/10/31 16:11:52
No, according to the comment in ~RendererWebIDBCur
|
+ cursor_key_[cursor_id] = key; |
+ cursor_primary_key_[cursor_id] = primary_key; |
+ cursor_value_[cursor_id] = value; |
michaeln
2011/10/30 21:54:06
The RendererWebIDBCursorImpl has data members for
hans
2011/10/31 16:11:52
Yes, doing that.
|
+ |
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
+ callbacks->onSuccessCursorContinue(); |
+ |
+ pending_callbacks_.Remove(response_id); |
+ pending_cursor_continues_.erase(response_id); |
+} |
+ |
void IndexedDBDispatcher::OnBlocked(int32 response_id) { |
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
callbacks->onBlocked(); |
@@ -470,3 +498,22 @@ void IndexedDBDispatcher::OnVersionChange(int32 database_id, |
if (callbacks) |
callbacks->onVersionChange(newVersion); |
} |
+ |
+IndexedDBKey IndexedDBDispatcher::getCursorKey(int32 cursor_id) { |
+ return cursor_key_[cursor_id]; |
+} |
+ |
+IndexedDBKey IndexedDBDispatcher::getCursorPrimaryKey(int32 cursor_id) { |
+ return cursor_primary_key_[cursor_id]; |
+} |
+ |
+content::SerializedScriptValue IndexedDBDispatcher::getCursorValue( |
+ int32 cursor_id) { |
+ return cursor_value_[cursor_id]; |
+} |
+ |
+void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) { |
+ cursor_key_.erase(cursor_id); |
+ cursor_primary_key_.erase(cursor_id); |
+ cursor_value_.erase(cursor_id); |
+} |