| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void IndexedDBDispatcher::WillStopCurrentWorkerThread() { | 81 void IndexedDBDispatcher::WillStopCurrentWorkerThread() { |
| 82 delete this; | 82 delete this; |
| 83 } | 83 } |
| 84 | 84 |
| 85 WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( | 85 WebIDBMetadata IndexedDBDispatcher::ConvertMetadata( |
| 86 const IndexedDBDatabaseMetadata& idb_metadata) { | 86 const IndexedDBDatabaseMetadata& idb_metadata) { |
| 87 WebIDBMetadata web_metadata; | 87 WebIDBMetadata web_metadata; |
| 88 web_metadata.id = idb_metadata.id; | 88 web_metadata.id = idb_metadata.id; |
| 89 web_metadata.name = idb_metadata.name; | 89 web_metadata.name = idb_metadata.name; |
| 90 web_metadata.intVersion = idb_metadata.int_version; | 90 web_metadata.version = idb_metadata.version; |
| 91 web_metadata.maxObjectStoreId = idb_metadata.max_object_store_id; | 91 web_metadata.maxObjectStoreId = idb_metadata.max_object_store_id; |
| 92 web_metadata.objectStores = | 92 web_metadata.objectStores = |
| 93 WebVector<WebIDBMetadata::ObjectStore>(idb_metadata.object_stores.size()); | 93 WebVector<WebIDBMetadata::ObjectStore>(idb_metadata.object_stores.size()); |
| 94 | 94 |
| 95 for (size_t i = 0; i < idb_metadata.object_stores.size(); ++i) { | 95 for (size_t i = 0; i < idb_metadata.object_stores.size(); ++i) { |
| 96 const IndexedDBObjectStoreMetadata& idb_store_metadata = | 96 const IndexedDBObjectStoreMetadata& idb_store_metadata = |
| 97 idb_metadata.object_stores[i]; | 97 idb_metadata.object_stores[i]; |
| 98 WebIDBMetadata::ObjectStore& web_store_metadata = | 98 WebIDBMetadata::ObjectStore& web_store_metadata = |
| 99 web_metadata.objectStores[i]; | 99 web_metadata.objectStores[i]; |
| 100 | 100 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessArray, OnSuccessArray) | 144 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessArray, OnSuccessArray) |
| 145 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValue, OnSuccessValue) | 145 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessValue, OnSuccessValue) |
| 146 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, OnSuccessInteger) | 146 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, OnSuccessInteger) |
| 147 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, | 147 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, |
| 148 OnSuccessUndefined) | 148 OnSuccessUndefined) |
| 149 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) | 149 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
| 150 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) | 150 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) |
| 151 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) | 151 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) |
| 152 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, | 152 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, |
| 153 OnForcedClose) | 153 OnForcedClose) |
| 154 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, | 154 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, |
| 155 OnIntVersionChange) | 155 OnVersionChange) |
| 156 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksAbort, OnAbort) | 156 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksAbort, OnAbort) |
| 157 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksComplete, OnComplete) | 157 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksComplete, OnComplete) |
| 158 IPC_MESSAGE_UNHANDLED(handled = false) | 158 IPC_MESSAGE_UNHANDLED(handled = false) |
| 159 IPC_END_MESSAGE_MAP() | 159 IPC_END_MESSAGE_MAP() |
| 160 // If a message gets here, IndexedDBMessageFilter already determined that it | 160 // If a message gets here, IndexedDBMessageFilter already determined that it |
| 161 // is an IndexedDB message. | 161 // is an IndexedDB message. |
| 162 DCHECK(handled) << "Didn't handle a message defined at line " | 162 DCHECK(handled) << "Didn't handle a message defined at line " |
| 163 << IPC_MESSAGE_ID_LINE(msg.type()); | 163 << IPC_MESSAGE_ID_LINE(msg.type()); |
| 164 } | 164 } |
| 165 | 165 |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 void IndexedDBDispatcher::OnForcedClose(int32_t ipc_thread_id, | 773 void IndexedDBDispatcher::OnForcedClose(int32_t ipc_thread_id, |
| 774 int32_t ipc_database_callbacks_id) { | 774 int32_t ipc_database_callbacks_id) { |
| 775 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 775 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| 776 WebIDBDatabaseCallbacks* callbacks = | 776 WebIDBDatabaseCallbacks* callbacks = |
| 777 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); | 777 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); |
| 778 if (!callbacks) | 778 if (!callbacks) |
| 779 return; | 779 return; |
| 780 callbacks->onForcedClose(); | 780 callbacks->onForcedClose(); |
| 781 } | 781 } |
| 782 | 782 |
| 783 void IndexedDBDispatcher::OnIntVersionChange(int32_t ipc_thread_id, | 783 void IndexedDBDispatcher::OnVersionChange(int32_t ipc_thread_id, |
| 784 int32_t ipc_database_callbacks_id, | 784 int32_t ipc_database_callbacks_id, |
| 785 int64_t old_version, | 785 int64_t old_version, |
| 786 int64_t new_version) { | 786 int64_t new_version) { |
| 787 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 787 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
| 788 WebIDBDatabaseCallbacks* callbacks = | 788 WebIDBDatabaseCallbacks* callbacks = |
| 789 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); | 789 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); |
| 790 // callbacks would be NULL if a versionchange event is received after close | 790 // callbacks would be NULL if a versionchange event is received after close |
| 791 // has been called. | 791 // has been called. |
| 792 if (!callbacks) | 792 if (!callbacks) |
| 793 return; | 793 return; |
| 794 callbacks->onVersionChange(old_version, new_version); | 794 callbacks->onVersionChange(old_version, new_version); |
| 795 } | 795 } |
| 796 | 796 |
| 797 void IndexedDBDispatcher::ResetCursorPrefetchCaches( | 797 void IndexedDBDispatcher::ResetCursorPrefetchCaches( |
| 798 int64_t transaction_id, | 798 int64_t transaction_id, |
| 799 int32_t ipc_exception_cursor_id) { | 799 int32_t ipc_exception_cursor_id) { |
| 800 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator; | 800 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator; |
| 801 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 801 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
| 802 if (i->first == ipc_exception_cursor_id || | 802 if (i->first == ipc_exception_cursor_id || |
| 803 i->second->transaction_id() != transaction_id) | 803 i->second->transaction_id() != transaction_id) |
| 804 continue; | 804 continue; |
| 805 i->second->ResetPrefetchCache(); | 805 i->second->ResetPrefetchCache(); |
| 806 } | 806 } |
| 807 } | 807 } |
| 808 | 808 |
| 809 } // namespace content | 809 } // namespace content |
| OLD | NEW |