| 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/proxy_webidbdatabase_impl.h" | 5 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void RendererWebIDBDatabaseImpl::deleteObjectStore( | 119 void RendererWebIDBDatabaseImpl::deleteObjectStore( |
| 120 long long object_store_id, | 120 long long object_store_id, |
| 121 const WebIDBTransaction& transaction, | 121 const WebIDBTransaction& transaction, |
| 122 WebExceptionCode& ec) { | 122 WebExceptionCode& ec) { |
| 123 IndexedDBDispatcher::Send( | 123 IndexedDBDispatcher::Send( |
| 124 new IndexedDBHostMsg_DatabaseDeleteObjectStore( | 124 new IndexedDBHostMsg_DatabaseDeleteObjectStore( |
| 125 idb_database_id_, object_store_id, | 125 idb_database_id_, object_store_id, |
| 126 IndexedDBDispatcher::TransactionId(transaction), &ec)); | 126 IndexedDBDispatcher::TransactionId(transaction), &ec)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // TODO(alecflett): Remove this as part of | |
| 130 // https://bugs.webkit.org/show_bug.cgi?id=102733. | |
| 131 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( | |
| 132 const WebVector<long long>& object_store_ids, | |
| 133 unsigned short mode) { | |
| 134 std::vector<int64> object_stores; | |
| 135 object_stores.reserve(object_store_ids.size()); | |
| 136 for (unsigned int i = 0; i < object_store_ids.size(); ++i) | |
| 137 object_stores.push_back(object_store_ids[i]); | |
| 138 | |
| 139 int ipc_transaction_id; | |
| 140 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseTransactionOld( | |
| 141 WorkerTaskRunner::Instance()->CurrentWorkerId(), | |
| 142 idb_database_id_, object_stores, mode, &ipc_transaction_id)); | |
| 143 if (!ipc_transaction_id) | |
| 144 return NULL; | |
| 145 return new RendererWebIDBTransactionImpl(ipc_transaction_id); | |
| 146 } | |
| 147 | |
| 148 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::createTransaction( | 129 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::createTransaction( |
| 149 long long transaction_id, | 130 long long transaction_id, |
| 150 const WebVector<long long>& object_store_ids, | 131 const WebVector<long long>& object_store_ids, |
| 151 unsigned short mode) { | 132 unsigned short mode) { |
| 152 std::vector<int64> object_stores; | 133 std::vector<int64> object_stores; |
| 153 object_stores.reserve(object_store_ids.size()); | 134 object_stores.reserve(object_store_ids.size()); |
| 154 for (unsigned int i = 0; i < object_store_ids.size(); ++i) | 135 for (unsigned int i = 0; i < object_store_ids.size(); ++i) |
| 155 object_stores.push_back(object_store_ids[i]); | 136 object_stores.push_back(object_store_ids[i]); |
| 156 | 137 |
| 157 int idb_transaction_id; | 138 int idb_transaction_id; |
| 158 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseCreateTransaction( | 139 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseCreateTransaction( |
| 159 WorkerTaskRunner::Instance()->CurrentWorkerId(), | 140 WorkerTaskRunner::Instance()->CurrentWorkerId(), |
| 160 idb_database_id_, transaction_id, object_stores, mode, | 141 idb_database_id_, transaction_id, object_stores, mode, |
| 161 &idb_transaction_id)); | 142 &idb_transaction_id)); |
| 162 if (!transaction_id) | 143 if (!transaction_id) |
| 163 return NULL; | 144 return NULL; |
| 164 return new RendererWebIDBTransactionImpl(idb_transaction_id); | 145 return new RendererWebIDBTransactionImpl(idb_transaction_id); |
| 165 } | 146 } |
| 166 | 147 |
| 167 void RendererWebIDBDatabaseImpl::close() { | 148 void RendererWebIDBDatabaseImpl::close() { |
| 168 IndexedDBDispatcher* dispatcher = | 149 IndexedDBDispatcher* dispatcher = |
| 169 IndexedDBDispatcher::ThreadSpecificInstance(); | 150 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 170 dispatcher->RequestIDBDatabaseClose(idb_database_id_); | 151 dispatcher->RequestIDBDatabaseClose(idb_database_id_); |
| 171 } | 152 } |
| 172 | 153 |
| 173 } // namespace content | 154 } // namespace content |
| OLD | NEW |