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

Side by Side Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 10830028: IndexedDB: Send cursor data along with success messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment tweaks and rebase Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/indexed_db/indexed_db_dispatcher.h" 5 #include "content/common/indexed_db/indexed_db_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h" 8 #include "base/threading/thread_local.h"
9 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
10 #include "content/common/indexed_db/indexed_db_messages.h" 10 #include "content/common/indexed_db/indexed_db_messages.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 const IndexedDBKey& primary_key = p.primary_key; 628 const IndexedDBKey& primary_key = p.primary_key;
629 const SerializedScriptValue& value = p.serialized_value; 629 const SerializedScriptValue& value = p.serialized_value;
630 630
631 WebIDBCallbacks* callbacks = 631 WebIDBCallbacks* callbacks =
632 pending_callbacks_.Lookup(response_id); 632 pending_callbacks_.Lookup(response_id);
633 if (!callbacks) 633 if (!callbacks)
634 return; 634 return;
635 635
636 RendererWebIDBCursorImpl* cursor = new RendererWebIDBCursorImpl(object_id); 636 RendererWebIDBCursorImpl* cursor = new RendererWebIDBCursorImpl(object_id);
637 cursors_[object_id] = cursor; 637 cursors_[object_id] = cursor;
638 // TODO(jsbell): Remove the next two calls after WK92278 rolls.
638 cursor->SetKeyAndValue(key, primary_key, value); 639 cursor->SetKeyAndValue(key, primary_key, value);
639 callbacks->onSuccess(cursor); 640 callbacks->onSuccess(cursor);
641 callbacks->onSuccess(cursor, key, primary_key, value);
640 642
641 pending_callbacks_.Remove(response_id); 643 pending_callbacks_.Remove(response_id);
642 } 644 }
643 645
644 void IndexedDBDispatcher::OnSuccessCursorContinue( 646 void IndexedDBDispatcher::OnSuccessCursorContinue(
645 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { 647 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) {
646 DCHECK_EQ(p.thread_id, CurrentWorkerId()); 648 DCHECK_EQ(p.thread_id, CurrentWorkerId());
647 int32 response_id = p.response_id; 649 int32 response_id = p.response_id;
648 int32 cursor_id = p.cursor_id; 650 int32 cursor_id = p.cursor_id;
649 const IndexedDBKey& key = p.key; 651 const IndexedDBKey& key = p.key;
650 const IndexedDBKey& primary_key = p.primary_key; 652 const IndexedDBKey& primary_key = p.primary_key;
651 const SerializedScriptValue& value = p.serialized_value; 653 const SerializedScriptValue& value = p.serialized_value;
652 654
653 RendererWebIDBCursorImpl* cursor = cursors_[cursor_id]; 655 RendererWebIDBCursorImpl* cursor = cursors_[cursor_id];
654 DCHECK(cursor); 656 DCHECK(cursor);
657 // TODO(jsbell): Remove the next call after WK92278·rolls.
655 cursor->SetKeyAndValue(key, primary_key, value); 658 cursor->SetKeyAndValue(key, primary_key, value);
656 659
657 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); 660 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
658 if (!callbacks) 661 if (!callbacks)
659 return; 662 return;
663
664 // TODO(jsbell): Remove the ...WithContinuation call after WK92278 rolls.
660 callbacks->onSuccessWithContinuation(); 665 callbacks->onSuccessWithContinuation();
666 callbacks->onSuccess(key, primary_key, value);
661 667
662 pending_callbacks_.Remove(response_id); 668 pending_callbacks_.Remove(response_id);
663 } 669 }
664 670
665 void IndexedDBDispatcher::OnSuccessCursorPrefetch( 671 void IndexedDBDispatcher::OnSuccessCursorPrefetch(
666 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { 672 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) {
667 DCHECK_EQ(p.thread_id, CurrentWorkerId()); 673 DCHECK_EQ(p.thread_id, CurrentWorkerId());
668 int32 response_id = p.response_id; 674 int32 response_id = p.response_id;
669 int32 cursor_id = p.cursor_id; 675 int32 cursor_id = p.cursor_id;
670 const std::vector<IndexedDBKey>& keys = p.keys; 676 const std::vector<IndexedDBKey>& keys = p.keys;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 775 }
770 776
771 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { 777 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) {
772 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 778 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
773 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 779 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
774 if (i->first == exception_cursor_id) 780 if (i->first == exception_cursor_id)
775 continue; 781 continue;
776 i->second->ResetPrefetchCache(); 782 i->second->ResetPrefetchCache();
777 } 783 }
778 } 784 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.cc ('k') | content/common/indexed_db/proxy_webidbcursor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698