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