| 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/webidbdatabase_impl.h" | 5 #include "content/child/indexed_db/webidbdatabase_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 9 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 10 #include "content/child/indexed_db/indexed_db_key_builders.h" | 10 #include "content/child/indexed_db/indexed_db_key_builders.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void WebIDBDatabaseImpl::deleteObjectStore(long long transaction_id, | 70 void WebIDBDatabaseImpl::deleteObjectStore(long long transaction_id, |
| 71 long long object_store_id) { | 71 long long object_store_id) { |
| 72 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseDeleteObjectStore( | 72 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseDeleteObjectStore( |
| 73 ipc_database_id_, transaction_id, object_store_id)); | 73 ipc_database_id_, transaction_id, object_store_id)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void WebIDBDatabaseImpl::createTransaction( | 76 void WebIDBDatabaseImpl::createTransaction( |
| 77 long long transaction_id, | 77 long long transaction_id, |
| 78 WebIDBDatabaseCallbacks* callbacks, | 78 WebIDBDatabaseCallbacks* callbacks, |
| 79 const WebVector<long long>& object_store_ids, | 79 const WebVector<long long>& object_store_ids, |
| 80 WebIDBDatabase::TransactionMode mode) { | 80 blink::TransactionMode mode) { |
| 81 IndexedDBDispatcher* dispatcher = | 81 IndexedDBDispatcher* dispatcher = |
| 82 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 82 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 83 dispatcher->RequestIDBDatabaseCreateTransaction( | 83 dispatcher->RequestIDBDatabaseCreateTransaction( |
| 84 ipc_database_id_, transaction_id, callbacks, object_store_ids, mode); | 84 ipc_database_id_, transaction_id, callbacks, object_store_ids, mode); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void WebIDBDatabaseImpl::close() { | 87 void WebIDBDatabaseImpl::close() { |
| 88 IndexedDBDispatcher* dispatcher = | 88 IndexedDBDispatcher* dispatcher = |
| 89 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 89 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 90 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, | 90 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 key_only, | 107 key_only, |
| 108 callbacks); | 108 callbacks); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // TODO(ericu): Remove this once it's obsolete. It's only here for the | 111 // TODO(ericu): Remove this once it's obsolete. It's only here for the |
| 112 // three-sided-patch dance. | 112 // three-sided-patch dance. |
| 113 void WebIDBDatabaseImpl::put(long long transaction_id, | 113 void WebIDBDatabaseImpl::put(long long transaction_id, |
| 114 long long object_store_id, | 114 long long object_store_id, |
| 115 const blink::WebData& value, | 115 const blink::WebData& value, |
| 116 const WebIDBKey& key, | 116 const WebIDBKey& key, |
| 117 PutMode put_mode, | 117 blink::PutMode put_mode, |
| 118 WebIDBCallbacks* callbacks, | 118 WebIDBCallbacks* callbacks, |
| 119 const WebVector<long long>& web_index_ids, | 119 const WebVector<long long>& web_index_ids, |
| 120 const WebVector<WebIndexKeys>& web_index_keys) { | 120 const WebVector<WebIndexKeys>& web_index_keys) { |
| 121 IndexedDBDispatcher* dispatcher = | 121 IndexedDBDispatcher* dispatcher = |
| 122 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 122 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 123 const blink::WebVector<WebBlobInfo> web_blob_info; | 123 const blink::WebVector<WebBlobInfo> web_blob_info; |
| 124 dispatcher->RequestIDBDatabasePut(ipc_database_id_, | 124 dispatcher->RequestIDBDatabasePut(ipc_database_id_, |
| 125 transaction_id, | 125 transaction_id, |
| 126 object_store_id, | 126 object_store_id, |
| 127 value, | 127 value, |
| 128 web_blob_info, | 128 web_blob_info, |
| 129 IndexedDBKeyBuilder::Build(key), | 129 IndexedDBKeyBuilder::Build(key), |
| 130 put_mode, | 130 put_mode, |
| 131 callbacks, | 131 callbacks, |
| 132 web_index_ids, | 132 web_index_ids, |
| 133 web_index_keys); | 133 web_index_keys); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void WebIDBDatabaseImpl::put(long long transaction_id, | 136 void WebIDBDatabaseImpl::put(long long transaction_id, |
| 137 long long object_store_id, | 137 long long object_store_id, |
| 138 const blink::WebData& value, | 138 const blink::WebData& value, |
| 139 const blink::WebVector<WebBlobInfo>& web_blob_info, | 139 const blink::WebVector<WebBlobInfo>& web_blob_info, |
| 140 const WebIDBKey& key, | 140 const WebIDBKey& key, |
| 141 PutMode put_mode, | 141 blink::PutMode put_mode, |
| 142 WebIDBCallbacks* callbacks, | 142 WebIDBCallbacks* callbacks, |
| 143 const WebVector<long long>& web_index_ids, | 143 const WebVector<long long>& web_index_ids, |
| 144 const WebVector<WebIndexKeys>& web_index_keys) { | 144 const WebVector<WebIndexKeys>& web_index_keys) { |
| 145 IndexedDBDispatcher* dispatcher = | 145 IndexedDBDispatcher* dispatcher = |
| 146 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 146 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 147 dispatcher->RequestIDBDatabasePut(ipc_database_id_, | 147 dispatcher->RequestIDBDatabasePut(ipc_database_id_, |
| 148 transaction_id, | 148 transaction_id, |
| 149 object_store_id, | 149 object_store_id, |
| 150 value, | 150 value, |
| 151 web_blob_info, | 151 web_blob_info, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 std::vector<int64> index_ids(web_index_ids.data(), | 189 std::vector<int64> index_ids(web_index_ids.data(), |
| 190 web_index_ids.data() + web_index_ids.size()); | 190 web_index_ids.data() + web_index_ids.size()); |
| 191 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexesReady( | 191 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexesReady( |
| 192 ipc_database_id_, transaction_id, object_store_id, index_ids)); | 192 ipc_database_id_, transaction_id, object_store_id, index_ids)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void WebIDBDatabaseImpl::openCursor(long long transaction_id, | 195 void WebIDBDatabaseImpl::openCursor(long long transaction_id, |
| 196 long long object_store_id, | 196 long long object_store_id, |
| 197 long long index_id, | 197 long long index_id, |
| 198 const WebIDBKeyRange& key_range, | 198 const WebIDBKeyRange& key_range, |
| 199 WebIDBCursor::Direction direction, | 199 blink::Direction direction, |
| 200 bool key_only, | 200 bool key_only, |
| 201 TaskType task_type, | 201 blink::TaskType task_type, |
| 202 WebIDBCallbacks* callbacks) { | 202 WebIDBCallbacks* callbacks) { |
| 203 IndexedDBDispatcher* dispatcher = | 203 IndexedDBDispatcher* dispatcher = |
| 204 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 204 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 205 dispatcher->RequestIDBDatabaseOpenCursor( | 205 dispatcher->RequestIDBDatabaseOpenCursor( |
| 206 ipc_database_id_, | 206 ipc_database_id_, |
| 207 transaction_id, | 207 transaction_id, |
| 208 object_store_id, | 208 object_store_id, |
| 209 index_id, | 209 index_id, |
| 210 IndexedDBKeyRangeBuilder::Build(key_range), | 210 IndexedDBKeyRangeBuilder::Build(key_range), |
| 211 direction, | 211 direction, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { | 293 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { |
| 294 DCHECK(uuids.size()); | 294 DCHECK(uuids.size()); |
| 295 std::vector<std::string> param(uuids.size()); | 295 std::vector<std::string> param(uuids.size()); |
| 296 for (size_t i = 0; i < uuids.size(); ++i) | 296 for (size_t i = 0; i < uuids.size(); ++i) |
| 297 param[i] = uuids[i].latin1().data(); | 297 param[i] = uuids[i].latin1().data(); |
| 298 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); | 298 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace content | 301 } // namespace content |
| OLD | NEW |