1 | /* |
2 | * Copyright (C) 2010-2018 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 | * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
17 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
19 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
20 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
22 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ |
24 | |
25 | #pragma once |
26 | |
27 | #if ENABLE(INDEXED_DATABASE) |
28 | |
29 | #include "ArgumentCoders.h" |
30 | #include "Connection.h" |
31 | #include <wtf/Forward.h> |
32 | #include <wtf/ThreadSafeRefCounted.h> |
33 | #include <wtf/Vector.h> |
34 | #include <wtf/text/WTFString.h> |
35 | |
36 | namespace WebCore { |
37 | class IDBResultData; |
38 | class IDBResourceIdentifier; |
39 | class IDBError; |
40 | } |
41 | |
42 | namespace WebKit { |
43 | class WebIDBResult; |
44 | } |
45 | |
46 | namespace Messages { |
47 | namespace WebIDBConnectionToServer { |
48 | |
49 | static inline IPC::StringReference messageReceiverName() |
50 | { |
51 | return IPC::StringReference("WebIDBConnectionToServer" ); |
52 | } |
53 | |
54 | class DidDeleteDatabase { |
55 | public: |
56 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
57 | |
58 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
59 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteDatabase" ); } |
60 | static const bool isSync = false; |
61 | |
62 | explicit DidDeleteDatabase(const WebCore::IDBResultData& result) |
63 | : m_arguments(result) |
64 | { |
65 | } |
66 | |
67 | const Arguments& arguments() const |
68 | { |
69 | return m_arguments; |
70 | } |
71 | |
72 | private: |
73 | Arguments m_arguments; |
74 | }; |
75 | |
76 | class DidOpenDatabase { |
77 | public: |
78 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
79 | |
80 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
81 | static IPC::StringReference name() { return IPC::StringReference("DidOpenDatabase" ); } |
82 | static const bool isSync = false; |
83 | |
84 | explicit DidOpenDatabase(const WebCore::IDBResultData& result) |
85 | : m_arguments(result) |
86 | { |
87 | } |
88 | |
89 | const Arguments& arguments() const |
90 | { |
91 | return m_arguments; |
92 | } |
93 | |
94 | private: |
95 | Arguments m_arguments; |
96 | }; |
97 | |
98 | class DidAbortTransaction { |
99 | public: |
100 | typedef std::tuple<const WebCore::IDBResourceIdentifier&, const WebCore::IDBError&> Arguments; |
101 | |
102 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
103 | static IPC::StringReference name() { return IPC::StringReference("DidAbortTransaction" ); } |
104 | static const bool isSync = false; |
105 | |
106 | DidAbortTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError& error) |
107 | : m_arguments(transactionIdentifier, error) |
108 | { |
109 | } |
110 | |
111 | const Arguments& arguments() const |
112 | { |
113 | return m_arguments; |
114 | } |
115 | |
116 | private: |
117 | Arguments m_arguments; |
118 | }; |
119 | |
120 | class DidCommitTransaction { |
121 | public: |
122 | typedef std::tuple<const WebCore::IDBResourceIdentifier&, const WebCore::IDBError&> Arguments; |
123 | |
124 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
125 | static IPC::StringReference name() { return IPC::StringReference("DidCommitTransaction" ); } |
126 | static const bool isSync = false; |
127 | |
128 | DidCommitTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError& error) |
129 | : m_arguments(transactionIdentifier, error) |
130 | { |
131 | } |
132 | |
133 | const Arguments& arguments() const |
134 | { |
135 | return m_arguments; |
136 | } |
137 | |
138 | private: |
139 | Arguments m_arguments; |
140 | }; |
141 | |
142 | class DidCreateObjectStore { |
143 | public: |
144 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
145 | |
146 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
147 | static IPC::StringReference name() { return IPC::StringReference("DidCreateObjectStore" ); } |
148 | static const bool isSync = false; |
149 | |
150 | explicit DidCreateObjectStore(const WebCore::IDBResultData& result) |
151 | : m_arguments(result) |
152 | { |
153 | } |
154 | |
155 | const Arguments& arguments() const |
156 | { |
157 | return m_arguments; |
158 | } |
159 | |
160 | private: |
161 | Arguments m_arguments; |
162 | }; |
163 | |
164 | class DidDeleteObjectStore { |
165 | public: |
166 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
167 | |
168 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
169 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteObjectStore" ); } |
170 | static const bool isSync = false; |
171 | |
172 | explicit DidDeleteObjectStore(const WebCore::IDBResultData& result) |
173 | : m_arguments(result) |
174 | { |
175 | } |
176 | |
177 | const Arguments& arguments() const |
178 | { |
179 | return m_arguments; |
180 | } |
181 | |
182 | private: |
183 | Arguments m_arguments; |
184 | }; |
185 | |
186 | class DidRenameObjectStore { |
187 | public: |
188 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
189 | |
190 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
191 | static IPC::StringReference name() { return IPC::StringReference("DidRenameObjectStore" ); } |
192 | static const bool isSync = false; |
193 | |
194 | explicit DidRenameObjectStore(const WebCore::IDBResultData& result) |
195 | : m_arguments(result) |
196 | { |
197 | } |
198 | |
199 | const Arguments& arguments() const |
200 | { |
201 | return m_arguments; |
202 | } |
203 | |
204 | private: |
205 | Arguments m_arguments; |
206 | }; |
207 | |
208 | class DidClearObjectStore { |
209 | public: |
210 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
211 | |
212 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
213 | static IPC::StringReference name() { return IPC::StringReference("DidClearObjectStore" ); } |
214 | static const bool isSync = false; |
215 | |
216 | explicit DidClearObjectStore(const WebCore::IDBResultData& result) |
217 | : m_arguments(result) |
218 | { |
219 | } |
220 | |
221 | const Arguments& arguments() const |
222 | { |
223 | return m_arguments; |
224 | } |
225 | |
226 | private: |
227 | Arguments m_arguments; |
228 | }; |
229 | |
230 | class DidCreateIndex { |
231 | public: |
232 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
233 | |
234 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
235 | static IPC::StringReference name() { return IPC::StringReference("DidCreateIndex" ); } |
236 | static const bool isSync = false; |
237 | |
238 | explicit DidCreateIndex(const WebCore::IDBResultData& result) |
239 | : m_arguments(result) |
240 | { |
241 | } |
242 | |
243 | const Arguments& arguments() const |
244 | { |
245 | return m_arguments; |
246 | } |
247 | |
248 | private: |
249 | Arguments m_arguments; |
250 | }; |
251 | |
252 | class DidDeleteIndex { |
253 | public: |
254 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
255 | |
256 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
257 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteIndex" ); } |
258 | static const bool isSync = false; |
259 | |
260 | explicit DidDeleteIndex(const WebCore::IDBResultData& result) |
261 | : m_arguments(result) |
262 | { |
263 | } |
264 | |
265 | const Arguments& arguments() const |
266 | { |
267 | return m_arguments; |
268 | } |
269 | |
270 | private: |
271 | Arguments m_arguments; |
272 | }; |
273 | |
274 | class DidRenameIndex { |
275 | public: |
276 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
277 | |
278 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
279 | static IPC::StringReference name() { return IPC::StringReference("DidRenameIndex" ); } |
280 | static const bool isSync = false; |
281 | |
282 | explicit DidRenameIndex(const WebCore::IDBResultData& result) |
283 | : m_arguments(result) |
284 | { |
285 | } |
286 | |
287 | const Arguments& arguments() const |
288 | { |
289 | return m_arguments; |
290 | } |
291 | |
292 | private: |
293 | Arguments m_arguments; |
294 | }; |
295 | |
296 | class DidPutOrAdd { |
297 | public: |
298 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
299 | |
300 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
301 | static IPC::StringReference name() { return IPC::StringReference("DidPutOrAdd" ); } |
302 | static const bool isSync = false; |
303 | |
304 | explicit DidPutOrAdd(const WebCore::IDBResultData& result) |
305 | : m_arguments(result) |
306 | { |
307 | } |
308 | |
309 | const Arguments& arguments() const |
310 | { |
311 | return m_arguments; |
312 | } |
313 | |
314 | private: |
315 | Arguments m_arguments; |
316 | }; |
317 | |
318 | class DidGetRecord { |
319 | public: |
320 | typedef std::tuple<const WebKit::WebIDBResult&> Arguments; |
321 | |
322 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
323 | static IPC::StringReference name() { return IPC::StringReference("DidGetRecord" ); } |
324 | static const bool isSync = false; |
325 | |
326 | explicit DidGetRecord(const WebKit::WebIDBResult& result) |
327 | : m_arguments(result) |
328 | { |
329 | } |
330 | |
331 | const Arguments& arguments() const |
332 | { |
333 | return m_arguments; |
334 | } |
335 | |
336 | private: |
337 | Arguments m_arguments; |
338 | }; |
339 | |
340 | class DidGetAllRecords { |
341 | public: |
342 | typedef std::tuple<const WebKit::WebIDBResult&> Arguments; |
343 | |
344 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
345 | static IPC::StringReference name() { return IPC::StringReference("DidGetAllRecords" ); } |
346 | static const bool isSync = false; |
347 | |
348 | explicit DidGetAllRecords(const WebKit::WebIDBResult& result) |
349 | : m_arguments(result) |
350 | { |
351 | } |
352 | |
353 | const Arguments& arguments() const |
354 | { |
355 | return m_arguments; |
356 | } |
357 | |
358 | private: |
359 | Arguments m_arguments; |
360 | }; |
361 | |
362 | class DidGetCount { |
363 | public: |
364 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
365 | |
366 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
367 | static IPC::StringReference name() { return IPC::StringReference("DidGetCount" ); } |
368 | static const bool isSync = false; |
369 | |
370 | explicit DidGetCount(const WebCore::IDBResultData& result) |
371 | : m_arguments(result) |
372 | { |
373 | } |
374 | |
375 | const Arguments& arguments() const |
376 | { |
377 | return m_arguments; |
378 | } |
379 | |
380 | private: |
381 | Arguments m_arguments; |
382 | }; |
383 | |
384 | class DidDeleteRecord { |
385 | public: |
386 | typedef std::tuple<const WebCore::IDBResultData&> Arguments; |
387 | |
388 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
389 | static IPC::StringReference name() { return IPC::StringReference("DidDeleteRecord" ); } |
390 | static const bool isSync = false; |
391 | |
392 | explicit DidDeleteRecord(const WebCore::IDBResultData& result) |
393 | : m_arguments(result) |
394 | { |
395 | } |
396 | |
397 | const Arguments& arguments() const |
398 | { |
399 | return m_arguments; |
400 | } |
401 | |
402 | private: |
403 | Arguments m_arguments; |
404 | }; |
405 | |
406 | class DidOpenCursor { |
407 | public: |
408 | typedef std::tuple<const WebKit::WebIDBResult&> Arguments; |
409 | |
410 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
411 | static IPC::StringReference name() { return IPC::StringReference("DidOpenCursor" ); } |
412 | static const bool isSync = false; |
413 | |
414 | explicit DidOpenCursor(const WebKit::WebIDBResult& result) |
415 | : m_arguments(result) |
416 | { |
417 | } |
418 | |
419 | const Arguments& arguments() const |
420 | { |
421 | return m_arguments; |
422 | } |
423 | |
424 | private: |
425 | Arguments m_arguments; |
426 | }; |
427 | |
428 | class DidIterateCursor { |
429 | public: |
430 | typedef std::tuple<const WebKit::WebIDBResult&> Arguments; |
431 | |
432 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
433 | static IPC::StringReference name() { return IPC::StringReference("DidIterateCursor" ); } |
434 | static const bool isSync = false; |
435 | |
436 | explicit DidIterateCursor(const WebKit::WebIDBResult& result) |
437 | : m_arguments(result) |
438 | { |
439 | } |
440 | |
441 | const Arguments& arguments() const |
442 | { |
443 | return m_arguments; |
444 | } |
445 | |
446 | private: |
447 | Arguments m_arguments; |
448 | }; |
449 | |
450 | class FireVersionChangeEvent { |
451 | public: |
452 | typedef std::tuple<uint64_t, const WebCore::IDBResourceIdentifier&, uint64_t> Arguments; |
453 | |
454 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
455 | static IPC::StringReference name() { return IPC::StringReference("FireVersionChangeEvent" ); } |
456 | static const bool isSync = false; |
457 | |
458 | FireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion) |
459 | : m_arguments(databaseConnectionIdentifier, requestIdentifier, requestedVersion) |
460 | { |
461 | } |
462 | |
463 | const Arguments& arguments() const |
464 | { |
465 | return m_arguments; |
466 | } |
467 | |
468 | private: |
469 | Arguments m_arguments; |
470 | }; |
471 | |
472 | class DidStartTransaction { |
473 | public: |
474 | typedef std::tuple<const WebCore::IDBResourceIdentifier&, const WebCore::IDBError&> Arguments; |
475 | |
476 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
477 | static IPC::StringReference name() { return IPC::StringReference("DidStartTransaction" ); } |
478 | static const bool isSync = false; |
479 | |
480 | DidStartTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError& error) |
481 | : m_arguments(transactionIdentifier, error) |
482 | { |
483 | } |
484 | |
485 | const Arguments& arguments() const |
486 | { |
487 | return m_arguments; |
488 | } |
489 | |
490 | private: |
491 | Arguments m_arguments; |
492 | }; |
493 | |
494 | class DidCloseFromServer { |
495 | public: |
496 | typedef std::tuple<uint64_t, const WebCore::IDBError&> Arguments; |
497 | |
498 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
499 | static IPC::StringReference name() { return IPC::StringReference("DidCloseFromServer" ); } |
500 | static const bool isSync = false; |
501 | |
502 | DidCloseFromServer(uint64_t databaseConnectionIdentifier, const WebCore::IDBError& error) |
503 | : m_arguments(databaseConnectionIdentifier, error) |
504 | { |
505 | } |
506 | |
507 | const Arguments& arguments() const |
508 | { |
509 | return m_arguments; |
510 | } |
511 | |
512 | private: |
513 | Arguments m_arguments; |
514 | }; |
515 | |
516 | class NotifyOpenDBRequestBlocked { |
517 | public: |
518 | typedef std::tuple<const WebCore::IDBResourceIdentifier&, uint64_t, uint64_t> Arguments; |
519 | |
520 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
521 | static IPC::StringReference name() { return IPC::StringReference("NotifyOpenDBRequestBlocked" ); } |
522 | static const bool isSync = false; |
523 | |
524 | NotifyOpenDBRequestBlocked(const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) |
525 | : m_arguments(requestIdentifier, oldVersion, newVersion) |
526 | { |
527 | } |
528 | |
529 | const Arguments& arguments() const |
530 | { |
531 | return m_arguments; |
532 | } |
533 | |
534 | private: |
535 | Arguments m_arguments; |
536 | }; |
537 | |
538 | class DidGetAllDatabaseNames { |
539 | public: |
540 | typedef std::tuple<uint64_t, const Vector<String>&> Arguments; |
541 | |
542 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
543 | static IPC::StringReference name() { return IPC::StringReference("DidGetAllDatabaseNames" ); } |
544 | static const bool isSync = false; |
545 | |
546 | DidGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) |
547 | : m_arguments(callbackID, databaseNames) |
548 | { |
549 | } |
550 | |
551 | const Arguments& arguments() const |
552 | { |
553 | return m_arguments; |
554 | } |
555 | |
556 | private: |
557 | Arguments m_arguments; |
558 | }; |
559 | |
560 | } // namespace WebIDBConnectionToServer |
561 | } // namespace Messages |
562 | |
563 | #endif // ENABLE(INDEXED_DATABASE) |
564 | |