[Attachment Support] Introduce data structures and IPC support for writing promised...
[WebKit-https.git] / Source / WebKit / Shared / WebCoreArgumentCoders.h
1 /*
2  * Copyright (C) 2010-2017 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''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #pragma once
27
28 #include "ArgumentCoders.h"
29 #include <WebCore/AutoplayEvent.h>
30 #include <WebCore/CacheStorageConnection.h>
31 #include <WebCore/CaptureDevice.h>
32 #include <WebCore/ColorSpace.h>
33 #include <WebCore/DiagnosticLoggingClient.h>
34 #include <WebCore/FrameLoaderTypes.h>
35 #include <WebCore/IndexedDB.h>
36 #include <WebCore/MediaSelectionOption.h>
37 #include <WebCore/NetworkLoadMetrics.h>
38 #include <WebCore/NotificationDirection.h>
39 #include <WebCore/PaymentHeaders.h>
40 #include <WebCore/RealtimeMediaSource.h>
41 #include <WebCore/ScrollSnapOffsetsInfo.h>
42 #include <WebCore/ServiceWorkerTypes.h>
43 #include <WebCore/StoredCredentialsPolicy.h>
44 #include <WebCore/WorkerType.h>
45
46 namespace WTF {
47 class MonotonicTime;
48 class Seconds;
49 class WallTime;
50 }
51
52 namespace WebCore {
53 class AffineTransform;
54 class AuthenticationChallenge;
55 class BlobPart;
56 class CertificateInfo;
57 class Color;
58 class Credential;
59 class CubicBezierTimingFunction;
60 class Cursor;
61 class DatabaseDetails;
62 class DragData;
63 class FilterOperation;
64 class FilterOperations;
65 class FloatPoint;
66 class FloatPoint3D;
67 class FloatRect;
68 class FloatRoundedRect;
69 class FloatSize;
70 class FixedPositionViewportConstraints;
71 class HTTPHeaderMap;
72 class IntPoint;
73 class IntRect;
74 class IntSize;
75 class KeyframeValueList;
76 class LayoutSize;
77 class LayoutPoint;
78 class LinearTimingFunction;
79 class Notification;
80 class Path;
81 class ProtectionSpace;
82 class Region;
83 class ResourceError;
84 class ResourceRequest;
85 class ResourceResponse;
86 class SpringTimingFunction;
87 class StepsTimingFunction;
88 class StickyPositionViewportConstraints;
89 class TextCheckingRequestData;
90 class TransformationMatrix;
91 class UserStyleSheet;
92 class URL;
93
94 struct CacheQueryOptions;
95 struct CompositionUnderline;
96 struct DictationAlternative;
97 struct DictionaryPopupInfo;
98 struct EventTrackingRegions;
99 struct ExceptionDetails;
100 struct FileChooserSettings;
101 struct Length;
102 struct GrammarDetail;
103 struct MimeClassInfo;
104 struct PasteboardImage;
105 struct PasteboardCustomData;
106 struct PasteboardURL;
107 struct PluginInfo;
108 struct PromisedBlobData;
109 struct PromisedBlobInfo;
110 struct RecentSearch;
111 struct ResourceLoadStatistics;
112 struct ScrollableAreaParameters;
113 struct TextCheckingResult;
114 struct TextIndicatorData;
115 struct ViewportAttributes;
116 struct WindowFeatures;
117     
118 template <typename> class RectEdges;
119 using FloatBoxExtent = RectEdges<float>;
120
121 #if PLATFORM(COCOA)
122 class MachSendRight;
123 struct KeypressCommand;
124 #endif
125
126 #if PLATFORM(IOS)
127 class FloatQuad;
128 class SelectionRect;
129 struct Highlight;
130 struct PasteboardImage;
131 struct PasteboardWebContent;
132 struct ViewportArguments;
133 #endif
134
135 #if USE(SOUP)
136 struct SoupNetworkProxySettings;
137 #endif
138
139 #if PLATFORM(WPE)
140 struct PasteboardWebContent;
141 #endif
142
143 #if ENABLE(CONTENT_FILTERING)
144 class ContentFilterUnblockHandler;
145 #endif
146
147 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
148 class MediaPlaybackTargetContext;
149 #endif
150
151 #if ENABLE(MEDIA_SESSION)
152 class MediaSessionMetadata;
153 #endif
154
155 #if ENABLE(MEDIA_STREAM)
156 class CaptureDevice;
157 struct MediaConstraints;
158 #endif
159
160 #if ENABLE(INDEXED_DATABASE)
161 using IDBKeyPath = Variant<String, Vector<String>>;
162 #endif
163 }
164
165 namespace IPC {
166
167 template<> struct ArgumentCoder<WTF::MonotonicTime> {
168     static void encode(Encoder&, const WTF::MonotonicTime&);
169     static bool decode(Decoder&, WTF::MonotonicTime&);
170 };
171
172 template<> struct ArgumentCoder<WTF::WallTime> {
173     static void encode(Encoder&, const WTF::WallTime&);
174     static bool decode(Decoder&, WTF::WallTime&);
175 };
176
177 template<> struct ArgumentCoder<WTF::Seconds> {
178     static void encode(Encoder&, const WTF::Seconds&);
179     static bool decode(Decoder&, WTF::Seconds&);
180 };
181
182 template<> struct ArgumentCoder<WebCore::AffineTransform> {
183     static void encode(Encoder&, const WebCore::AffineTransform&);
184     static bool decode(Decoder&, WebCore::AffineTransform&);
185 };
186
187 template<> struct ArgumentCoder<WebCore::CacheQueryOptions> {
188     static void encode(Encoder&, const WebCore::CacheQueryOptions&);
189     static bool decode(Decoder&, WebCore::CacheQueryOptions&);
190 };
191
192 template<> struct ArgumentCoder<WebCore::DOMCacheEngine::CacheInfo> {
193     static void encode(Encoder&, const WebCore::DOMCacheEngine::CacheInfo&);
194     static std::optional<WebCore::DOMCacheEngine::CacheInfo> decode(Decoder&);
195 };
196
197 template<> struct ArgumentCoder<WebCore::DOMCacheEngine::Record> {
198     static void encode(Encoder&, const WebCore::DOMCacheEngine::Record&);
199     static std::optional<WebCore::DOMCacheEngine::Record> decode(Decoder&);
200 };
201
202 template<> struct ArgumentCoder<WebCore::EventTrackingRegions> {
203     static void encode(Encoder&, const WebCore::EventTrackingRegions&);
204     static bool decode(Decoder&, WebCore::EventTrackingRegions&);
205 };
206
207 template<> struct ArgumentCoder<WebCore::TransformationMatrix> {
208     static void encode(Encoder&, const WebCore::TransformationMatrix&);
209     static bool decode(Decoder&, WebCore::TransformationMatrix&);
210 };
211
212 template<> struct ArgumentCoder<WebCore::LinearTimingFunction> {
213     static void encode(Encoder&, const WebCore::LinearTimingFunction&);
214     static bool decode(Decoder&, WebCore::LinearTimingFunction&);
215 };
216
217 template<> struct ArgumentCoder<WebCore::CubicBezierTimingFunction> {
218     static void encode(Encoder&, const WebCore::CubicBezierTimingFunction&);
219     static bool decode(Decoder&, WebCore::CubicBezierTimingFunction&);
220 };
221
222 template<> struct ArgumentCoder<WebCore::StepsTimingFunction> {
223     static void encode(Encoder&, const WebCore::StepsTimingFunction&);
224     static bool decode(Decoder&, WebCore::StepsTimingFunction&);
225 };
226
227 template<> struct ArgumentCoder<WebCore::SpringTimingFunction> {
228     static void encode(Encoder&, const WebCore::SpringTimingFunction&);
229     static bool decode(Decoder&, WebCore::SpringTimingFunction&);
230 };
231
232 template<> struct ArgumentCoder<WebCore::CertificateInfo> {
233     static void encode(Encoder&, const WebCore::CertificateInfo&);
234     static bool decode(Decoder&, WebCore::CertificateInfo&);
235 };
236
237 template<> struct ArgumentCoder<WebCore::FloatPoint> {
238     static void encode(Encoder&, const WebCore::FloatPoint&);
239     static bool decode(Decoder&, WebCore::FloatPoint&);
240     static std::optional<WebCore::FloatPoint> decode(Decoder&);
241 };
242
243 template<> struct ArgumentCoder<WebCore::FloatPoint3D> {
244     static void encode(Encoder&, const WebCore::FloatPoint3D&);
245     static bool decode(Decoder&, WebCore::FloatPoint3D&);
246 };
247
248 template<> struct ArgumentCoder<WebCore::FloatRect> {
249     static void encode(Encoder&, const WebCore::FloatRect&);
250     static bool decode(Decoder&, WebCore::FloatRect&);
251     static std::optional<WebCore::FloatRect> decode(Decoder&);
252 };
253     
254 template<> struct ArgumentCoder<WebCore::FloatBoxExtent> {
255     static void encode(Encoder&, const WebCore::FloatBoxExtent&);
256     static bool decode(Decoder&, WebCore::FloatBoxExtent&);
257 };
258
259 template<> struct ArgumentCoder<WebCore::FloatSize> {
260     static void encode(Encoder&, const WebCore::FloatSize&);
261     static bool decode(Decoder&, WebCore::FloatSize&);
262 };
263
264 template<> struct ArgumentCoder<WebCore::FloatRoundedRect> {
265     static void encode(Encoder&, const WebCore::FloatRoundedRect&);
266     static bool decode(Decoder&, WebCore::FloatRoundedRect&);
267 };
268
269 #if PLATFORM(IOS)
270 template<> struct ArgumentCoder<WebCore::FloatQuad> {
271     static void encode(Encoder&, const WebCore::FloatQuad&);
272     static std::optional<WebCore::FloatQuad> decode(Decoder&);
273 };
274
275 template<> struct ArgumentCoder<WebCore::ViewportArguments> {
276     static void encode(Encoder&, const WebCore::ViewportArguments&);
277     static bool decode(Decoder&, WebCore::ViewportArguments&);
278 };
279 #endif // PLATFORM(IOS)
280
281 template<> struct ArgumentCoder<WebCore::IntPoint> {
282     static void encode(Encoder&, const WebCore::IntPoint&);
283     static bool decode(Decoder&, WebCore::IntPoint&);
284     static std::optional<WebCore::IntPoint> decode(Decoder&);
285 };
286
287 template<> struct ArgumentCoder<WebCore::IntRect> {
288     static void encode(Encoder&, const WebCore::IntRect&);
289     static bool decode(Decoder&, WebCore::IntRect&);
290     static std::optional<WebCore::IntRect> decode(Decoder&);
291 };
292
293 template<> struct ArgumentCoder<WebCore::IntSize> {
294     static void encode(Encoder&, const WebCore::IntSize&);
295     static bool decode(Decoder&, WebCore::IntSize&);
296     static std::optional<WebCore::IntSize> decode(Decoder&);
297 };
298
299 template<> struct ArgumentCoder<WebCore::LayoutSize> {
300     static void encode(Encoder&, const WebCore::LayoutSize&);
301     static bool decode(Decoder&, WebCore::LayoutSize&);
302 };
303
304 template<> struct ArgumentCoder<WebCore::LayoutPoint> {
305     static void encode(Encoder&, const WebCore::LayoutPoint&);
306     static bool decode(Decoder&, WebCore::LayoutPoint&);
307 };
308
309 template<> struct ArgumentCoder<WebCore::Path> {
310     static void encode(Encoder&, const WebCore::Path&);
311     static bool decode(Decoder&, WebCore::Path&);
312 };
313
314 template<> struct ArgumentCoder<WebCore::Region> {
315     static void encode(Encoder&, const WebCore::Region&);
316     static bool decode(Decoder&, WebCore::Region&);
317 };
318
319 template<> struct ArgumentCoder<WebCore::Length> {
320     static void encode(Encoder&, const WebCore::Length&);
321     static bool decode(Decoder&, WebCore::Length&);
322 };
323
324 template<> struct ArgumentCoder<WebCore::ViewportAttributes> {
325     static void encode(Encoder&, const WebCore::ViewportAttributes&);
326     static bool decode(Decoder&, WebCore::ViewportAttributes&);
327 };
328
329 template<> struct ArgumentCoder<WebCore::MimeClassInfo> {
330     static void encode(Encoder&, const WebCore::MimeClassInfo&);
331     static std::optional<WebCore::MimeClassInfo> decode(Decoder&);
332 };
333
334 template<> struct ArgumentCoder<WebCore::PluginInfo> {
335     static void encode(Encoder&, const WebCore::PluginInfo&);
336     static std::optional<WebCore::PluginInfo> decode(Decoder&);
337 };
338
339 template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> {
340     static void encode(Encoder&, const WebCore::AuthenticationChallenge&);
341     static bool decode(Decoder&, WebCore::AuthenticationChallenge&);
342 };
343
344 template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
345     static void encode(Encoder&, const WebCore::ProtectionSpace&);
346     static bool decode(Decoder&, WebCore::ProtectionSpace&);
347     static void encodePlatformData(Encoder&, const WebCore::ProtectionSpace&);
348     static bool decodePlatformData(Decoder&, WebCore::ProtectionSpace&);
349 };
350
351 template<> struct ArgumentCoder<WebCore::Credential> {
352     static void encode(Encoder&, const WebCore::Credential&);
353     static bool decode(Decoder&, WebCore::Credential&);
354     static void encodePlatformData(Encoder&, const WebCore::Credential&);
355     static bool decodePlatformData(Decoder&, WebCore::Credential&);
356 };
357
358 template<> struct ArgumentCoder<WebCore::Cursor> {
359     static void encode(Encoder&, const WebCore::Cursor&);
360     static bool decode(Decoder&, WebCore::Cursor&);
361 };
362
363 template<> struct ArgumentCoder<WebCore::ResourceRequest> {
364     static void encode(Encoder&, const WebCore::ResourceRequest&);
365     static bool decode(Decoder&, WebCore::ResourceRequest&);
366     static void encodePlatformData(Encoder&, const WebCore::ResourceRequest&);
367     static bool decodePlatformData(Decoder&, WebCore::ResourceRequest&);
368 };
369
370 template<> struct ArgumentCoder<WebCore::ResourceError> {
371     static void encode(Encoder&, const WebCore::ResourceError&);
372     static bool decode(Decoder&, WebCore::ResourceError&);
373     static void encodePlatformData(Encoder&, const WebCore::ResourceError&);
374     static bool decodePlatformData(Decoder&, WebCore::ResourceError&);
375 };
376
377 template<> struct ArgumentCoder<WebCore::WindowFeatures> {
378     static void encode(Encoder&, const WebCore::WindowFeatures&);
379     static bool decode(Decoder&, WebCore::WindowFeatures&);
380 };
381
382 template<> struct ArgumentCoder<WebCore::Color> {
383     static void encode(Encoder&, const WebCore::Color&);
384     static bool decode(Decoder&, WebCore::Color&);
385 };
386
387 #if ENABLE(DRAG_SUPPORT)
388 template<> struct ArgumentCoder<WebCore::DragData> {
389     static void encode(Encoder&, const WebCore::DragData&);
390     static bool decode(Decoder&, WebCore::DragData&);
391 };
392 #endif
393
394 #if PLATFORM(COCOA)
395 template<> struct ArgumentCoder<WebCore::MachSendRight> {
396     static void encode(Encoder&, const WebCore::MachSendRight&);
397     static void encode(Encoder&, WebCore::MachSendRight&&);
398     static bool decode(Decoder&, WebCore::MachSendRight&);
399 };
400
401 template<> struct ArgumentCoder<WebCore::KeypressCommand> {
402     static void encode(Encoder&, const WebCore::KeypressCommand&);
403     static std::optional<WebCore::KeypressCommand> decode(Decoder&);
404 };
405 #endif
406
407 #if PLATFORM(IOS)
408 template<> struct ArgumentCoder<WebCore::SelectionRect> {
409     static void encode(Encoder&, const WebCore::SelectionRect&);
410     static std::optional<WebCore::SelectionRect> decode(Decoder&);
411 };
412
413 template<> struct ArgumentCoder<WebCore::Highlight> {
414     static void encode(Encoder&, const WebCore::Highlight&);
415     static bool decode(Decoder&, WebCore::Highlight&);
416 };
417
418 template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
419     static void encode(Encoder&, const WebCore::PasteboardWebContent&);
420     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
421 };
422
423 template<> struct ArgumentCoder<WebCore::PasteboardURL> {
424     static void encode(Encoder&, const WebCore::PasteboardURL&);
425     static bool decode(Decoder&, WebCore::PasteboardURL&);
426 };
427
428 template<> struct ArgumentCoder<WebCore::PasteboardImage> {
429     static void encode(Encoder&, const WebCore::PasteboardImage&);
430     static bool decode(Decoder&, WebCore::PasteboardImage&);
431 };
432 #endif
433
434 template<> struct ArgumentCoder<WebCore::PasteboardCustomData> {
435     static void encode(Encoder&, const WebCore::PasteboardCustomData&);
436     static bool decode(Decoder&, WebCore::PasteboardCustomData&);
437 };
438
439 #if USE(SOUP)
440 template<> struct ArgumentCoder<WebCore::SoupNetworkProxySettings> {
441     static void encode(Encoder&, const WebCore::SoupNetworkProxySettings&);
442     static bool decode(Decoder&, WebCore::SoupNetworkProxySettings&);
443 };
444 #endif
445
446 #if PLATFORM(WPE)
447 template<> struct ArgumentCoder<WebCore::PasteboardWebContent> {
448     static void encode(Encoder&, const WebCore::PasteboardWebContent&);
449     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
450 };
451 #endif
452
453 template<> struct ArgumentCoder<WebCore::CompositionUnderline> {
454     static void encode(Encoder&, const WebCore::CompositionUnderline&);
455     static std::optional<WebCore::CompositionUnderline> decode(Decoder&);
456 };
457
458 template<> struct ArgumentCoder<WebCore::DatabaseDetails> {
459     static void encode(Encoder&, const WebCore::DatabaseDetails&);
460     static bool decode(Decoder&, WebCore::DatabaseDetails&);
461 };
462
463 template<> struct ArgumentCoder<WebCore::DictationAlternative> {
464     static void encode(Encoder&, const WebCore::DictationAlternative&);
465     static std::optional<WebCore::DictationAlternative> decode(Decoder&);
466 };
467
468 template<> struct ArgumentCoder<WebCore::FileChooserSettings> {
469     static void encode(Encoder&, const WebCore::FileChooserSettings&);
470     static bool decode(Decoder&, WebCore::FileChooserSettings&);
471 };
472
473 template<> struct ArgumentCoder<WebCore::GrammarDetail> {
474     static void encode(Encoder&, const WebCore::GrammarDetail&);
475     static std::optional<WebCore::GrammarDetail> decode(Decoder&);
476 };
477
478 template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> {
479     static void encode(Encoder&, const WebCore::TextCheckingRequestData&);
480     static bool decode(Decoder&, WebCore::TextCheckingRequestData&);
481 };
482
483 template<> struct ArgumentCoder<WebCore::TextCheckingResult> {
484     static void encode(Encoder&, const WebCore::TextCheckingResult&);
485     static std::optional<WebCore::TextCheckingResult> decode(Decoder&);
486 };
487
488 template<> struct ArgumentCoder<WebCore::UserStyleSheet> {
489     static void encode(Encoder&, const WebCore::UserStyleSheet&);
490     static bool decode(Decoder&, WebCore::UserStyleSheet&);
491 };
492
493 template<> struct ArgumentCoder<WebCore::ScrollableAreaParameters> {
494     static void encode(Encoder&, const WebCore::ScrollableAreaParameters&);
495     static bool decode(Decoder&, WebCore::ScrollableAreaParameters&);
496 };
497
498 template<> struct ArgumentCoder<WebCore::FixedPositionViewportConstraints> {
499     static void encode(Encoder&, const WebCore::FixedPositionViewportConstraints&);
500     static bool decode(Decoder&, WebCore::FixedPositionViewportConstraints&);
501 };
502
503 template<> struct ArgumentCoder<WebCore::StickyPositionViewportConstraints> {
504     static void encode(Encoder&, const WebCore::StickyPositionViewportConstraints&);
505     static bool decode(Decoder&, WebCore::StickyPositionViewportConstraints&);
506 };
507
508 #if !USE(COORDINATED_GRAPHICS)
509 template<> struct ArgumentCoder<WebCore::FilterOperations> {
510     static void encode(Encoder&, const WebCore::FilterOperations&);
511     static bool decode(Decoder&, WebCore::FilterOperations&);
512 };
513     
514 template<> struct ArgumentCoder<WebCore::FilterOperation> {
515     static void encode(Encoder&, const WebCore::FilterOperation&);
516 };
517 bool decodeFilterOperation(Decoder&, RefPtr<WebCore::FilterOperation>&);
518 #endif
519
520 template<> struct ArgumentCoder<WebCore::BlobPart> {
521     static void encode(Encoder&, const WebCore::BlobPart&);
522     static std::optional<WebCore::BlobPart> decode(Decoder&);
523 };
524
525 #if ENABLE(CONTENT_FILTERING)
526 template<> struct ArgumentCoder<WebCore::ContentFilterUnblockHandler> {
527     static void encode(Encoder&, const WebCore::ContentFilterUnblockHandler&);
528     static bool decode(Decoder&, WebCore::ContentFilterUnblockHandler&);
529 };
530 #endif
531
532 #if ENABLE(MEDIA_SESSION)
533 template<> struct ArgumentCoder<WebCore::MediaSessionMetadata> {
534     static void encode(Encoder&, const WebCore::MediaSessionMetadata&);
535     static bool decode(Decoder&, WebCore::MediaSessionMetadata&);
536 };
537 #endif
538
539 template<> struct ArgumentCoder<WebCore::TextIndicatorData> {
540     static void encode(Encoder&, const WebCore::TextIndicatorData&);
541     static std::optional<WebCore::TextIndicatorData> decode(Decoder&);
542 };
543
544 template<> struct ArgumentCoder<WebCore::DictionaryPopupInfo> {
545     static void encode(Encoder&, const WebCore::DictionaryPopupInfo&);
546     static bool decode(Decoder&, WebCore::DictionaryPopupInfo&);
547 };
548
549 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
550 template<> struct ArgumentCoder<WebCore::MediaPlaybackTargetContext> {
551     static void encode(Encoder&, const WebCore::MediaPlaybackTargetContext&);
552     static bool decode(Decoder&, WebCore::MediaPlaybackTargetContext&);
553     static void encodePlatformData(Encoder&, const WebCore::MediaPlaybackTargetContext&);
554     static bool decodePlatformData(Decoder&, WebCore::MediaPlaybackTargetContext&);
555 };
556 #endif
557
558 template<> struct ArgumentCoder<WebCore::RecentSearch> {
559     static void encode(Encoder&, const WebCore::RecentSearch&);
560     static std::optional<WebCore::RecentSearch> decode(Decoder&);
561 };
562
563 template<> struct ArgumentCoder<WebCore::ExceptionDetails> {
564     static void encode(Encoder&, const WebCore::ExceptionDetails&);
565     static bool decode(Decoder&, WebCore::ExceptionDetails&);
566 };
567
568 template<> struct ArgumentCoder<WebCore::ResourceLoadStatistics> {
569     static void encode(Encoder&, const WebCore::ResourceLoadStatistics&);
570     static std::optional<WebCore::ResourceLoadStatistics> decode(Decoder&);
571 };
572
573 #if ENABLE(APPLE_PAY)
574
575 template<> struct ArgumentCoder<WebCore::Payment> {
576     static void encode(Encoder&, const WebCore::Payment&);
577     static bool decode(Decoder&, WebCore::Payment&);
578 };
579
580 template<> struct ArgumentCoder<WebCore::PaymentAuthorizationResult> {
581     static void encode(Encoder&, const WebCore::PaymentAuthorizationResult&);
582     static std::optional<WebCore::PaymentAuthorizationResult> decode(Decoder&);
583 };
584
585 template<> struct ArgumentCoder<WebCore::PaymentContact> {
586     static void encode(Encoder&, const WebCore::PaymentContact&);
587     static bool decode(Decoder&, WebCore::PaymentContact&);
588 };
589
590 template<> struct ArgumentCoder<WebCore::PaymentError> {
591     static void encode(Encoder&, const WebCore::PaymentError&);
592     static std::optional<WebCore::PaymentError> decode(Decoder&);
593 };
594
595 template<> struct ArgumentCoder<WebCore::PaymentMerchantSession> {
596     static void encode(Encoder&, const WebCore::PaymentMerchantSession&);
597     static bool decode(Decoder&, WebCore::PaymentMerchantSession&);
598 };
599
600 template<> struct ArgumentCoder<WebCore::PaymentMethod> {
601     static void encode(Encoder&, const WebCore::PaymentMethod&);
602     static bool decode(Decoder&, WebCore::PaymentMethod&);
603 };
604
605 template<> struct ArgumentCoder<WebCore::PaymentMethodUpdate> {
606     static void encode(Encoder&, const WebCore::PaymentMethodUpdate&);
607     static std::optional<WebCore::PaymentMethodUpdate> decode(Decoder&);
608 };
609
610 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest> {
611     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest&);
612     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest&);
613 };
614
615 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ContactFields> {
616     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ContactFields&);
617     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::ContactFields&);
618 };
619
620 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::LineItem> {
621     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::LineItem&);
622     static std::optional<WebCore::ApplePaySessionPaymentRequest::LineItem> decode(Decoder&);
623 };
624
625 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities> {
626     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
627     static bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
628 };
629
630 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> {
631     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::ShippingMethod&);
632     static std::optional<WebCore::ApplePaySessionPaymentRequest::ShippingMethod> decode(Decoder&);
633 };
634
635 template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> {
636     static void encode(Encoder&, const WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems&);
637     static std::optional<WebCore::ApplePaySessionPaymentRequest::TotalAndLineItems> decode(Decoder&);
638 };
639
640 template<> struct ArgumentCoder<WebCore::ShippingContactUpdate> {
641     static void encode(Encoder&, const WebCore::ShippingContactUpdate&);
642     static std::optional<WebCore::ShippingContactUpdate> decode(Decoder&);
643 };
644
645 template<> struct ArgumentCoder<WebCore::ShippingMethodUpdate> {
646     static void encode(Encoder&, const WebCore::ShippingMethodUpdate&);
647     static std::optional<WebCore::ShippingMethodUpdate> decode(Decoder&);
648 };
649
650 #endif
651
652 #if ENABLE(MEDIA_STREAM)
653 template<> struct ArgumentCoder<WebCore::MediaConstraints> {
654     static void encode(Encoder&, const WebCore::MediaConstraints&);
655     static bool decode(Decoder&, WebCore::MediaConstraints&);
656 };
657
658 template<> struct ArgumentCoder<WebCore::CaptureDevice> {
659     static void encode(Encoder&, const WebCore::CaptureDevice&);
660     static std::optional<WebCore::CaptureDevice> decode(Decoder&);
661 };
662 #endif
663
664 #if ENABLE(INDEXED_DATABASE)
665
666 template<> struct ArgumentCoder<WebCore::IDBKeyPath> {
667     static void encode(Encoder&, const WebCore::IDBKeyPath&);
668     static bool decode(Decoder&, WebCore::IDBKeyPath&);
669 };
670
671 #endif
672
673 #if ENABLE(SERVICE_WORKER)
674
675 template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientData> {
676     static void encode(Encoder&, const WebCore::ServiceWorkerOrClientData&);
677     static bool decode(Decoder&, WebCore::ServiceWorkerOrClientData&);
678 };
679
680 template<> struct ArgumentCoder<WebCore::ServiceWorkerOrClientIdentifier> {
681     static void encode(Encoder&, const WebCore::ServiceWorkerOrClientIdentifier&);
682     static bool decode(Decoder&, WebCore::ServiceWorkerOrClientIdentifier&);
683 };
684
685 #endif
686
687 #if ENABLE(CSS_SCROLL_SNAP)
688
689 template<> struct ArgumentCoder<WebCore::ScrollOffsetRange<float>> {
690     static void encode(Encoder&, const WebCore::ScrollOffsetRange<float>&);
691     static std::optional<WebCore::ScrollOffsetRange<float>> decode(Decoder&);
692 };
693
694 #endif
695
696 template<> struct ArgumentCoder<WebCore::MediaSelectionOption> {
697     static void encode(Encoder&, const WebCore::MediaSelectionOption&);
698     static std::optional<WebCore::MediaSelectionOption> decode(Decoder&);
699 };
700
701 template<> struct ArgumentCoder<WebCore::PromisedBlobData> {
702     static void encode(Encoder&, const WebCore::PromisedBlobData&);
703     static bool decode(Decoder&, WebCore::PromisedBlobData&);
704 };
705
706 template<> struct ArgumentCoder<WebCore::PromisedBlobInfo> {
707     static void encode(Encoder&, const WebCore::PromisedBlobInfo&);
708     static bool decode(Decoder&, WebCore::PromisedBlobInfo&);
709 };
710
711 } // namespace IPC
712
713 namespace WTF {
714
715 template<> struct EnumTraits<WebCore::ColorSpace> {
716     using values = EnumValues<
717     WebCore::ColorSpace,
718     WebCore::ColorSpace::ColorSpaceSRGB,
719     WebCore::ColorSpace::ColorSpaceLinearRGB,
720     WebCore::ColorSpace::ColorSpaceDisplayP3
721     >;
722 };
723
724 template<> struct EnumTraits<WebCore::HasInsecureContent> {
725     using values = EnumValues<
726         WebCore::HasInsecureContent,
727         WebCore::HasInsecureContent::No,
728         WebCore::HasInsecureContent::Yes
729     >;
730 };
731
732 template<> struct EnumTraits<WebCore::AutoplayEvent> {
733     using values = EnumValues<
734         WebCore::AutoplayEvent,
735         WebCore::AutoplayEvent::DidPreventMediaFromPlaying,
736         WebCore::AutoplayEvent::DidPlayMediaPreventedFromPlaying,
737         WebCore::AutoplayEvent::DidAutoplayMediaPastThresholdWithoutUserInterference,
738         WebCore::AutoplayEvent::UserDidInterfereWithPlayback
739     >;
740 };
741
742 template<> struct EnumTraits<WebCore::ShouldSample> {
743     using values = EnumValues<
744         WebCore::ShouldSample,
745         WebCore::ShouldSample::No,
746         WebCore::ShouldSample::Yes
747     >;
748 };
749
750 template<> struct EnumTraits<WebCore::NetworkLoadPriority> {
751     using values = EnumValues<
752         WebCore::NetworkLoadPriority,
753         WebCore::NetworkLoadPriority::Low,
754         WebCore::NetworkLoadPriority::Medium,
755         WebCore::NetworkLoadPriority::High
756     >;
757 };
758
759 template<> struct EnumTraits<WebCore::NotificationDirection> {
760     using values = EnumValues<
761         WebCore::NotificationDirection,
762         WebCore::NotificationDirection::Auto,
763         WebCore::NotificationDirection::Ltr,
764         WebCore::NotificationDirection::Rtl
765     >;
766 };
767
768 #if ENABLE(INDEXED_DATABASE)
769 template<> struct EnumTraits<WebCore::IndexedDB::GetAllType> {
770     using values = EnumValues<
771         WebCore::IndexedDB::GetAllType,
772         WebCore::IndexedDB::GetAllType::Keys,
773         WebCore::IndexedDB::GetAllType::Values
774     >;
775 };
776 #endif
777
778 #if ENABLE(MEDIA_STREAM)
779 template<> struct EnumTraits<WebCore::CaptureDevice::DeviceType> {
780     using values = EnumValues<
781         WebCore::CaptureDevice::DeviceType,
782         WebCore::CaptureDevice::DeviceType::Unknown,
783         WebCore::CaptureDevice::DeviceType::Microphone,
784         WebCore::CaptureDevice::DeviceType::Camera
785     >;
786 };
787 template<> struct EnumTraits<WebCore::RealtimeMediaSource::Type> {
788     using values = EnumValues<
789         WebCore::RealtimeMediaSource::Type,
790         WebCore::RealtimeMediaSource::Type::None,
791         WebCore::RealtimeMediaSource::Type::Audio,
792         WebCore::RealtimeMediaSource::Type::Video
793     >;
794 };
795 #endif
796
797 template<> struct EnumTraits<WebCore::MediaSelectionOption::Type> {
798     using values = EnumValues<
799         WebCore::MediaSelectionOption::Type,
800         WebCore::MediaSelectionOption::Type::Regular,
801         WebCore::MediaSelectionOption::Type::LegibleOff,
802         WebCore::MediaSelectionOption::Type::LegibleAuto
803     >;
804 };
805
806 template <> struct EnumTraits<WebCore::StoredCredentialsPolicy> {
807     using values = EnumValues<
808         WebCore::StoredCredentialsPolicy,
809         WebCore::StoredCredentialsPolicy::DoNotUse,
810         WebCore::StoredCredentialsPolicy::Use
811     >;
812 };
813
814 template <> struct EnumTraits<WebCore::WorkerType> {
815     using values = EnumValues<
816         WebCore::WorkerType,
817         WebCore::WorkerType::Classic,
818         WebCore::WorkerType::Module
819     >;
820 };
821
822 } // namespace WTF