Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
* You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
include protocol PBackgroundIDBDatabaseFile;
6
include protocol PBackgroundMutableFile;
7
include protocol PChildToParentStream; // FIXME: bug 792908
8
include protocol PFileDescriptorSet; // FIXME: bug 792908
9
include protocol PIPCBlobInputStream; // FIXME: bug 792908
10
include protocol PParentToChildStream; // FIXME: bug 792908
11
12
include DOMTypes;
13
include IPCBlob;
14
include ProtocolTypes;
15
16
include "mozilla/dom/indexedDB/SerializationHelpers.h";
17
include "mozilla/dom/quota/SerializationHelpers.h";
18
19
using struct mozilla::null_t
20
from "ipc/IPCMessageUtils.h";
21
22
using struct mozilla::void_t
23
from "ipc/IPCMessageUtils.h";
24
25
using mozilla::dom::IDBCursor::Direction
26
from "mozilla/dom/IDBCursor.h";
27
28
using mozilla::dom::indexedDB::StructuredCloneFile::FileType
29
from "mozilla/dom/IndexedDatabase.h";
30
31
using class mozilla::dom::indexedDB::Key
32
from "mozilla/dom/indexedDB/Key.h";
33
34
using class mozilla::dom::indexedDB::KeyPath
35
from "mozilla/dom/indexedDB/KeyPath.h";
36
37
using mozilla::dom::quota::PersistenceType
38
from "mozilla/dom/quota/PersistenceType.h";
39
40
using mozilla::SerializedStructuredCloneBuffer
41
from "ipc/IPCMessageUtils.h";
42
43
namespace mozilla {
44
namespace dom {
45
namespace indexedDB {
46
47
struct SerializedKeyRange
48
{
49
Key lower;
50
Key upper;
51
bool lowerOpen;
52
bool upperOpen;
53
bool isOnly;
54
};
55
56
union BlobOrMutableFile
57
{
58
null_t;
59
IPCBlob;
60
PBackgroundMutableFile;
61
};
62
63
struct SerializedStructuredCloneFile
64
{
65
BlobOrMutableFile file;
66
FileType type;
67
};
68
69
struct SerializedStructuredCloneReadInfo
70
{
71
SerializedStructuredCloneBuffer data;
72
SerializedStructuredCloneFile[] files;
73
bool hasPreprocessInfo;
74
};
75
76
struct SerializedStructuredCloneWriteInfo
77
{
78
SerializedStructuredCloneBuffer data;
79
uint64_t offsetToKeyProp;
80
};
81
82
struct IndexUpdateInfo
83
{
84
int64_t indexId;
85
Key value;
86
Key localizedValue;
87
};
88
89
struct DatabaseMetadata
90
{
91
nsString name;
92
uint64_t version;
93
PersistenceType persistenceType;
94
};
95
96
struct ObjectStoreMetadata
97
{
98
int64_t id;
99
nsString name;
100
KeyPath keyPath;
101
bool autoIncrement;
102
};
103
104
struct IndexMetadata
105
{
106
int64_t id;
107
nsString name;
108
KeyPath keyPath;
109
nsCString locale;
110
bool unique;
111
bool multiEntry;
112
bool autoLocale;
113
};
114
115
struct DatabaseSpec
116
{
117
DatabaseMetadata metadata;
118
ObjectStoreSpec[] objectStores;
119
};
120
121
struct ObjectStoreSpec
122
{
123
ObjectStoreMetadata metadata;
124
IndexMetadata[] indexes;
125
};
126
127
struct CommonOpenCursorParams
128
{
129
int64_t objectStoreId;
130
SerializedKeyRange? optionalKeyRange;
131
Direction direction;
132
};
133
134
struct ObjectStoreOpenCursorParams
135
{
136
CommonOpenCursorParams commonParams;
137
};
138
139
struct ObjectStoreOpenKeyCursorParams
140
{
141
CommonOpenCursorParams commonParams;
142
};
143
144
struct CommonIndexOpenCursorParams
145
{
146
CommonOpenCursorParams commonParams;
147
int64_t indexId;
148
};
149
150
struct IndexOpenCursorParams
151
{
152
CommonIndexOpenCursorParams commonIndexParams;
153
};
154
155
struct IndexOpenKeyCursorParams
156
{
157
CommonIndexOpenCursorParams commonIndexParams;
158
};
159
160
// TODO: Actually, using a union here is not very nice, unless IPDL supported
161
// struct inheritance. Alternatively, if IPDL supported enums, we could merge
162
// the subtypes into one. Using a plain integer for discriminating the
163
// subtypes would be too error-prone.
164
union OpenCursorParams
165
{
166
ObjectStoreOpenCursorParams;
167
ObjectStoreOpenKeyCursorParams;
168
IndexOpenCursorParams;
169
IndexOpenKeyCursorParams;
170
};
171
172
union DatabaseOrMutableFile
173
{
174
PBackgroundIDBDatabaseFile;
175
PBackgroundMutableFile;
176
};
177
178
struct FileAddInfo
179
{
180
DatabaseOrMutableFile file;
181
FileType type;
182
};
183
184
struct ObjectStoreAddPutParams
185
{
186
int64_t objectStoreId;
187
SerializedStructuredCloneWriteInfo cloneInfo;
188
Key key;
189
IndexUpdateInfo[] indexUpdateInfos;
190
FileAddInfo[] fileAddInfos;
191
};
192
193
struct ObjectStoreAddParams
194
{
195
ObjectStoreAddPutParams commonParams;
196
};
197
198
struct ObjectStorePutParams
199
{
200
ObjectStoreAddPutParams commonParams;
201
};
202
203
struct ObjectStoreGetParams
204
{
205
int64_t objectStoreId;
206
SerializedKeyRange keyRange;
207
};
208
209
struct ObjectStoreGetKeyParams
210
{
211
int64_t objectStoreId;
212
SerializedKeyRange keyRange;
213
};
214
215
struct ObjectStoreGetAllParams
216
{
217
int64_t objectStoreId;
218
SerializedKeyRange? optionalKeyRange;
219
uint32_t limit;
220
};
221
222
struct ObjectStoreGetAllKeysParams
223
{
224
int64_t objectStoreId;
225
SerializedKeyRange? optionalKeyRange;
226
uint32_t limit;
227
};
228
229
struct ObjectStoreDeleteParams
230
{
231
int64_t objectStoreId;
232
SerializedKeyRange keyRange;
233
};
234
235
struct ObjectStoreClearParams
236
{
237
int64_t objectStoreId;
238
};
239
240
struct ObjectStoreCountParams
241
{
242
int64_t objectStoreId;
243
SerializedKeyRange? optionalKeyRange;
244
};
245
246
struct IndexGetParams
247
{
248
int64_t objectStoreId;
249
int64_t indexId;
250
SerializedKeyRange keyRange;
251
};
252
253
struct IndexGetKeyParams
254
{
255
int64_t objectStoreId;
256
int64_t indexId;
257
SerializedKeyRange keyRange;
258
};
259
260
struct IndexGetAllParams
261
{
262
int64_t objectStoreId;
263
int64_t indexId;
264
SerializedKeyRange? optionalKeyRange;
265
uint32_t limit;
266
};
267
268
struct IndexGetAllKeysParams
269
{
270
int64_t objectStoreId;
271
int64_t indexId;
272
SerializedKeyRange? optionalKeyRange;
273
uint32_t limit;
274
};
275
276
struct IndexCountParams
277
{
278
int64_t objectStoreId;
279
int64_t indexId;
280
SerializedKeyRange? optionalKeyRange;
281
};
282
283
union RequestParams
284
{
285
ObjectStoreAddParams;
286
ObjectStorePutParams;
287
ObjectStoreGetParams;
288
ObjectStoreGetKeyParams;
289
ObjectStoreGetAllParams;
290
ObjectStoreGetAllKeysParams;
291
ObjectStoreDeleteParams;
292
ObjectStoreClearParams;
293
ObjectStoreCountParams;
294
IndexGetParams;
295
IndexGetKeyParams;
296
IndexGetAllParams;
297
IndexGetAllKeysParams;
298
IndexCountParams;
299
};
300
301
struct LoggingInfo
302
{
303
nsID backgroundChildLoggingId;
304
int64_t nextTransactionSerialNumber;
305
int64_t nextVersionChangeTransactionSerialNumber;
306
uint64_t nextRequestSerialNumber;
307
};
308
309
} // namespace indexedDB
310
} // namespace dom
311
} // namespace mozilla