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 <stddef.h> |
| 8 |
7 #include <string> | 9 #include <string> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 12 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
11 #include "content/child/indexed_db/indexed_db_key_builders.h" | 13 #include "content/child/indexed_db/indexed_db_key_builders.h" |
12 #include "content/child/thread_safe_sender.h" | 14 #include "content/child/thread_safe_sender.h" |
13 #include "content/child/worker_thread_registry.h" | 15 #include "content/child/worker_thread_registry.h" |
14 #include "content/common/indexed_db/indexed_db_messages.h" | 16 #include "content/common/indexed_db/indexed_db_messages.h" |
15 #include "third_party/WebKit/public/platform/WebBlobInfo.h" | 17 #include "third_party/WebKit/public/platform/WebBlobInfo.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/platform/WebVector.h" | 19 #include "third_party/WebKit/public/platform/WebVector.h" |
18 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h" | 20 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h" |
19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h" | 21 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h" |
20 | 22 |
21 using blink::WebBlobInfo; | 23 using blink::WebBlobInfo; |
22 using blink::WebIDBCallbacks; | 24 using blink::WebIDBCallbacks; |
23 using blink::WebIDBCursor; | 25 using blink::WebIDBCursor; |
24 using blink::WebIDBDatabase; | 26 using blink::WebIDBDatabase; |
25 using blink::WebIDBDatabaseCallbacks; | 27 using blink::WebIDBDatabaseCallbacks; |
26 using blink::WebIDBMetadata; | 28 using blink::WebIDBMetadata; |
27 using blink::WebIDBKey; | 29 using blink::WebIDBKey; |
28 using blink::WebIDBKeyPath; | 30 using blink::WebIDBKeyPath; |
29 using blink::WebIDBKeyRange; | 31 using blink::WebIDBKeyRange; |
30 using blink::WebString; | 32 using blink::WebString; |
31 using blink::WebVector; | 33 using blink::WebVector; |
32 | 34 |
33 namespace content { | 35 namespace content { |
34 | 36 |
35 WebIDBDatabaseImpl::WebIDBDatabaseImpl(int32 ipc_database_id, | 37 WebIDBDatabaseImpl::WebIDBDatabaseImpl(int32_t ipc_database_id, |
36 int32 ipc_database_callbacks_id, | 38 int32_t ipc_database_callbacks_id, |
37 ThreadSafeSender* thread_safe_sender) | 39 ThreadSafeSender* thread_safe_sender) |
38 : ipc_database_id_(ipc_database_id), | 40 : ipc_database_id_(ipc_database_id), |
39 ipc_database_callbacks_id_(ipc_database_callbacks_id), | 41 ipc_database_callbacks_id_(ipc_database_callbacks_id), |
40 thread_safe_sender_(thread_safe_sender) {} | 42 thread_safe_sender_(thread_safe_sender) {} |
41 | 43 |
42 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { | 44 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { |
43 // It's not possible for there to be pending callbacks that address this | 45 // It's not possible for there to be pending callbacks that address this |
44 // object since inside WebKit, they hold a reference to the object which owns | 46 // object since inside WebKit, they hold a reference to the object which owns |
45 // this object. But, if that ever changed, then we'd need to invalidate | 47 // this object. But, if that ever changed, then we'd need to invalidate |
46 // any such pointers. | 48 // any such pointers. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 178 } |
177 } | 179 } |
178 | 180 |
179 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexKeys(params)); | 181 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexKeys(params)); |
180 } | 182 } |
181 | 183 |
182 void WebIDBDatabaseImpl::setIndexesReady( | 184 void WebIDBDatabaseImpl::setIndexesReady( |
183 long long transaction_id, | 185 long long transaction_id, |
184 long long object_store_id, | 186 long long object_store_id, |
185 const WebVector<long long>& web_index_ids) { | 187 const WebVector<long long>& web_index_ids) { |
186 std::vector<int64> index_ids(web_index_ids.data(), | 188 std::vector<int64_t> index_ids(web_index_ids.data(), |
187 web_index_ids.data() + web_index_ids.size()); | 189 web_index_ids.data() + web_index_ids.size()); |
188 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexesReady( | 190 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseSetIndexesReady( |
189 ipc_database_id_, transaction_id, object_store_id, index_ids)); | 191 ipc_database_id_, transaction_id, object_store_id, index_ids)); |
190 } | 192 } |
191 | 193 |
192 void WebIDBDatabaseImpl::openCursor(long long transaction_id, | 194 void WebIDBDatabaseImpl::openCursor(long long transaction_id, |
193 long long object_store_id, | 195 long long object_store_id, |
194 long long index_id, | 196 long long index_id, |
195 const WebIDBKeyRange& key_range, | 197 const WebIDBKeyRange& key_range, |
196 blink::WebIDBCursorDirection direction, | 198 blink::WebIDBCursorDirection direction, |
197 bool key_only, | 199 bool key_only, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 291 |
290 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { | 292 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { |
291 DCHECK(uuids.size()); | 293 DCHECK(uuids.size()); |
292 std::vector<std::string> param(uuids.size()); | 294 std::vector<std::string> param(uuids.size()); |
293 for (size_t i = 0; i < uuids.size(); ++i) | 295 for (size_t i = 0; i < uuids.size(); ++i) |
294 param[i] = uuids[i].latin1().data(); | 296 param[i] = uuids[i].latin1().data(); |
295 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); | 297 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); |
296 } | 298 } |
297 | 299 |
298 } // namespace content | 300 } // namespace content |
OLD | NEW |