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