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/proxy_webidbdatabase_impl.h" | 5 #include "content/child/indexed_db/proxy_webidbdatabase_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "content/child/thread_safe_sender.h" | 9 #include "content/child/thread_safe_sender.h" |
10 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 10 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { | 37 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { |
38 // It's not possible for there to be pending callbacks that address this | 38 // It's not possible for there to be pending callbacks that address this |
39 // object since inside WebKit, they hold a reference to the object which owns | 39 // object since inside WebKit, they hold a reference to the object which owns |
40 // this object. But, if that ever changed, then we'd need to invalidate | 40 // this object. But, if that ever changed, then we'd need to invalidate |
41 // any such pointers. | 41 // any such pointers. |
42 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseDestroyed( | 42 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseDestroyed( |
43 ipc_database_id_)); | 43 ipc_database_id_)); |
44 IndexedDBDispatcher* dispatcher = | 44 IndexedDBDispatcher* dispatcher = |
45 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 45 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
46 dispatcher->DatabaseDestroyed(ipc_database_id_); | 46 dispatcher->DatabaseDestroyed(ipc_database_id_); |
47 } | 47 } |
48 | 48 |
49 void RendererWebIDBDatabaseImpl::createObjectStore( | 49 void RendererWebIDBDatabaseImpl::createObjectStore( |
50 long long transaction_id, | 50 long long transaction_id, |
51 long long object_store_id, | 51 long long object_store_id, |
52 const WebKit::WebString& name, | 52 const WebKit::WebString& name, |
53 const WebKit::WebIDBKeyPath& key_path, | 53 const WebKit::WebIDBKeyPath& key_path, |
54 bool auto_increment) { | 54 bool auto_increment) { |
55 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; | 55 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; |
(...skipping 18 matching lines...) Expand all Loading... |
74 object_store_id)); | 74 object_store_id)); |
75 } | 75 } |
76 | 76 |
77 void RendererWebIDBDatabaseImpl::createTransaction( | 77 void RendererWebIDBDatabaseImpl::createTransaction( |
78 long long transaction_id, | 78 long long transaction_id, |
79 WebKit::WebIDBDatabaseCallbacks* callbacks, | 79 WebKit::WebIDBDatabaseCallbacks* callbacks, |
80 const WebVector<long long>& object_store_ids, | 80 const WebVector<long long>& object_store_ids, |
81 unsigned short mode) | 81 unsigned short mode) |
82 { | 82 { |
83 IndexedDBDispatcher* dispatcher = | 83 IndexedDBDispatcher* dispatcher = |
84 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 84 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
85 dispatcher->RequestIDBDatabaseCreateTransaction(ipc_database_id_, | 85 dispatcher->RequestIDBDatabaseCreateTransaction( |
86 transaction_id, | 86 ipc_database_id_, transaction_id, callbacks, object_store_ids, mode); |
87 callbacks, | |
88 object_store_ids, | |
89 mode); | |
90 } | 87 } |
91 | 88 |
92 void RendererWebIDBDatabaseImpl::close() { | 89 void RendererWebIDBDatabaseImpl::close() { |
93 IndexedDBDispatcher* dispatcher = | 90 IndexedDBDispatcher* dispatcher = |
94 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 91 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
95 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, | 92 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, |
96 ipc_database_callbacks_id_); | 93 ipc_database_callbacks_id_); |
97 } | 94 } |
98 | 95 |
99 void RendererWebIDBDatabaseImpl::get( | 96 void RendererWebIDBDatabaseImpl::get( |
100 long long transaction_id, | 97 long long transaction_id, |
101 long long object_store_id, | 98 long long object_store_id, |
102 long long index_id, | 99 long long index_id, |
103 const WebKit::WebIDBKeyRange& key_range, | 100 const WebKit::WebIDBKeyRange& key_range, |
104 bool key_only, | 101 bool key_only, |
105 WebIDBCallbacks* callbacks) { | 102 WebIDBCallbacks* callbacks) { |
106 IndexedDBDispatcher* dispatcher = | 103 IndexedDBDispatcher* dispatcher = |
107 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 104 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
108 dispatcher->RequestIDBDatabaseGet( | 105 dispatcher->RequestIDBDatabaseGet(ipc_database_id_, |
109 ipc_database_id_, transaction_id, object_store_id, index_id, | 106 transaction_id, |
110 IndexedDBKeyRange(key_range), key_only, callbacks); | 107 object_store_id, |
| 108 index_id, |
| 109 IndexedDBKeyRange(key_range), |
| 110 key_only, |
| 111 callbacks); |
111 } | 112 } |
112 | 113 |
113 void RendererWebIDBDatabaseImpl::put( | 114 void RendererWebIDBDatabaseImpl::put( |
114 long long transaction_id, | 115 long long transaction_id, |
115 long long object_store_id, | 116 long long object_store_id, |
116 const WebKit::WebData& value, | 117 const WebKit::WebData& value, |
117 const WebKit::WebIDBKey& key, | 118 const WebKit::WebIDBKey& key, |
118 PutMode put_mode, | 119 PutMode put_mode, |
119 WebIDBCallbacks* callbacks, | 120 WebIDBCallbacks* callbacks, |
120 const WebVector<long long>& web_index_ids, | 121 const WebVector<long long>& web_index_ids, |
121 const WebVector<WebIndexKeys>& web_index_keys) { | 122 const WebVector<WebIndexKeys>& web_index_keys) { |
122 IndexedDBDispatcher* dispatcher = | 123 IndexedDBDispatcher* dispatcher = |
123 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 124 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
124 dispatcher->RequestIDBDatabasePut( | 125 dispatcher->RequestIDBDatabasePut(ipc_database_id_, |
125 ipc_database_id_, transaction_id, object_store_id, | 126 transaction_id, |
126 value, IndexedDBKey(key), put_mode, callbacks, | 127 object_store_id, |
127 web_index_ids, web_index_keys); | 128 value, |
| 129 IndexedDBKey(key), |
| 130 put_mode, |
| 131 callbacks, |
| 132 web_index_ids, |
| 133 web_index_keys); |
128 } | 134 } |
129 | 135 |
130 void RendererWebIDBDatabaseImpl::setIndexKeys( | 136 void RendererWebIDBDatabaseImpl::setIndexKeys( |
131 long long transaction_id, | 137 long long transaction_id, |
132 long long object_store_id, | 138 long long object_store_id, |
133 const WebKit::WebIDBKey& primary_key, | 139 const WebKit::WebIDBKey& primary_key, |
134 const WebVector<long long>& index_ids, | 140 const WebVector<long long>& index_ids, |
135 const WebVector<WebIndexKeys>& index_keys) { | 141 const WebVector<WebIndexKeys>& index_keys) { |
136 IndexedDBHostMsg_DatabaseSetIndexKeys_Params params; | 142 IndexedDBHostMsg_DatabaseSetIndexKeys_Params params; |
137 params.ipc_database_id = ipc_database_id_; | 143 params.ipc_database_id = ipc_database_id_; |
(...skipping 29 matching lines...) Expand all Loading... |
167 void RendererWebIDBDatabaseImpl::openCursor( | 173 void RendererWebIDBDatabaseImpl::openCursor( |
168 long long transaction_id, | 174 long long transaction_id, |
169 long long object_store_id, | 175 long long object_store_id, |
170 long long index_id, | 176 long long index_id, |
171 const WebKit::WebIDBKeyRange& key_range, | 177 const WebKit::WebIDBKeyRange& key_range, |
172 unsigned short direction, | 178 unsigned short direction, |
173 bool key_only, | 179 bool key_only, |
174 TaskType task_type, | 180 TaskType task_type, |
175 WebIDBCallbacks* callbacks) { | 181 WebIDBCallbacks* callbacks) { |
176 IndexedDBDispatcher* dispatcher = | 182 IndexedDBDispatcher* dispatcher = |
177 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 183 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
178 dispatcher->RequestIDBDatabaseOpenCursor( | 184 dispatcher->RequestIDBDatabaseOpenCursor(ipc_database_id_, |
179 ipc_database_id_, | 185 transaction_id, |
180 transaction_id, object_store_id, index_id, | 186 object_store_id, |
181 IndexedDBKeyRange(key_range), direction, key_only, task_type, callbacks); | 187 index_id, |
| 188 IndexedDBKeyRange(key_range), |
| 189 direction, |
| 190 key_only, |
| 191 task_type, |
| 192 callbacks); |
182 } | 193 } |
183 | 194 |
184 void RendererWebIDBDatabaseImpl::count( | 195 void RendererWebIDBDatabaseImpl::count( |
185 long long transaction_id, | 196 long long transaction_id, |
186 long long object_store_id, | 197 long long object_store_id, |
187 long long index_id, | 198 long long index_id, |
188 const WebKit::WebIDBKeyRange& key_range, | 199 const WebKit::WebIDBKeyRange& key_range, |
189 WebIDBCallbacks* callbacks) { | 200 WebIDBCallbacks* callbacks) { |
190 IndexedDBDispatcher* dispatcher = | 201 IndexedDBDispatcher* dispatcher = |
191 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 202 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
192 dispatcher->RequestIDBDatabaseCount( | 203 dispatcher->RequestIDBDatabaseCount(ipc_database_id_, |
193 ipc_database_id_, | 204 transaction_id, |
194 transaction_id, object_store_id, index_id, | 205 object_store_id, |
195 IndexedDBKeyRange(key_range), callbacks); | 206 index_id, |
| 207 IndexedDBKeyRange(key_range), |
| 208 callbacks); |
196 } | 209 } |
197 | 210 |
198 void RendererWebIDBDatabaseImpl::deleteRange( | 211 void RendererWebIDBDatabaseImpl::deleteRange( |
199 long long transaction_id, | 212 long long transaction_id, |
200 long long object_store_id, | 213 long long object_store_id, |
201 const WebKit::WebIDBKeyRange& key_range, | 214 const WebKit::WebIDBKeyRange& key_range, |
202 WebIDBCallbacks* callbacks) { | 215 WebIDBCallbacks* callbacks) { |
203 IndexedDBDispatcher* dispatcher = | 216 IndexedDBDispatcher* dispatcher = |
204 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 217 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
205 dispatcher->RequestIDBDatabaseDeleteRange( | 218 dispatcher->RequestIDBDatabaseDeleteRange(ipc_database_id_, |
206 ipc_database_id_, | 219 transaction_id, |
207 transaction_id, object_store_id, | 220 object_store_id, |
208 IndexedDBKeyRange(key_range), callbacks); | 221 IndexedDBKeyRange(key_range), |
| 222 callbacks); |
209 } | 223 } |
210 | 224 |
211 void RendererWebIDBDatabaseImpl::clear( | 225 void RendererWebIDBDatabaseImpl::clear( |
212 long long transaction_id, | 226 long long transaction_id, |
213 long long object_store_id, | 227 long long object_store_id, |
214 WebIDBCallbacks* callbacks) { | 228 WebIDBCallbacks* callbacks) { |
215 IndexedDBDispatcher* dispatcher = | 229 IndexedDBDispatcher* dispatcher = |
216 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); | 230 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
217 dispatcher->RequestIDBDatabaseClear( | 231 dispatcher->RequestIDBDatabaseClear( |
218 ipc_database_id_, | 232 ipc_database_id_, transaction_id, object_store_id, callbacks); |
219 transaction_id, object_store_id, callbacks); | |
220 } | 233 } |
221 | 234 |
222 void RendererWebIDBDatabaseImpl::createIndex( | 235 void RendererWebIDBDatabaseImpl::createIndex( |
223 long long transaction_id, | 236 long long transaction_id, |
224 long long object_store_id, | 237 long long object_store_id, |
225 long long index_id, | 238 long long index_id, |
226 const WebString& name, | 239 const WebString& name, |
227 const WebIDBKeyPath& key_path, | 240 const WebIDBKeyPath& key_path, |
228 bool unique, | 241 bool unique, |
229 bool multi_entry) | 242 bool multi_entry) |
(...skipping 28 matching lines...) Expand all Loading... |
258 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseAbort( | 271 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseAbort( |
259 ipc_database_id_, transaction_id)); | 272 ipc_database_id_, transaction_id)); |
260 } | 273 } |
261 | 274 |
262 void RendererWebIDBDatabaseImpl::commit(long long transaction_id) { | 275 void RendererWebIDBDatabaseImpl::commit(long long transaction_id) { |
263 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseCommit( | 276 thread_safe_sender_->Send(new IndexedDBHostMsg_DatabaseCommit( |
264 ipc_database_id_, transaction_id)); | 277 ipc_database_id_, transaction_id)); |
265 } | 278 } |
266 | 279 |
267 } // namespace content | 280 } // namespace content |
OLD | NEW |