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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, | 98 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, |
99 OnSuccessStringList) | 99 OnSuccessStringList) |
100 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, | 100 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, |
101 OnSuccessSerializedScriptValue) | 101 OnSuccessSerializedScriptValue) |
102 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe
y, | 102 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe
y, |
103 OnSuccessSerializedScriptValueWithKey) | 103 OnSuccessSerializedScriptValueWithKey) |
104 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) | 104 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
105 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) | 105 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) |
106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) | 106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) |
107 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) | 107 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) |
| 108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbortLegacy, |
| 109 OnAbortLegacy) |
108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) | 110 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) |
109 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) | 111 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) |
110 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, | 112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, |
111 OnForcedClose) | 113 OnForcedClose) |
112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, | 114 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, |
113 OnIntVersionChange) | 115 OnIntVersionChange) |
114 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, | 116 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, |
115 OnVersionChange) | 117 OnVersionChange) |
116 IPC_MESSAGE_UNHANDLED(handled = false) | 118 IPC_MESSAGE_UNHANDLED(handled = false) |
117 IPC_END_MESSAGE_MAP() | 119 IPC_END_MESSAGE_MAP() |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code, | 682 void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code, |
681 const string16& message) { | 683 const string16& message) { |
682 DCHECK_EQ(thread_id, CurrentWorkerId()); | 684 DCHECK_EQ(thread_id, CurrentWorkerId()); |
683 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | 685 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
684 if (!callbacks) | 686 if (!callbacks) |
685 return; | 687 return; |
686 callbacks->onError(WebIDBDatabaseError(code, message)); | 688 callbacks->onError(WebIDBDatabaseError(code, message)); |
687 pending_callbacks_.Remove(response_id); | 689 pending_callbacks_.Remove(response_id); |
688 } | 690 } |
689 | 691 |
690 void IndexedDBDispatcher::OnAbort(int32 thread_id, int32 transaction_id) { | 692 // TODO(jsbell): Remove once WK99097 has landed. |
| 693 void IndexedDBDispatcher::OnAbortLegacy(int32 thread_id, int32 transaction_id) { |
691 DCHECK_EQ(thread_id, CurrentWorkerId()); | 694 DCHECK_EQ(thread_id, CurrentWorkerId()); |
692 WebIDBTransactionCallbacks* callbacks = | 695 WebIDBTransactionCallbacks* callbacks = |
693 pending_transaction_callbacks_.Lookup(transaction_id); | 696 pending_transaction_callbacks_.Lookup(transaction_id); |
694 if (!callbacks) | 697 if (!callbacks) |
695 return; | 698 return; |
696 callbacks->onAbort(); | 699 callbacks->onAbort(); |
697 pending_transaction_callbacks_.Remove(transaction_id); | 700 pending_transaction_callbacks_.Remove(transaction_id); |
698 } | 701 } |
699 | 702 |
| 703 void IndexedDBDispatcher::OnAbort(int32 thread_id, int32 transaction_id, |
| 704 int code, const string16& message) { |
| 705 DCHECK_EQ(thread_id, CurrentWorkerId()); |
| 706 WebIDBTransactionCallbacks* callbacks = |
| 707 pending_transaction_callbacks_.Lookup(transaction_id); |
| 708 if (!callbacks) |
| 709 return; |
| 710 callbacks->onAbort(WebIDBDatabaseError(code, message)); |
| 711 pending_transaction_callbacks_.Remove(transaction_id); |
| 712 } |
| 713 |
700 void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) { | 714 void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) { |
701 DCHECK_EQ(thread_id, CurrentWorkerId()); | 715 DCHECK_EQ(thread_id, CurrentWorkerId()); |
702 WebIDBTransactionCallbacks* callbacks = | 716 WebIDBTransactionCallbacks* callbacks = |
703 pending_transaction_callbacks_.Lookup(transaction_id); | 717 pending_transaction_callbacks_.Lookup(transaction_id); |
704 if (!callbacks) | 718 if (!callbacks) |
705 return; | 719 return; |
706 callbacks->onComplete(); | 720 callbacks->onComplete(); |
707 pending_transaction_callbacks_.Remove(transaction_id); | 721 pending_transaction_callbacks_.Remove(transaction_id); |
708 } | 722 } |
709 | 723 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 759 } |
746 | 760 |
747 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 761 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
748 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 762 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
749 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 763 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
750 if (i->first == exception_cursor_id) | 764 if (i->first == exception_cursor_id) |
751 continue; | 765 continue; |
752 i->second->ResetPrefetchCache(); | 766 i->second->ResetPrefetchCache(); |
753 } | 767 } |
754 } | 768 } |
OLD | NEW |