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