OLD | NEW |
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 Loading... |
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. | |
639 cursor->SetKeyAndValue(key, primary_key, value); | |
640 callbacks->onSuccess(cursor); | |
641 callbacks->onSuccess(cursor, key, primary_key, value); | 638 callbacks->onSuccess(cursor, key, primary_key, value); |
642 | 639 |
643 pending_callbacks_.Remove(response_id); | 640 pending_callbacks_.Remove(response_id); |
644 } | 641 } |
645 | 642 |
646 void IndexedDBDispatcher::OnSuccessCursorContinue( | 643 void IndexedDBDispatcher::OnSuccessCursorContinue( |
647 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { | 644 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { |
648 DCHECK_EQ(p.thread_id, CurrentWorkerId()); | 645 DCHECK_EQ(p.thread_id, CurrentWorkerId()); |
649 int32 response_id = p.response_id; | 646 int32 response_id = p.response_id; |
650 int32 cursor_id = p.cursor_id; | 647 int32 cursor_id = p.cursor_id; |
651 const IndexedDBKey& key = p.key; | 648 const IndexedDBKey& key = p.key; |
652 const IndexedDBKey& primary_key = p.primary_key; | 649 const IndexedDBKey& primary_key = p.primary_key; |
653 const SerializedScriptValue& value = p.serialized_value; | 650 const SerializedScriptValue& value = p.serialized_value; |
654 | 651 |
655 RendererWebIDBCursorImpl* cursor = cursors_[cursor_id]; | 652 RendererWebIDBCursorImpl* cursor = cursors_[cursor_id]; |
656 DCHECK(cursor); | 653 DCHECK(cursor); |
657 // TODO(jsbell): Remove the next call after WK92278·rolls. | |
658 cursor->SetKeyAndValue(key, primary_key, value); | |
659 | 654 |
660 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | 655 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
661 if (!callbacks) | 656 if (!callbacks) |
662 return; | 657 return; |
663 | 658 |
664 // TODO(jsbell): Remove the ...WithContinuation call after WK92278 rolls. | |
665 callbacks->onSuccessWithContinuation(); | |
666 callbacks->onSuccess(key, primary_key, value); | 659 callbacks->onSuccess(key, primary_key, value); |
667 | 660 |
668 pending_callbacks_.Remove(response_id); | 661 pending_callbacks_.Remove(response_id); |
669 } | 662 } |
670 | 663 |
671 void IndexedDBDispatcher::OnSuccessCursorPrefetch( | 664 void IndexedDBDispatcher::OnSuccessCursorPrefetch( |
672 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { | 665 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { |
673 DCHECK_EQ(p.thread_id, CurrentWorkerId()); | 666 DCHECK_EQ(p.thread_id, CurrentWorkerId()); |
674 int32 response_id = p.response_id; | 667 int32 response_id = p.response_id; |
675 int32 cursor_id = p.cursor_id; | 668 int32 cursor_id = p.cursor_id; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 } | 768 } |
776 | 769 |
777 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 770 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
778 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 771 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
779 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 772 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
780 if (i->first == exception_cursor_id) | 773 if (i->first == exception_cursor_id) |
781 continue; | 774 continue; |
782 i->second->ResetPrefetchCache(); | 775 i->second->ResetPrefetchCache(); |
783 } | 776 } |
784 } | 777 } |
OLD | NEW |