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) | |
110 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) | 108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) |
111 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) | 109 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) |
112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, | 110 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, |
113 OnForcedClose) | 111 OnForcedClose) |
114 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, | 112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, |
115 OnIntVersionChange) | 113 OnIntVersionChange) |
116 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, | 114 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, |
117 OnVersionChange) | 115 OnVersionChange) |
118 IPC_MESSAGE_UNHANDLED(handled = false) | 116 IPC_MESSAGE_UNHANDLED(handled = false) |
119 IPC_END_MESSAGE_MAP() | 117 IPC_END_MESSAGE_MAP() |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code, | 680 void IndexedDBDispatcher::OnError(int32 thread_id, int32 response_id, int code, |
683 const string16& message) { | 681 const string16& message) { |
684 DCHECK_EQ(thread_id, CurrentWorkerId()); | 682 DCHECK_EQ(thread_id, CurrentWorkerId()); |
685 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | 683 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
686 if (!callbacks) | 684 if (!callbacks) |
687 return; | 685 return; |
688 callbacks->onError(WebIDBDatabaseError(code, message)); | 686 callbacks->onError(WebIDBDatabaseError(code, message)); |
689 pending_callbacks_.Remove(response_id); | 687 pending_callbacks_.Remove(response_id); |
690 } | 688 } |
691 | 689 |
692 // TODO(jsbell): Remove once WK99097 has landed. | |
693 void IndexedDBDispatcher::OnAbortLegacy(int32 thread_id, int32 transaction_id) { | |
694 DCHECK_EQ(thread_id, CurrentWorkerId()); | |
695 WebIDBTransactionCallbacks* callbacks = | |
696 pending_transaction_callbacks_.Lookup(transaction_id); | |
697 if (!callbacks) | |
698 return; | |
699 callbacks->onAbort(); | |
700 pending_transaction_callbacks_.Remove(transaction_id); | |
701 } | |
702 | |
703 void IndexedDBDispatcher::OnAbort(int32 thread_id, int32 transaction_id, | 690 void IndexedDBDispatcher::OnAbort(int32 thread_id, int32 transaction_id, |
704 int code, const string16& message) { | 691 int code, const string16& message) { |
705 DCHECK_EQ(thread_id, CurrentWorkerId()); | 692 DCHECK_EQ(thread_id, CurrentWorkerId()); |
706 WebIDBTransactionCallbacks* callbacks = | 693 WebIDBTransactionCallbacks* callbacks = |
707 pending_transaction_callbacks_.Lookup(transaction_id); | 694 pending_transaction_callbacks_.Lookup(transaction_id); |
708 if (!callbacks) | 695 if (!callbacks) |
709 return; | 696 return; |
710 callbacks->onAbort(WebIDBDatabaseError(code, message)); | 697 callbacks->onAbort(WebIDBDatabaseError(code, message)); |
711 pending_transaction_callbacks_.Remove(transaction_id); | 698 pending_transaction_callbacks_.Remove(transaction_id); |
712 } | 699 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } | 746 } |
760 | 747 |
761 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 748 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
762 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 749 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
763 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 750 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
764 if (i->first == exception_cursor_id) | 751 if (i->first == exception_cursor_id) |
765 continue; | 752 continue; |
766 i->second->ResetPrefetchCache(); | 753 i->second->ResetPrefetchCache(); |
767 } | 754 } |
768 } | 755 } |
OLD | NEW |