OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Message definition file, included multiple times, hence no include guard. | |
6 | |
7 #include <vector> | |
8 | |
9 #include "chrome/common/indexed_db_key.h" | |
10 #include "chrome/common/indexed_db_param_traits.h" | |
11 #include "chrome/common/serialized_script_value.h" | |
12 #include "ipc/ipc_message_macros.h" | |
13 #include "ipc/ipc_param_traits.h" | |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" | |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | |
16 | |
17 #define IPC_MESSAGE_START IndexedDBMsgStart | |
18 | |
19 // Argument structures used in messages | |
20 | |
21 IPC_ENUM_TRAITS(WebKit::WebIDBObjectStore::PutMode) | |
22 | |
23 // Used to open an indexed database. | |
24 IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryOpen_Params) | |
25 // The routing ID of the view initiating the open. | |
26 IPC_STRUCT_MEMBER(int32, routing_id) | |
27 // The response should have this id. | |
28 IPC_STRUCT_MEMBER(int32, response_id) | |
29 // The origin doing the initiating. | |
30 IPC_STRUCT_MEMBER(string16, origin) | |
31 // The name of the database. | |
32 IPC_STRUCT_MEMBER(string16, name) | |
33 // The maximum size of the database. | |
34 IPC_STRUCT_MEMBER(uint64, maximum_size) | |
35 IPC_STRUCT_END() | |
36 | |
37 // Used to delete an indexed database. | |
38 IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryDeleteDatabase_Params) | |
39 // The routing ID of the view initiating the deletion. | |
40 IPC_STRUCT_MEMBER(int32, routing_id) | |
41 // The response should have this id. | |
42 IPC_STRUCT_MEMBER(int32, response_id) | |
43 // The origin doing the initiating. | |
44 IPC_STRUCT_MEMBER(string16, origin) | |
45 // The name of the database. | |
46 IPC_STRUCT_MEMBER(string16, name) | |
47 IPC_STRUCT_END() | |
48 | |
49 // Used to create an object store. | |
50 IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStore_Params) | |
51 // The name of the object store. | |
52 IPC_STRUCT_MEMBER(string16, name) | |
53 // The keyPath of the object store. | |
54 IPC_STRUCT_MEMBER(NullableString16, key_path) | |
55 // Whether the object store created should have a key generator. | |
56 IPC_STRUCT_MEMBER(bool, auto_increment) | |
57 // The transaction this is associated with. | |
58 IPC_STRUCT_MEMBER(int32, transaction_id) | |
59 // The database the object store belongs to. | |
60 IPC_STRUCT_MEMBER(int32, idb_database_id) | |
61 IPC_STRUCT_END() | |
62 | |
63 // Used to open both cursors and object cursors in IndexedDB. | |
64 IPC_STRUCT_BEGIN(IndexedDBHostMsg_IndexOpenCursor_Params) | |
65 // The response should have this id. | |
66 IPC_STRUCT_MEMBER(int32, response_id) | |
67 // The serialized lower key. | |
68 IPC_STRUCT_MEMBER(IndexedDBKey, lower_key) | |
69 // The serialized upper key. | |
70 IPC_STRUCT_MEMBER(IndexedDBKey, upper_key) | |
71 // Is the lower bound open? | |
72 IPC_STRUCT_MEMBER(bool, lower_open) | |
73 // Is the upper bound open? | |
74 IPC_STRUCT_MEMBER(bool, upper_open) | |
75 // The direction of this cursor. | |
76 IPC_STRUCT_MEMBER(int32, direction) | |
77 // The index the index belongs to. | |
78 IPC_STRUCT_MEMBER(int32, idb_index_id) | |
79 // The transaction this request belongs to. | |
80 IPC_STRUCT_MEMBER(int, transaction_id) | |
81 IPC_STRUCT_END() | |
82 | |
83 // Used to set a value in an object store. | |
84 IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStorePut_Params) | |
85 // The object store's id. | |
86 IPC_STRUCT_MEMBER(int32, idb_object_store_id) | |
87 // The id any response should contain. | |
88 IPC_STRUCT_MEMBER(int32, response_id) | |
89 // The value to set. | |
90 IPC_STRUCT_MEMBER(SerializedScriptValue, serialized_value) | |
91 // The key to set it on (may not be "valid"/set in some cases). | |
92 IPC_STRUCT_MEMBER(IndexedDBKey, key) | |
93 // Whether this is an add or a put. | |
94 IPC_STRUCT_MEMBER(WebKit::WebIDBObjectStore::PutMode, put_mode) | |
95 // The transaction it's associated with. | |
96 IPC_STRUCT_MEMBER(int, transaction_id) | |
97 IPC_STRUCT_END() | |
98 | |
99 // Used to create an index. | |
100 IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreCreateIndex_Params) | |
101 // The name of the index. | |
102 IPC_STRUCT_MEMBER(string16, name) | |
103 // The keyPath of the index. | |
104 IPC_STRUCT_MEMBER(NullableString16, key_path) | |
105 // Whether the index created has unique keys. | |
106 IPC_STRUCT_MEMBER(bool, unique) | |
107 // The transaction this is associated with. | |
108 IPC_STRUCT_MEMBER(int32, transaction_id) | |
109 // The object store the index belongs to. | |
110 IPC_STRUCT_MEMBER(int32, idb_object_store_id) | |
111 IPC_STRUCT_END() | |
112 | |
113 // Used to open an IndexedDB cursor. | |
114 IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreOpenCursor_Params) | |
115 // The response should have this id. | |
116 IPC_STRUCT_MEMBER(int32, response_id) | |
117 // The serialized lower key. | |
118 IPC_STRUCT_MEMBER(IndexedDBKey, lower_key) | |
119 // The serialized upper key. | |
120 IPC_STRUCT_MEMBER(IndexedDBKey, upper_key) | |
121 // Is the lower bound open? | |
122 IPC_STRUCT_MEMBER(bool, lower_open) | |
123 // Is the upper bound open? | |
124 IPC_STRUCT_MEMBER(bool, upper_open) | |
125 // The direction of this cursor. | |
126 IPC_STRUCT_MEMBER(int32, direction) | |
127 // The object store the cursor belongs to. | |
128 IPC_STRUCT_MEMBER(int32, idb_object_store_id) | |
129 // The transaction this request belongs to. | |
130 IPC_STRUCT_MEMBER(int, transaction_id) | |
131 IPC_STRUCT_END() | |
132 | |
133 // Indexed DB messages sent from the browser to the renderer. | |
134 | |
135 // IDBCallback message handlers. | |
136 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor, | |
137 int32 /* response_id */, | |
138 int32 /* cursor_id */) | |
139 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase, | |
140 int32 /* response_id */, | |
141 int32 /* idb_database_id */) | |
142 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIndexedDBKey, | |
143 int32 /* response_id */, | |
144 IndexedDBKey /* indexed_db_key */) | |
145 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBIndex, | |
146 int32 /* response_id */, | |
147 int32 /* idb_index_id */) | |
148 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBTransaction, | |
149 int32 /* response_id */, | |
150 int32 /* idb_transaction_id */) | |
151 IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, | |
152 int32 /* response_id */, | |
153 SerializedScriptValue /* serialized_script_value */) | |
154 IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksError, | |
155 int32 /* response_id */, | |
156 int /* code */, | |
157 string16 /* message */) | |
158 IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksBlocked, | |
159 int32 /* response_id */) | |
160 | |
161 // IDBTransactionCallback message handlers. | |
162 IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksAbort, | |
163 int32 /* transaction_id */) | |
164 IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksComplete, | |
165 int32 /* transaction_id */) | |
166 IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksTimeout, | |
167 int32 /* transaction_id */) | |
168 | |
169 IPC_MESSAGE_CONTROL2(IndexedDBMsg_DatabaseCallbacksVersionChange, | |
170 int32, /* database_id */ | |
171 string16) /* new_version */ | |
172 | |
173 // Indexed DB messages sent from the renderer to the browser. | |
174 | |
175 // WebIDBCursor::direction() message. | |
176 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorDirection, | |
177 int32, /* idb_cursor_id */ | |
178 int32 /* direction */) | |
179 | |
180 // WebIDBCursor::key() message. | |
181 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorKey, | |
182 int32, /* idb_cursor_id */ | |
183 IndexedDBKey /* key */) | |
184 | |
185 // WebIDBCursor::primaryKey() message. | |
186 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorPrimaryKey, | |
187 int32, /* idb_cursor_id */ | |
188 IndexedDBKey /* primary_key */) | |
189 | |
190 // WebIDBCursor::value() message. | |
191 IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_CursorValue, | |
192 int32, /* idb_cursor_id */ | |
193 SerializedScriptValue, /* script_value */ | |
194 IndexedDBKey /* key */) | |
195 | |
196 // WebIDBCursor::update() message. | |
197 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorUpdate, | |
198 int32, /* idb_cursor_id */ | |
199 int32, /* response_id */ | |
200 SerializedScriptValue, /* value */ | |
201 WebKit::WebExceptionCode /* ec */) | |
202 | |
203 // WebIDBCursor::continue() message. | |
204 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorContinue, | |
205 int32, /* idb_cursor_id */ | |
206 int32, /* response_id */ | |
207 IndexedDBKey, /* key */ | |
208 WebKit::WebExceptionCode /* ec */) | |
209 | |
210 // WebIDBCursor::remove() message. | |
211 IPC_SYNC_MESSAGE_CONTROL2_1(IndexedDBHostMsg_CursorDelete, | |
212 int32, /* idb_cursor_id */ | |
213 int32, /* response_id */ | |
214 WebKit::WebExceptionCode /* ec */) | |
215 | |
216 // WebIDBFactory::open() message. | |
217 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryOpen, | |
218 IndexedDBHostMsg_FactoryOpen_Params) | |
219 | |
220 // WebIDBFactory::deleteDatabase() message. | |
221 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryDeleteDatabase, | |
222 IndexedDBHostMsg_FactoryDeleteDatabase_Params) | |
223 | |
224 // WebIDBDatabase::name() message. | |
225 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseName, | |
226 int32, /* idb_database_id */ | |
227 string16 /* name */) | |
228 | |
229 // WebIDBDatabase::version() message. | |
230 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseVersion, | |
231 int32, /* idb_database_id */ | |
232 string16 /* version */) | |
233 | |
234 // WebIDBDatabase::objectStoreNames() message. | |
235 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseObjectStoreNames, | |
236 int32, /* idb_database_id */ | |
237 std::vector<string16> /* objectStoreNames */) | |
238 | |
239 // WebIDBDatabase::createObjectStore() message. | |
240 IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_DatabaseCreateObjectStore, | |
241 IndexedDBHostMsg_DatabaseCreateObjectStore_Params, | |
242 int32, /* object_store_id */ | |
243 WebKit::WebExceptionCode /* ec */) | |
244 | |
245 // WebIDBDatabase::removeObjectStore() message. | |
246 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStore, | |
247 int32, /* idb_database_id */ | |
248 string16, /* name */ | |
249 int32, /* transaction_id */ | |
250 WebKit::WebExceptionCode /* ec */) | |
251 | |
252 // WebIDBDatabase::setVersion() message. | |
253 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseSetVersion, | |
254 int32, /* idb_database_id */ | |
255 int32, /* response_id */ | |
256 string16, /* version */ | |
257 WebKit::WebExceptionCode /* ec */) | |
258 | |
259 // WebIDBDatabase::transaction() message. | |
260 // TODO: make this message async. Have the renderer create a | |
261 // temporary ID and keep a map in the browser process of real | |
262 // IDs to temporary IDs. We can then update the transaction | |
263 // to its real ID asynchronously. | |
264 IPC_SYNC_MESSAGE_CONTROL4_2(IndexedDBHostMsg_DatabaseTransaction, | |
265 int32, /* idb_database_id */ | |
266 std::vector<string16>, /* object_stores */ | |
267 int32, /* mode */ | |
268 int32, /* timeout */ | |
269 int32, /* idb_transaction_id */ | |
270 WebKit::WebExceptionCode /* ec */) | |
271 | |
272 // WebIDBDatabase::open() message. | |
273 IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseOpen, | |
274 int32, /* idb_database_id */ | |
275 int32 /* response_id */) | |
276 | |
277 // WebIDBDatabase::close() message. | |
278 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseClose, | |
279 int32 /* idb_database_id */) | |
280 | |
281 // WebIDBDatabase::~WebIDBDatabase() message. | |
282 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseDestroyed, | |
283 int32 /* idb_database_id */) | |
284 | |
285 // WebIDBIndex::name() message. | |
286 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexName, | |
287 int32, /* idb_index_id */ | |
288 string16 /* name */) | |
289 | |
290 // WebIDBIndex::storeName() message. | |
291 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexStoreName, | |
292 int32, /* idb_index_id */ | |
293 string16 /* store_name */) | |
294 | |
295 // WebIDBIndex::keyPath() message. | |
296 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexKeyPath, | |
297 int32, /* idb_index_id */ | |
298 NullableString16 /* key_path */) | |
299 | |
300 // WebIDBIndex::unique() message. | |
301 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexUnique, | |
302 int32, /* idb_unique_id */ | |
303 bool /* unique */) | |
304 | |
305 // WebIDBIndex::openObjectCursor() message. | |
306 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenObjectCursor, | |
307 IndexedDBHostMsg_IndexOpenCursor_Params, | |
308 WebKit::WebExceptionCode /* ec */) | |
309 | |
310 // WebIDBIndex::openKeyCursor() message. | |
311 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenKeyCursor, | |
312 IndexedDBHostMsg_IndexOpenCursor_Params, | |
313 WebKit::WebExceptionCode /* ec */) | |
314 | |
315 // WebIDBIndex::getObject() message. | |
316 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetObject, | |
317 int32, /* idb_index_id */ | |
318 int32, /* response_id */ | |
319 IndexedDBKey, /* key */ | |
320 int32, /* transaction_id */ | |
321 WebKit::WebExceptionCode /* ec */) | |
322 | |
323 // WebIDBIndex::getKey() message. | |
324 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetKey, | |
325 int32, /* idb_index_id */ | |
326 int32, /* response_id */ | |
327 IndexedDBKey, /* key */ | |
328 int32, /* transaction_id */ | |
329 WebKit::WebExceptionCode /* ec */) | |
330 | |
331 // WebIDBIndex::~WebIDBIndex() message. | |
332 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_IndexDestroyed, | |
333 int32 /* idb_index_id */) | |
334 | |
335 // WebIDBObjectStore::name() message. | |
336 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreName, | |
337 int32, /* idb_object_store_id */ | |
338 string16 /* name */) | |
339 | |
340 // WebIDBObjectStore::keyPath() message. | |
341 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreKeyPath, | |
342 int32, /* idb_object_store_id */ | |
343 NullableString16 /* keyPath */) | |
344 | |
345 // WebIDBObjectStore::indexNames() message. | |
346 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreIndexNames, | |
347 int32, /* idb_object_store_id */ | |
348 std::vector<string16> /* index_names */) | |
349 | |
350 // WebIDBObjectStore::get() message. | |
351 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreGet, | |
352 int32, /* idb_object_store_id */ | |
353 int32, /* response_id */ | |
354 IndexedDBKey, /* key */ | |
355 int32, /* transaction_id */ | |
356 WebKit::WebExceptionCode /* ec */) | |
357 | |
358 // WebIDBObjectStore::put() message. | |
359 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStorePut, | |
360 IndexedDBHostMsg_ObjectStorePut_Params, | |
361 WebKit::WebExceptionCode /* ec */) | |
362 | |
363 // WebIDBObjectStore::delete() message. | |
364 IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreDelete, | |
365 int32, /* idb_object_store_id */ | |
366 int32, /* response_id */ | |
367 IndexedDBKey, /* key */ | |
368 int32, /* transaction_id */ | |
369 WebKit::WebExceptionCode /* ec */) | |
370 | |
371 // WebIDBObjectStore::clear() message. | |
372 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreClear, | |
373 int32, /* idb_object_store_id */ | |
374 int32, /* response_id */ | |
375 int32, /* transaction_id */ | |
376 WebKit::WebExceptionCode /* ec */) | |
377 | |
378 // WebIDBObjectStore::createIndex() message. | |
379 IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_ObjectStoreCreateIndex, | |
380 IndexedDBHostMsg_ObjectStoreCreateIndex_Params, | |
381 int32, /* index_id */ | |
382 WebKit::WebExceptionCode /* ec */) | |
383 | |
384 // WebIDBObjectStore::index() message. | |
385 IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_ObjectStoreIndex, | |
386 int32, /* idb_object_store_id */ | |
387 string16, /* name */ | |
388 int32, /* idb_index_id */ | |
389 WebKit::WebExceptionCode /* ec */) | |
390 | |
391 // WebIDBObjectStore::deleteIndex() message. | |
392 IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreDeleteIndex, | |
393 int32, /* idb_object_store_id */ | |
394 string16, /* name */ | |
395 int32, /* transaction_id */ | |
396 WebKit::WebExceptionCode /* ec */) | |
397 | |
398 // WebIDBObjectStore::openCursor() message. | |
399 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreOpenCursor, | |
400 IndexedDBHostMsg_ObjectStoreOpenCursor_Params, | |
401 WebKit::WebExceptionCode /* ec */) | |
402 | |
403 // WebIDBObjectStore::~WebIDBObjectStore() message. | |
404 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_ObjectStoreDestroyed, | |
405 int32 /* idb_object_store_id */) | |
406 | |
407 // WebIDBDatabase::~WebIDBCursor() message. | |
408 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, | |
409 int32 /* idb_cursor_id */) | |
410 | |
411 // IDBTransaction::ObjectStore message. | |
412 IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_TransactionObjectStore, | |
413 int32, /* transaction_id */ | |
414 string16, /* name */ | |
415 int32, /* object_store_id */ | |
416 WebKit::WebExceptionCode /* ec */) | |
417 | |
418 // WebIDBTransaction::mode() message. | |
419 IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_TransactionMode, | |
420 int32, /* idb_transaction_id */ | |
421 int /* mode */) | |
422 | |
423 // WebIDBTransaction::abort() message. | |
424 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionAbort, | |
425 int32 /* idb_transaction_id */) | |
426 | |
427 // IDBTransaction::DidCompleteTaskEvents() message. | |
428 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, | |
429 int32 /* idb_transaction_id */) | |
430 | |
431 // WebIDBTransaction::~WebIDBTransaction() message. | |
432 IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, | |
433 int32 /* idb_transaction_id */) | |
OLD | NEW |