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

Unified Diff: content/renderer/indexed_db_dispatcher.cc

Issue 8400061: IndexedDB: Recycle cursor objects when calling continue(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More style nits fixed Created 9 years, 1 month 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
« no previous file with comments | « content/renderer/indexed_db_dispatcher.h ('k') | content/renderer/renderer_webidbcursor_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..115e2b2389d6e732cc7c25fd22ee7bcf236e1ff8 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,
@@ -379,6 +381,10 @@ void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks(
pending_transaction_callbacks_.AddWithID(callbacks, id);
}
+void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) {
+ cursors_.erase(cursor_id);
+}
+
int32 IndexedDBDispatcher::TransactionId(
const WebIDBTransaction& transaction) {
const RendererWebIDBTransactionImpl* impl =
@@ -426,15 +432,35 @@ void IndexedDBDispatcher::OnSuccessSerializedScriptValue(
}
void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id,
- int32 object_id, const IndexedDBKey& key, const IndexedDBKey& primaryKey,
+ int32 object_id, const IndexedDBKey& key, const IndexedDBKey& primary_key,
const content::SerializedScriptValue& value) {
WebIDBCallbacks* callbacks =
pending_callbacks_.Lookup(repsonse_id);
- callbacks->onSuccess(new RendererWebIDBCursorImpl(object_id, key,
- primaryKey, value));
+
+ RendererWebIDBCursorImpl* cursor = new RendererWebIDBCursorImpl(object_id);
+ cursors_[object_id] = cursor;
+ cursor->SetKeyAndValue(key, primary_key, value);
+ callbacks->onSuccess(cursor);
+
pending_callbacks_.Remove(repsonse_id);
}
+void IndexedDBDispatcher::OnSuccessCursorContinue(
+ int32 response_id,
+ int32 cursor_id,
+ const IndexedDBKey& key,
+ const IndexedDBKey& primary_key,
+ const content::SerializedScriptValue& value) {
+ RendererWebIDBCursorImpl* cursor = cursors_[cursor_id];
+ DCHECK(cursor);
+ cursor->SetKeyAndValue(key, primary_key, value);
+
+ WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
+ callbacks->onSuccessWithContinuation();
+
+ pending_callbacks_.Remove(response_id);
+}
+
void IndexedDBDispatcher::OnBlocked(int32 response_id) {
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
callbacks->onBlocked();
« no previous file with comments | « content/renderer/indexed_db_dispatcher.h ('k') | content/renderer/renderer_webidbcursor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698