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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
11 #include "content/common/child_thread.h" | 11 #include "content/common/child_thread.h" |
12 #include "content/common/indexed_db/indexed_db_messages.h" | 12 #include "content/common/indexed_db/indexed_db_messages.h" |
13 #include "content/common/indexed_db/proxy_webidbcursor_impl.h" | 13 #include "content/common/indexed_db/proxy_webidbcursor_impl.h" |
14 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" | 14 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" |
15 #include "ipc/ipc_channel.h" | 15 #include "ipc/ipc_channel.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac
ks.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti
on.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti
on.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" |
21 | 22 |
22 using WebKit::WebDOMStringList; | 23 using WebKit::WebDOMStringList; |
23 using WebKit::WebData; | 24 using WebKit::WebData; |
24 using WebKit::WebExceptionCode; | 25 using WebKit::WebExceptionCode; |
25 using WebKit::WebFrame; | 26 using WebKit::WebFrame; |
26 using WebKit::WebIDBCallbacks; | 27 using WebKit::WebIDBCallbacks; |
27 using WebKit::WebIDBDatabase; | 28 using WebKit::WebIDBDatabase; |
28 using WebKit::WebIDBDatabaseCallbacks; | 29 using WebKit::WebIDBDatabaseCallbacks; |
29 using WebKit::WebIDBDatabaseError; | 30 using WebKit::WebIDBDatabaseError; |
30 using WebKit::WebIDBKey; | 31 using WebKit::WebIDBKey; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 web_index_metadata.multiEntry = idb_index_metadata.multiEntry; | 125 web_index_metadata.multiEntry = idb_index_metadata.multiEntry; |
125 } | 126 } |
126 } | 127 } |
127 | 128 |
128 return web_metadata; | 129 return web_metadata; |
129 } | 130 } |
130 | 131 |
131 void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { | 132 void IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
132 bool handled = true; | 133 bool handled = true; |
133 IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) | 134 IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) |
| 135 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursorOld, |
| 136 OnSuccessOpenCursorOld) |
134 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, | 137 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, |
135 OnSuccessOpenCursor) | 138 OnSuccessOpenCursor) |
| 139 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorAdvanceOld, |
| 140 OnSuccessCursorContinueOld) |
136 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorAdvance, | 141 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorAdvance, |
137 OnSuccessCursorContinue) | 142 OnSuccessCursorContinue) |
| 143 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinueOld, |
| 144 OnSuccessCursorContinueOld) |
138 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinue, | 145 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorContinue, |
139 OnSuccessCursorContinue) | 146 OnSuccessCursorContinue) |
| 147 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorPrefetchOld, |
| 148 OnSuccessCursorPrefetchOld) |
140 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorPrefetch, | 149 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessCursorPrefetch, |
141 OnSuccessCursorPrefetch) | 150 OnSuccessCursorPrefetch) |
142 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, | 151 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, |
143 OnSuccessIDBDatabase) | 152 OnSuccessIDBDatabase) |
144 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, | 153 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, |
145 OnSuccessIndexedDBKey) | 154 OnSuccessIndexedDBKey) |
146 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, | 155 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, |
147 OnSuccessStringList) | 156 OnSuccessStringList) |
148 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, | 157 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, |
149 OnSuccessSerializedScriptValue) | 158 OnSuccessSerializedScriptValue) |
| 159 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValue, |
| 160 OnSuccessValue) |
150 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe
y, | 161 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe
y, |
151 OnSuccessSerializedScriptValueWithKey) | 162 OnSuccessSerializedScriptValueWithKey) |
| 163 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValueWithKey, |
| 164 OnSuccessValueWithKey) |
152 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, | 165 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, |
153 OnSuccessInteger) | 166 OnSuccessInteger) |
154 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, | 167 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, |
155 OnSuccessUndefined) | 168 OnSuccessUndefined) |
156 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) | 169 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
157 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) | 170 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) |
158 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) | 171 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) |
159 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, | 172 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, |
160 OnForcedClose) | 173 OnForcedClose) |
161 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, | 174 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 int32 ipc_thread_id, int32 ipc_response_id, | 582 int32 ipc_thread_id, int32 ipc_response_id, |
570 const SerializedScriptValue& value) { | 583 const SerializedScriptValue& value) { |
571 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 584 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
572 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); | 585 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
573 if (!callbacks) | 586 if (!callbacks) |
574 return; | 587 return; |
575 callbacks->onSuccess(WebSerializedScriptValue(value)); | 588 callbacks->onSuccess(WebSerializedScriptValue(value)); |
576 pending_callbacks_.Remove(ipc_response_id); | 589 pending_callbacks_.Remove(ipc_response_id); |
577 } | 590 } |
578 | 591 |
| 592 void IndexedDBDispatcher::OnSuccessValue( |
| 593 int32 ipc_thread_id, int32 ipc_response_id, |
| 594 const std::vector<char>& value) { |
| 595 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| 596 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
| 597 if (!callbacks) |
| 598 return; |
| 599 WebData web_value; |
| 600 if (value.size()) |
| 601 web_value.assign(&value.front(), value.size()); |
| 602 callbacks->onSuccess(web_value); |
| 603 pending_callbacks_.Remove(ipc_response_id); |
| 604 } |
| 605 |
579 void IndexedDBDispatcher::OnSuccessSerializedScriptValueWithKey( | 606 void IndexedDBDispatcher::OnSuccessSerializedScriptValueWithKey( |
580 int32 ipc_thread_id, int32 ipc_response_id, | 607 int32 ipc_thread_id, int32 ipc_response_id, |
581 const SerializedScriptValue& value, | 608 const SerializedScriptValue& value, |
582 const IndexedDBKey& primary_key, | 609 const IndexedDBKey& primary_key, |
583 const IndexedDBKeyPath& key_path) { | 610 const IndexedDBKeyPath& key_path) { |
584 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 611 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
585 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); | 612 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
586 if (!callbacks) | 613 if (!callbacks) |
587 return; | 614 return; |
588 callbacks->onSuccess(WebSerializedScriptValue(value), | 615 callbacks->onSuccess(WebSerializedScriptValue(value), |
589 primary_key, key_path); | 616 primary_key, key_path); |
590 pending_callbacks_.Remove(ipc_response_id); | 617 pending_callbacks_.Remove(ipc_response_id); |
591 } | 618 } |
592 | 619 |
| 620 void IndexedDBDispatcher::OnSuccessValueWithKey( |
| 621 int32 ipc_thread_id, int32 ipc_response_id, |
| 622 const std::vector<char>& value, |
| 623 const IndexedDBKey& primary_key, |
| 624 const IndexedDBKeyPath& key_path) { |
| 625 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| 626 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
| 627 if (!callbacks) |
| 628 return; |
| 629 WebData web_value; |
| 630 if (value.size()) |
| 631 web_value.assign(&value.front(), value.size()); |
| 632 callbacks->onSuccess(web_value, |
| 633 primary_key, key_path); |
| 634 pending_callbacks_.Remove(ipc_response_id); |
| 635 } |
| 636 |
593 void IndexedDBDispatcher::OnSuccessInteger( | 637 void IndexedDBDispatcher::OnSuccessInteger( |
594 int32 ipc_thread_id, int32 ipc_response_id, int64 value) { | 638 int32 ipc_thread_id, int32 ipc_response_id, int64 value) { |
595 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 639 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
596 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); | 640 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
597 if (!callbacks) | 641 if (!callbacks) |
598 return; | 642 return; |
599 callbacks->onSuccess(value); | 643 callbacks->onSuccess(value); |
600 pending_callbacks_.Remove(ipc_response_id); | 644 pending_callbacks_.Remove(ipc_response_id); |
601 } | 645 } |
602 | 646 |
603 void IndexedDBDispatcher::OnSuccessUndefined( | 647 void IndexedDBDispatcher::OnSuccessUndefined( |
604 int32 ipc_thread_id, int32 ipc_response_id) { | 648 int32 ipc_thread_id, int32 ipc_response_id) { |
605 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 649 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
606 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); | 650 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
607 if (!callbacks) | 651 if (!callbacks) |
608 return; | 652 return; |
609 callbacks->onSuccess(); | 653 callbacks->onSuccess(); |
610 pending_callbacks_.Remove(ipc_response_id); | 654 pending_callbacks_.Remove(ipc_response_id); |
611 } | 655 } |
612 | 656 |
613 void IndexedDBDispatcher::OnSuccessOpenCursor( | 657 void IndexedDBDispatcher::OnSuccessOpenCursorOld( |
614 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { | 658 const IndexedDBMsg_CallbacksSuccessIDBCursorOld_Params& p) { |
615 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); | 659 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
616 int32 ipc_response_id = p.ipc_response_id; | 660 int32 ipc_response_id = p.ipc_response_id; |
617 int32 ipc_object_id = p.ipc_cursor_id; | 661 int32 ipc_object_id = p.ipc_cursor_id; |
618 const IndexedDBKey& key = p.key; | 662 const IndexedDBKey& key = p.key; |
619 const IndexedDBKey& primary_key = p.primary_key; | 663 const IndexedDBKey& primary_key = p.primary_key; |
620 const SerializedScriptValue& value = p.serialized_value; | 664 const SerializedScriptValue& value = p.serialized_value; |
621 | 665 |
622 WebIDBCallbacks* callbacks = | 666 WebIDBCallbacks* callbacks = |
623 pending_callbacks_.Lookup(ipc_response_id); | 667 pending_callbacks_.Lookup(ipc_response_id); |
624 if (!callbacks) | 668 if (!callbacks) |
625 return; | 669 return; |
626 | 670 |
627 RendererWebIDBCursorImpl* cursor = | 671 RendererWebIDBCursorImpl* cursor = |
628 new RendererWebIDBCursorImpl(ipc_object_id); | 672 new RendererWebIDBCursorImpl(ipc_object_id); |
629 cursors_[ipc_object_id] = cursor; | 673 cursors_[ipc_object_id] = cursor; |
630 callbacks->onSuccess(cursor, key, primary_key, | 674 callbacks->onSuccess(cursor, key, primary_key, |
631 WebSerializedScriptValue(value)); | 675 WebSerializedScriptValue(value)); |
632 | 676 |
633 pending_callbacks_.Remove(ipc_response_id); | 677 pending_callbacks_.Remove(ipc_response_id); |
634 } | 678 } |
635 | 679 |
636 void IndexedDBDispatcher::OnSuccessCursorContinue( | 680 void IndexedDBDispatcher::OnSuccessOpenCursor( |
637 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { | 681 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { |
| 682 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
| 683 int32 ipc_response_id = p.ipc_response_id; |
| 684 int32 ipc_object_id = p.ipc_cursor_id; |
| 685 const IndexedDBKey& key = p.key; |
| 686 const IndexedDBKey& primary_key = p.primary_key; |
| 687 WebData web_value; |
| 688 if (p.value.size()) |
| 689 web_value.assign(&p.value.front(), p.value.size()); |
| 690 |
| 691 WebIDBCallbacks* callbacks = |
| 692 pending_callbacks_.Lookup(ipc_response_id); |
| 693 if (!callbacks) |
| 694 return; |
| 695 |
| 696 RendererWebIDBCursorImpl* cursor = |
| 697 new RendererWebIDBCursorImpl(ipc_object_id); |
| 698 cursors_[ipc_object_id] = cursor; |
| 699 callbacks->onSuccess(cursor, key, primary_key, web_value); |
| 700 |
| 701 pending_callbacks_.Remove(ipc_response_id); |
| 702 } |
| 703 |
| 704 void IndexedDBDispatcher::OnSuccessCursorContinueOld( |
| 705 const IndexedDBMsg_CallbacksSuccessCursorContinueOld_Params& p) { |
638 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); | 706 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
639 int32 ipc_response_id = p.ipc_response_id; | 707 int32 ipc_response_id = p.ipc_response_id; |
640 int32 ipc_cursor_id = p.ipc_cursor_id; | 708 int32 ipc_cursor_id = p.ipc_cursor_id; |
641 const IndexedDBKey& key = p.key; | 709 const IndexedDBKey& key = p.key; |
642 const IndexedDBKey& primary_key = p.primary_key; | 710 const IndexedDBKey& primary_key = p.primary_key; |
643 const SerializedScriptValue& value = p.serialized_value; | 711 const SerializedScriptValue& value = p.serialized_value; |
644 | 712 |
645 RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; | 713 RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
646 DCHECK(cursor); | 714 DCHECK(cursor); |
647 | 715 |
648 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); | 716 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
649 if (!callbacks) | 717 if (!callbacks) |
650 return; | 718 return; |
651 | 719 |
652 callbacks->onSuccess(key, primary_key, | 720 callbacks->onSuccess(key, primary_key, |
653 WebSerializedScriptValue(value)); | 721 WebSerializedScriptValue(value)); |
654 | 722 |
655 pending_callbacks_.Remove(ipc_response_id); | 723 pending_callbacks_.Remove(ipc_response_id); |
656 } | 724 } |
657 | 725 |
| 726 void IndexedDBDispatcher::OnSuccessCursorContinue( |
| 727 const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p) { |
| 728 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
| 729 int32 ipc_response_id = p.ipc_response_id; |
| 730 int32 ipc_cursor_id = p.ipc_cursor_id; |
| 731 const IndexedDBKey& key = p.key; |
| 732 const IndexedDBKey& primary_key = p.primary_key; |
| 733 const std::vector<char>& value = p.value; |
| 734 |
| 735 RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
| 736 DCHECK(cursor); |
| 737 |
| 738 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
| 739 if (!callbacks) |
| 740 return; |
| 741 |
| 742 WebData web_value; |
| 743 if (value.size()) |
| 744 web_value.assign(&value.front(), value.size()); |
| 745 callbacks->onSuccess(key, primary_key, web_value); |
| 746 |
| 747 pending_callbacks_.Remove(ipc_response_id); |
| 748 } |
| 749 |
| 750 void IndexedDBDispatcher::OnSuccessCursorPrefetchOld( |
| 751 const IndexedDBMsg_CallbacksSuccessCursorPrefetchOld_Params& p) { |
| 752 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
| 753 int32 ipc_response_id = p.ipc_response_id; |
| 754 int32 ipc_cursor_id = p.ipc_cursor_id; |
| 755 const std::vector<IndexedDBKey>& keys = p.keys; |
| 756 const std::vector<IndexedDBKey>& primary_keys = p.primary_keys; |
| 757 const std::vector<SerializedScriptValue>& values = p.values; |
| 758 RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
| 759 DCHECK(cursor); |
| 760 cursor->SetPrefetchDataOld(keys, primary_keys, values); |
| 761 |
| 762 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
| 763 DCHECK(callbacks); |
| 764 cursor->CachedContinueOld(callbacks); |
| 765 pending_callbacks_.Remove(ipc_response_id); |
| 766 } |
| 767 |
658 void IndexedDBDispatcher::OnSuccessCursorPrefetch( | 768 void IndexedDBDispatcher::OnSuccessCursorPrefetch( |
659 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { | 769 const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) { |
660 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); | 770 DCHECK_EQ(p.ipc_thread_id, CurrentWorkerId()); |
661 int32 ipc_response_id = p.ipc_response_id; | 771 int32 ipc_response_id = p.ipc_response_id; |
662 int32 ipc_cursor_id = p.ipc_cursor_id; | 772 int32 ipc_cursor_id = p.ipc_cursor_id; |
663 const std::vector<IndexedDBKey>& keys = p.keys; | 773 const std::vector<IndexedDBKey>& keys = p.keys; |
664 const std::vector<IndexedDBKey>& primary_keys = p.primary_keys; | 774 const std::vector<IndexedDBKey>& primary_keys = p.primary_keys; |
665 const std::vector<SerializedScriptValue>& values = p.values; | 775 std::vector<WebData> values(p.values.size()); |
| 776 for (size_t i = 0; i < p.values.size(); ++i) { |
| 777 if (p.values[i].size()) |
| 778 values[i].assign(&p.values[i].front(), p.values[i].size()); |
| 779 } |
666 RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; | 780 RendererWebIDBCursorImpl* cursor = cursors_[ipc_cursor_id]; |
667 DCHECK(cursor); | 781 DCHECK(cursor); |
668 cursor->SetPrefetchData(keys, primary_keys, values); | 782 cursor->SetPrefetchData(keys, primary_keys, values); |
669 | 783 |
670 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); | 784 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_response_id); |
671 DCHECK(callbacks); | 785 DCHECK(callbacks); |
672 cursor->CachedContinue(callbacks); | 786 cursor->CachedContinue(callbacks); |
673 pending_callbacks_.Remove(ipc_response_id); | 787 pending_callbacks_.Remove(ipc_response_id); |
674 } | 788 } |
675 | 789 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 int32 ipc_exception_cursor_id) { | 888 int32 ipc_exception_cursor_id) { |
775 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 889 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
776 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 890 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
777 if (i->first == ipc_exception_cursor_id) | 891 if (i->first == ipc_exception_cursor_id) |
778 continue; | 892 continue; |
779 i->second->ResetPrefetchCache(); | 893 i->second->ResetPrefetchCache(); |
780 } | 894 } |
781 } | 895 } |
782 | 896 |
783 } // namespace content | 897 } // namespace content |
OLD | NEW |