Title: [283048] trunk/Source/WebKit
Revision
283048
Author
[email protected]
Date
2021-09-24 11:01:49 -0700 (Fri, 24 Sep 2021)

Log Message

Unreviewed, reverting r283024.

Causes slowdown and crash on EWS

Reverted changeset:

"[WebKit2] Refactor some IPC argument encoder logic to work
with StreamConnectionEncoder"
https://bugs.webkit.org/show_bug.cgi?id=230714
https://commits.webkit.org/r283024

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (283047 => 283048)


--- trunk/Source/WebKit/ChangeLog	2021-09-24 17:44:14 UTC (rev 283047)
+++ trunk/Source/WebKit/ChangeLog	2021-09-24 18:01:49 UTC (rev 283048)
@@ -1,3 +1,16 @@
+2021-09-24  Eric Hutchison  <[email protected]>
+
+        Unreviewed, reverting r283024.
+
+        Causes slowdown and crash on EWS
+
+        Reverted changeset:
+
+        "[WebKit2] Refactor some IPC argument encoder logic to work
+        with StreamConnectionEncoder"
+        https://bugs.webkit.org/show_bug.cgi?id=230714
+        https://commits.webkit.org/r283024
+
 2021-09-24  Youenn Fablet  <[email protected]>
 
         RTCDataChannelHandlerClient does not need to be ref counted

Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp (283047 => 283048)


--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp	2021-09-24 17:44:14 UTC (rev 283047)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp	2021-09-24 18:01:49 UTC (rev 283048)
@@ -30,7 +30,6 @@
 #include "PrivateClickMeasurementDecoder.h"
 #include "PrivateClickMeasurementEncoder.h"
 #include "StreamConnectionEncoder.h"
-#include <wtf/text/AtomString.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
@@ -219,7 +218,6 @@
 }
 
 #if HAVE(AUDIT_TOKEN)
-
 void ArgumentCoder<audit_token_t>::encode(Encoder& encoder, const audit_token_t& auditToken)
 {
     for (unsigned i = 0; i < WTF_ARRAY_LENGTH(auditToken.val); i++)
@@ -234,7 +232,15 @@
     }
     return true;
 }
+#endif
 
-#endif // HAVE(AUDIT_TOKEN)
+void ArgumentCoder<Monostate>::encode(Encoder&, const Monostate&)
+{
+}
 
+WARN_UNUSED_RETURN std::optional<Monostate> ArgumentCoder<Monostate>::decode(Decoder&)
+{
+    return Monostate { };
+}
+
 } // namespace IPC

Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h (283047 => 283048)


--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h	2021-09-24 17:44:14 UTC (rev 283047)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h	2021-09-24 18:01:49 UTC (rev 283048)
@@ -40,10 +40,6 @@
 
 namespace IPC {
 
-#define DEFINE_SIMPLE_ARGUMENT_CODER(className) template<> struct ArgumentCoder<className> : SimpleArgumentCoder<className> { }; \
-    template void SimpleArgumentCoder<className>::encode<Encoder>(Encoder&, const className&); \
-    template bool SimpleArgumentCoder<className>::decode<Decoder>(Decoder&, className&);
-
 // An argument coder works on POD types
 template<typename T> struct SimpleArgumentCoder {
     template<typename Encoder>
@@ -52,7 +48,6 @@
         encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(&t), sizeof(T), alignof(T));
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, T& t)
     {
         return decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(&t), sizeof(T), alignof(T));
@@ -112,7 +107,6 @@
 };
 
 template<typename T> struct ArgumentCoder<OptionSet<T>> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const OptionSet<T>& optionSet)
     {
         ASSERT(WTF::isValidOptionSet(optionSet));
@@ -119,7 +113,6 @@
         encoder << optionSet.toRaw();
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, OptionSet<T>& optionSet)
     {
         typename OptionSet<T>::StorageType value;
@@ -131,7 +124,6 @@
         return true;
     }
 
-    template<typename Decoder>
     static std::optional<OptionSet<T>> decode(Decoder& decoder)
     {
         std::optional<typename OptionSet<T>::StorageType> value;
@@ -195,7 +187,6 @@
 };
 
 template<typename T> struct ArgumentCoder<Box<T>> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const Box<T>& box)
     {
         if (!box) {
@@ -207,7 +198,6 @@
         encoder << *box.get();
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Box<T>& box)
     {
         bool isEngaged;
@@ -227,7 +217,6 @@
         return true;
     }
 
-    template<typename Decoder>
     static std::optional<Box<T>> decode(Decoder& decoder)
     {
         std::optional<bool> isEngaged;
@@ -246,13 +235,11 @@
 };
 
 template<typename T, typename U> struct ArgumentCoder<std::pair<T, U>> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const std::pair<T, U>& pair)
     {
         encoder << pair.first << pair.second;
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::pair<T, U>& pair)
     {
         T first;
@@ -268,7 +255,6 @@
         return true;
     }
 
-    template<typename Decoder>
     static std::optional<std::pair<T, U>> decode(Decoder& decoder)
     {
         std::optional<T> first;
@@ -379,13 +365,11 @@
 };
 
 template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType>> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair)
     {
         encoder << pair.key << pair.value;
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)
     {
         KeyType key;
@@ -413,7 +397,6 @@
             encoder << vector[i];
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector)
     {
         std::optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> optional;
@@ -453,7 +436,6 @@
         encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T), alignof(T));
     }
     
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector)
     {
         uint64_t decodedSize;
@@ -468,7 +450,7 @@
         // Since we know the total size of the elements, we can allocate the vector in
         // one fell swoop. Before allocating we must however make sure that the decoder buffer
         // is big enough.
-        if (!decoder.template bufferIsLargeEnoughToContain<T>(size))
+        if (!decoder.bufferIsLargeEnoughToContain<T>(size))
             return false;
 
         Vector<T, inlineCapacity, OverflowHandler, minCapacity> temp;
@@ -515,7 +497,6 @@
 template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg, typename HashTableTraits> struct ArgumentCoder<HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg, HashTableTraits>> {
     typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg, HashTableTraits> HashMapType;
 
-    template<typename Encoder>
     static void encode(Encoder& encoder, const HashMapType& hashMap)
     {
         encoder << static_cast<uint32_t>(hashMap.size());
@@ -523,7 +504,6 @@
             encoder << *it;
     }
 
-    template<typename Decoder>
     static std::optional<HashMapType> decode(Decoder& decoder)
     {
         uint32_t hashMapSize;
@@ -554,7 +534,6 @@
         return hashMap;
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap)
     {
         std::optional<HashMapType> tempHashMap;
@@ -569,7 +548,6 @@
 template<typename KeyArg, typename HashArg, typename KeyTraitsArg, typename HashTableTraits> struct ArgumentCoder<HashSet<KeyArg, HashArg, KeyTraitsArg, HashTableTraits>> {
     typedef HashSet<KeyArg, HashArg, KeyTraitsArg, HashTableTraits> HashSetType;
 
-    template<typename Encoder>
     static void encode(Encoder& encoder, const HashSetType& hashSet)
     {
         encoder << static_cast<uint64_t>(hashSet.size());
@@ -577,7 +555,6 @@
             encoder << *it;
     }
 
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet)
     {
         std::optional<HashSetType> tempHashSet;
@@ -589,7 +566,6 @@
         return true;
     }
 
-    template<typename Decoder>
     static std::optional<HashSetType> decode(Decoder& decoder)
     {
         uint64_t hashSetSize;
@@ -619,7 +595,6 @@
 template<typename KeyArg, typename HashArg, typename KeyTraitsArg> struct ArgumentCoder<HashCountedSet<KeyArg, HashArg, KeyTraitsArg>> {
     typedef HashCountedSet<KeyArg, HashArg, KeyTraitsArg> HashCountedSetType;
     
-    template<typename Encoder>
     static void encode(Encoder& encoder, const HashCountedSetType& hashCountedSet)
     {
         encoder << static_cast<uint64_t>(hashCountedSet.size());
@@ -630,7 +605,6 @@
         }
     }
     
-    template<typename Decoder>
     static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashCountedSetType& hashCountedSet)
     {
         uint64_t hashCountedSetSize;
@@ -662,7 +636,6 @@
 };
 
 template<typename ValueType, typename ErrorType> struct ArgumentCoder<Expected<ValueType, ErrorType>> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const Expected<ValueType, ErrorType>& expected)
     {
         if (!expected.has_value()) {
@@ -674,7 +647,6 @@
         encoder << expected.value();
     }
 
-    template<typename Decoder>
     static std::optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder)
     {
         std::optional<bool> hasValue;
@@ -701,7 +673,6 @@
 
 template<size_t index, typename... Types>
 struct VariantCoder {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const WTF::Variant<Types...>& variant, unsigned i)
     {
         if (i == index) {
@@ -711,7 +682,6 @@
         VariantCoder<index - 1, Types...>::encode(encoder, variant, i);
     }
     
-    template<typename Decoder>
     static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)
     {
         if (i == index) {
@@ -727,7 +697,6 @@
 
 template<typename... Types>
 struct VariantCoder<0, Types...> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const WTF::Variant<Types...>& variant, unsigned i)
     {
         ASSERT_UNUSED(i, !i);
@@ -734,7 +703,6 @@
         encoder << WTF::get<0>(variant);
     }
     
-    template<typename Decoder>
     static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)
     {
         ASSERT_UNUSED(i, !i);
@@ -747,7 +715,6 @@
 };
 
 template<typename... Types> struct ArgumentCoder<WTF::Variant<Types...>> {
-    template<typename Encoder>
     static void encode(Encoder& encoder, const WTF::Variant<Types...>& variant)
     {
         unsigned i = variant.index();
@@ -755,7 +722,6 @@
         VariantCoder<sizeof...(Types) - 1, Types...>::encode(encoder, variant, i);
     }
     
-    template<typename Decoder>
     static std::optional<WTF::Variant<Types...>> decode(Decoder& decoder)
     {
         std::optional<unsigned> i;
@@ -807,14 +773,8 @@
 #endif
 
 template<> struct ArgumentCoder<Monostate> {
-    template<typename Encoder>
-    static void encode(Encoder&, const Monostate&) { }
-
-    template<typename Decoder>
-    static std::optional<Monostate> decode(Decoder&)
-    {
-        return Monostate { };
-    }
+    static void encode(Encoder&, const Monostate&);
+    static std::optional<Monostate> decode(Decoder&);
 };
 
 } // namespace IPC

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (283047 => 283048)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-09-24 17:44:14 UTC (rev 283047)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-09-24 18:01:49 UTC (rev 283048)
@@ -88,6 +88,7 @@
 #include <WebCore/TextCheckerClient.h>
 #include <WebCore/TextIndicator.h>
 #include <WebCore/TimingFunction.h>
+#include <WebCore/TransformationMatrix.h>
 #include <WebCore/UserStyleSheet.h>
 #include <WebCore/VelocityData.h>
 #include <WebCore/ViewportArguments.h>
@@ -230,6 +231,16 @@
     return true;
 }
 
+void ArgumentCoder<AffineTransform>::encode(Encoder& encoder, const AffineTransform& affineTransform)
+{
+    SimpleArgumentCoder<AffineTransform>::encode(encoder, affineTransform);
+}
+
+bool ArgumentCoder<AffineTransform>::decode(Decoder& decoder, AffineTransform& affineTransform)
+{
+    return SimpleArgumentCoder<AffineTransform>::decode(decoder, affineTransform);
+}
+
 void ArgumentCoder<CacheQueryOptions>::encode(Encoder& encoder, const CacheQueryOptions& options)
 {
     encoder << options.ignoreSearch;
@@ -414,6 +425,87 @@
     return true;
 }
 
+void ArgumentCoder<TransformationMatrix>::encode(Encoder& encoder, const TransformationMatrix& transformationMatrix)
+{
+    encoder << transformationMatrix.m11();
+    encoder << transformationMatrix.m12();
+    encoder << transformationMatrix.m13();
+    encoder << transformationMatrix.m14();
+
+    encoder << transformationMatrix.m21();
+    encoder << transformationMatrix.m22();
+    encoder << transformationMatrix.m23();
+    encoder << transformationMatrix.m24();
+
+    encoder << transformationMatrix.m31();
+    encoder << transformationMatrix.m32();
+    encoder << transformationMatrix.m33();
+    encoder << transformationMatrix.m34();
+
+    encoder << transformationMatrix.m41();
+    encoder << transformationMatrix.m42();
+    encoder << transformationMatrix.m43();
+    encoder << transformationMatrix.m44();
+}
+
+bool ArgumentCoder<TransformationMatrix>::decode(Decoder& decoder, TransformationMatrix& transformationMatrix)
+{
+    double m11;
+    if (!decoder.decode(m11))
+        return false;
+    double m12;
+    if (!decoder.decode(m12))
+        return false;
+    double m13;
+    if (!decoder.decode(m13))
+        return false;
+    double m14;
+    if (!decoder.decode(m14))
+        return false;
+
+    double m21;
+    if (!decoder.decode(m21))
+        return false;
+    double m22;
+    if (!decoder.decode(m22))
+        return false;
+    double m23;
+    if (!decoder.decode(m23))
+        return false;
+    double m24;
+    if (!decoder.decode(m24))
+        return false;
+
+    double m31;
+    if (!decoder.decode(m31))
+        return false;
+    double m32;
+    if (!decoder.decode(m32))
+        return false;
+    double m33;
+    if (!decoder.decode(m33))
+        return false;
+    double m34;
+    if (!decoder.decode(m34))
+        return false;
+
+    double m41;
+    if (!decoder.decode(m41))
+        return false;
+    double m42;
+    if (!decoder.decode(m42))
+        return false;
+    double m43;
+    if (!decoder.decode(m43))
+        return false;
+    double m44;
+    if (!decoder.decode(m44))
+        return false;
+
+    transformationMatrix.setMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
+    return true;
+}
+
 void ArgumentCoder<LinearTimingFunction>::encode(Encoder& encoder, const LinearTimingFunction& timingFunction)
 {
     encoder << timingFunction.type();
@@ -525,6 +617,86 @@
     return true;
 }
 
+void ArgumentCoder<FloatPoint>::encode(Encoder& encoder, const FloatPoint& floatPoint)
+{
+    SimpleArgumentCoder<FloatPoint>::encode(encoder, floatPoint);
+}
+
+bool ArgumentCoder<FloatPoint>::decode(Decoder& decoder, FloatPoint& floatPoint)
+{
+    return SimpleArgumentCoder<FloatPoint>::decode(decoder, floatPoint);
+}
+
+std::optional<FloatPoint> ArgumentCoder<FloatPoint>::decode(Decoder& decoder)
+{
+    FloatPoint floatPoint;
+    if (!SimpleArgumentCoder<FloatPoint>::decode(decoder, floatPoint))
+        return std::nullopt;
+    return floatPoint;
+}
+
+void ArgumentCoder<FloatPoint3D>::encode(Encoder& encoder, const FloatPoint3D& floatPoint)
+{
+    SimpleArgumentCoder<FloatPoint3D>::encode(encoder, floatPoint);
+}
+
+bool ArgumentCoder<FloatPoint3D>::decode(Decoder& decoder, FloatPoint3D& floatPoint)
+{
+    return SimpleArgumentCoder<FloatPoint3D>::decode(decoder, floatPoint);
+}
+
+
+void ArgumentCoder<FloatRect>::encode(Encoder& encoder, const FloatRect& floatRect)
+{
+    SimpleArgumentCoder<FloatRect>::encode(encoder, floatRect);
+}
+
+bool ArgumentCoder<FloatRect>::decode(Decoder& decoder, FloatRect& floatRect)
+{
+    return SimpleArgumentCoder<FloatRect>::decode(decoder, floatRect);
+}
+
+std::optional<FloatRect> ArgumentCoder<FloatRect>::decode(Decoder& decoder)
+{
+    FloatRect floatRect;
+    if (!SimpleArgumentCoder<FloatRect>::decode(decoder, floatRect))
+        return std::nullopt;
+    return floatRect;
+}
+
+
+void ArgumentCoder<FloatBoxExtent>::encode(Encoder& encoder, const FloatBoxExtent& floatBoxExtent)
+{
+    SimpleArgumentCoder<FloatBoxExtent>::encode(encoder, floatBoxExtent);
+}
+    
+bool ArgumentCoder<FloatBoxExtent>::decode(Decoder& decoder, FloatBoxExtent& floatBoxExtent)
+{
+    return SimpleArgumentCoder<FloatBoxExtent>::decode(decoder, floatBoxExtent);
+}
+    
+
+void ArgumentCoder<FloatSize>::encode(Encoder& encoder, const FloatSize& floatSize)
+{
+    SimpleArgumentCoder<FloatSize>::encode(encoder, floatSize);
+}
+
+bool ArgumentCoder<FloatSize>::decode(Decoder& decoder, FloatSize& floatSize)
+{
+    return SimpleArgumentCoder<FloatSize>::decode(decoder, floatSize);
+}
+
+
+void ArgumentCoder<FloatRoundedRect>::encode(Encoder& encoder, const FloatRoundedRect& roundedRect)
+{
+    SimpleArgumentCoder<FloatRoundedRect>::encode(encoder, roundedRect);
+}
+
+bool ArgumentCoder<FloatRoundedRect>::decode(Decoder& decoder, FloatRoundedRect& roundedRect)
+{
+    return SimpleArgumentCoder<FloatRoundedRect>::decode(decoder, roundedRect);
+}
+
 #if ENABLE(META_VIEWPORT)
 void ArgumentCoder<ViewportArguments>::encode(Encoder& encoder, const ViewportArguments& viewportArguments)
 {
@@ -556,6 +728,87 @@
     return SimpleArgumentCoder<ViewportAttributes>::decode(decoder, viewportAttributes);
 }
 
+void ArgumentCoder<IntPoint>::encode(Encoder& encoder, const IntPoint& intPoint)
+{
+    SimpleArgumentCoder<IntPoint>::encode(encoder, intPoint);
+}
+
+bool ArgumentCoder<IntPoint>::decode(Decoder& decoder, IntPoint& intPoint)
+{
+    return SimpleArgumentCoder<IntPoint>::decode(decoder, intPoint);
+}
+
+std::optional<WebCore::IntPoint> ArgumentCoder<IntPoint>::decode(Decoder& decoder)
+{
+    IntPoint intPoint;
+    if (!SimpleArgumentCoder<IntPoint>::decode(decoder, intPoint))
+        return std::nullopt;
+    return intPoint;
+}
+
+void ArgumentCoder<IntRect>::encode(Encoder& encoder, const IntRect& intRect)
+{
+    SimpleArgumentCoder<IntRect>::encode(encoder, intRect);
+}
+
+bool ArgumentCoder<IntRect>::decode(Decoder& decoder, IntRect& intRect)
+{
+    return SimpleArgumentCoder<IntRect>::decode(decoder, intRect);
+}
+
+std::optional<IntRect> ArgumentCoder<IntRect>::decode(Decoder& decoder)
+{
+    IntRect rect;
+    if (!decode(decoder, rect))
+        return std::nullopt;
+    return rect;
+}
+
+template<typename Encoder>
+void ArgumentCoder<IntSize>::encode(Encoder& encoder, const IntSize& intSize)
+{
+    SimpleArgumentCoder<IntSize>::encode(encoder, intSize);
+}
+
+template
+void ArgumentCoder<IntSize>::encode<Encoder>(Encoder&, const IntSize&);
+template
+void ArgumentCoder<IntSize>::encode<StreamConnectionEncoder>(StreamConnectionEncoder&, const IntSize&);
+
+bool ArgumentCoder<IntSize>::decode(Decoder& decoder, IntSize& intSize)
+{
+    return SimpleArgumentCoder<IntSize>::decode(decoder, intSize);
+}
+
+std::optional<IntSize> ArgumentCoder<IntSize>::decode(Decoder& decoder)
+{
+    IntSize intSize;
+    if (!SimpleArgumentCoder<IntSize>::decode(decoder, intSize))
+        return std::nullopt;
+    return intSize;
+}
+
+void ArgumentCoder<LayoutSize>::encode(Encoder& encoder, const LayoutSize& layoutSize)
+{
+    SimpleArgumentCoder<LayoutSize>::encode(encoder, layoutSize);
+}
+
+bool ArgumentCoder<LayoutSize>::decode(Decoder& decoder, LayoutSize& layoutSize)
+{
+    return SimpleArgumentCoder<LayoutSize>::decode(decoder, layoutSize);
+}
+
+
+void ArgumentCoder<LayoutPoint>::encode(Encoder& encoder, const LayoutPoint& layoutPoint)
+{
+    SimpleArgumentCoder<LayoutPoint>::encode(encoder, layoutPoint);
+}
+
+bool ArgumentCoder<LayoutPoint>::decode(Decoder& decoder, LayoutPoint& layoutPoint)
+{
+    return SimpleArgumentCoder<LayoutPoint>::decode(decoder, layoutPoint);
+}
+
 void ArgumentCoder<RecentSearch>::encode(Encoder& encoder, const RecentSearch& recentSearch)
 {
     encoder << recentSearch.string << recentSearch.time;

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (283047 => 283048)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-09-24 17:44:14 UTC (rev 283047)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-09-24 18:01:49 UTC (rev 283048)
@@ -26,24 +26,12 @@
 #pragma once
 
 #include "ArgumentCoders.h"
-#include <WebCore/AffineTransform.h>
 #include <WebCore/AutoplayEvent.h>
 #include <WebCore/ColorSpace.h>
 #include <WebCore/DiagnosticLoggingClient.h>
-#include <WebCore/FloatPoint.h>
-#include <WebCore/FloatPoint3D.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/FloatRoundedRect.h>
-#include <WebCore/FloatSize.h>
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/IndexedDB.h>
 #include <WebCore/InputMode.h>
-#include <WebCore/IntPoint.h>
-#include <WebCore/IntRect.h>
-#include <WebCore/IntSize.h>
-#include <WebCore/LayoutPoint.h>
-#include <WebCore/LayoutSize.h>
-#include <WebCore/LengthBox.h>
 #include <WebCore/MediaSelectionOption.h>
 #include <WebCore/NativeImage.h>
 #include <WebCore/NetworkLoadMetrics.h>
@@ -54,7 +42,6 @@
 #include <WebCore/SerializedPlatformDataCueValue.h>
 #include <WebCore/ServiceWorkerTypes.h>
 #include <WebCore/StoredCredentialsPolicy.h>
-#include <WebCore/TransformationMatrix.h>
 #include <WebCore/WorkerType.h>
 #include <wtf/EnumTraits.h>
 
@@ -109,6 +96,7 @@
 namespace WebCore {
 
 class AbsolutePositionConstraints;
+class AffineTransform;
 class AuthenticationChallenge;
 class BlobPart;
 class CertificateInfo;
@@ -121,11 +109,21 @@
 class File;
 class FilterOperation;
 class FilterOperations;
+class FloatPoint;
+class FloatPoint3D;
+class FloatRect;
+class FloatRoundedRect;
+class FloatSize;
 class FixedPositionViewportConstraints;
 class Font;
 class FontPlatformData;
 class HTTPHeaderMap;
+class IntPoint;
+class IntRect;
+class IntSize;
 class KeyframeValueList;
+class LayoutSize;
+class LayoutPoint;
 class LinearTimingFunction;
 class Notification;
 class PasteboardCustomData;
@@ -142,6 +140,7 @@
 class StepsTimingFunction;
 class StickyPositionViewportConstraints;
 class TextCheckingRequestData;
+class TransformationMatrix;
 class UserStyleSheet;
 
 struct AttributedString;
@@ -175,7 +174,9 @@
 struct VelocityData;
 struct ViewportAttributes;
 struct WindowFeatures;
-
+    
+template<typename> class RectEdges;
+using FloatBoxExtent = RectEdges<float>;
 using IDBKeyPath = Variant<String, Vector<String>>;
 
 #if PLATFORM(COCOA)
@@ -226,27 +227,11 @@
 
 namespace IPC {
 
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::AffineTransform)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::FloatBoxExtent)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::FloatPoint)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::FloatPoint3D)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::FloatRect)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::FloatRoundedRect)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::FloatSize)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::IntPoint)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::IntRect)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::IntSize)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::LayoutSize)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::LayoutPoint)
-DEFINE_SIMPLE_ARGUMENT_CODER(WebCore::TransformationMatrix)
+template<> struct ArgumentCoder<WebCore::AffineTransform> {
+    static void encode(Encoder&, const WebCore::AffineTransform&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::AffineTransform&);
+};
 
-#if USE(CG)
-DEFINE_SIMPLE_ARGUMENT_CODER(CGRect)
-DEFINE_SIMPLE_ARGUMENT_CODER(CGSize)
-DEFINE_SIMPLE_ARGUMENT_CODER(CGPoint)
-DEFINE_SIMPLE_ARGUMENT_CODER(CGAffineTransform)
-#endif
-
 template<> struct ArgumentCoder<WebCore::AttributedString> {
     static void encode(Encoder&, const WebCore::AttributedString&);
     static std::optional<WebCore::AttributedString> decode(Decoder&);
@@ -282,6 +267,11 @@
     static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::EventTrackingRegions&);
 };
 
+template<> struct ArgumentCoder<WebCore::TransformationMatrix> {
+    static void encode(Encoder&, const WebCore::TransformationMatrix&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::TransformationMatrix&);
+};
+
 template<> struct ArgumentCoder<WebCore::LinearTimingFunction> {
     static void encode(Encoder&, const WebCore::LinearTimingFunction&);
     static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::LinearTimingFunction&);
@@ -309,6 +299,38 @@
     static std::optional<WebCore::CertificateInfo> decode(Decoder&);
 };
 
+template<> struct ArgumentCoder<WebCore::FloatPoint> {
+    static void encode(Encoder&, const WebCore::FloatPoint&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::FloatPoint&);
+    static std::optional<WebCore::FloatPoint> decode(Decoder&);
+};
+
+template<> struct ArgumentCoder<WebCore::FloatPoint3D> {
+    static void encode(Encoder&, const WebCore::FloatPoint3D&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::FloatPoint3D&);
+};
+
+template<> struct ArgumentCoder<WebCore::FloatRect> {
+    static void encode(Encoder&, const WebCore::FloatRect&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::FloatRect&);
+    static std::optional<WebCore::FloatRect> decode(Decoder&);
+};
+    
+template<> struct ArgumentCoder<WebCore::FloatBoxExtent> {
+    static void encode(Encoder&, const WebCore::FloatBoxExtent&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::FloatBoxExtent&);
+};
+
+template<> struct ArgumentCoder<WebCore::FloatSize> {
+    static void encode(Encoder&, const WebCore::FloatSize&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::FloatSize&);
+};
+
+template<> struct ArgumentCoder<WebCore::FloatRoundedRect> {
+    static void encode(Encoder&, const WebCore::FloatRoundedRect&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::FloatRoundedRect&);
+};
+
 #if ENABLE(META_VIEWPORT)
 template<> struct ArgumentCoder<WebCore::ViewportArguments> {
     static void encode(Encoder&, const WebCore::ViewportArguments&);
@@ -323,6 +345,35 @@
     static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::ViewportAttributes&);
 };
 
+template<> struct ArgumentCoder<WebCore::IntPoint> {
+    static void encode(Encoder&, const WebCore::IntPoint&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::IntPoint&);
+    static std::optional<WebCore::IntPoint> decode(Decoder&);
+};
+
+template<> struct ArgumentCoder<WebCore::IntRect> {
+    static void encode(Encoder&, const WebCore::IntRect&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::IntRect&);
+    static std::optional<WebCore::IntRect> decode(Decoder&);
+};
+
+template<> struct ArgumentCoder<WebCore::IntSize> {
+    template<typename Encoder>
+    static void encode(Encoder&, const WebCore::IntSize&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::IntSize&);
+    static std::optional<WebCore::IntSize> decode(Decoder&);
+};
+
+template<> struct ArgumentCoder<WebCore::LayoutSize> {
+    static void encode(Encoder&, const WebCore::LayoutSize&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::LayoutSize&);
+};
+
+template<> struct ArgumentCoder<WebCore::LayoutPoint> {
+    static void encode(Encoder&, const WebCore::LayoutPoint&);
+    static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::LayoutPoint&);
+};
+
 template<> struct ArgumentCoder<WebCore::Length> {
     static void encode(Encoder&, const WebCore::Length&);
     static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::Length&);
@@ -401,7 +452,6 @@
 #endif
 
 #if PLATFORM(COCOA)
-
 template<> struct ArgumentCoder<WTF::MachSendRight> {
     static void encode(Encoder&, const WTF::MachSendRight&);
     static void encode(Encoder&, WTF::MachSendRight&&);
@@ -413,8 +463,27 @@
     static std::optional<WebCore::KeypressCommand> decode(Decoder&);
 };
 
-#endif // PLATFORM(COCOA)
+template<> struct ArgumentCoder<CGPoint> {
+    static void encode(Encoder&, CGPoint);
+    static std::optional<CGPoint> decode(Decoder&);
+};
 
+template<> struct ArgumentCoder<CGSize> {
+    static void encode(Encoder&, CGSize);
+    static std::optional<CGSize> decode(Decoder&);
+};
+
+template<> struct ArgumentCoder<CGRect> {
+    static void encode(Encoder&, CGRect);
+    static std::optional<CGRect> decode(Decoder&);
+};
+
+template<> struct ArgumentCoder<CGAffineTransform> {
+    static void encode(Encoder&, CGAffineTransform);
+    static std::optional<CGAffineTransform> decode(Decoder&);
+};
+#endif
+
 #if PLATFORM(IOS_FAMILY)
 template<> struct ArgumentCoder<WebCore::SelectionGeometry> {
     static void encode(Encoder&, const WebCore::SelectionGeometry&);

Modified: trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm (283047 => 283048)


--- trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm	2021-09-24 17:44:14 UTC (rev 283047)
+++ trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm	2021-09-24 18:01:49 UTC (rev 283048)
@@ -321,6 +321,79 @@
     return WTFMove(command);
 }
 
+void ArgumentCoder<CGRect>::encode(Encoder& encoder, CGRect rect)
+{
+    encoder << rect.origin << rect.size;
+}
+
+std::optional<CGRect> ArgumentCoder<CGRect>::decode(Decoder& decoder)
+{
+    std::optional<CGPoint> origin;
+    decoder >> origin;
+    if (!origin)
+        return { };
+
+    std::optional<CGSize> size;
+    decoder >> size;
+    if (!size)
+        return { };
+
+    return CGRect { *origin, *size };
+}
+
+void ArgumentCoder<CGSize>::encode(Encoder& encoder, CGSize size)
+{
+    encoder << size.width << size.height;
+}
+
+std::optional<CGSize> ArgumentCoder<CGSize>::decode(Decoder& decoder)
+{
+    CGSize size;
+    if (!decoder.decode(size.width))
+        return { };
+    if (!decoder.decode(size.height))
+        return { };
+    return size;
+}
+
+void ArgumentCoder<CGPoint>::encode(Encoder& encoder, CGPoint point)
+{
+    encoder << point.x << point.y;
+}
+
+std::optional<CGPoint> ArgumentCoder<CGPoint>::decode(Decoder& decoder)
+{
+    CGPoint point;
+    if (!decoder.decode(point.x))
+        return { };
+    if (!decoder.decode(point.y))
+        return { };
+    return point;
+}
+
+void ArgumentCoder<CGAffineTransform>::encode(Encoder& encoder, CGAffineTransform transform)
+{
+    encoder << transform.a << transform.b << transform.c << transform.d << transform.tx << transform.ty;
+}
+
+std::optional<CGAffineTransform> ArgumentCoder<CGAffineTransform>::decode(Decoder& decoder)
+{
+    CGAffineTransform transform;
+    if (!decoder.decode(transform.a))
+        return { };
+    if (!decoder.decode(transform.b))
+        return { };
+    if (!decoder.decode(transform.c))
+        return { };
+    if (!decoder.decode(transform.d))
+        return { };
+    if (!decoder.decode(transform.tx))
+        return { };
+    if (!decoder.decode(transform.ty))
+        return { };
+    return transform;
+}
+
 #if ENABLE(CONTENT_FILTERING)
 
 void ArgumentCoder<WebCore::ContentFilterUnblockHandler>::encode(Encoder& encoder, const WebCore::ContentFilterUnblockHandler& contentFilterUnblockHandler)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to