Title: [221333] trunk/Source/WebKit
Revision
221333
Author
commit-qu...@webkit.org
Date
2017-08-29 18:38:32 -0700 (Tue, 29 Aug 2017)

Log Message

Automatically determine if a class has a modern decoder
https://bugs.webkit.org/show_bug.cgi?id=176084

Patch by Alex Christensen <achristen...@webkit.org> on 2017-08-29
Reviewed by Sam Weinig.

Instead of determining if ModernDecoder is defined in the class,
just check the signature of the decode member function.

* Platform/IPC/ArgumentCoder.h:
(): Deleted.
* Shared/WebPageCreationParameters.h:
* Shared/WebPageGroupData.h:
* Shared/WebsitePolicies.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (221332 => 221333)


--- trunk/Source/WebKit/ChangeLog	2017-08-30 01:29:25 UTC (rev 221332)
+++ trunk/Source/WebKit/ChangeLog	2017-08-30 01:38:32 UTC (rev 221333)
@@ -1,5 +1,21 @@
 2017-08-29  Alex Christensen  <achristen...@webkit.org>
 
+        Automatically determine if a class has a modern decoder
+        https://bugs.webkit.org/show_bug.cgi?id=176084
+
+        Reviewed by Sam Weinig.
+
+        Instead of determining if ModernDecoder is defined in the class,
+        just check the signature of the decode member function.
+
+        * Platform/IPC/ArgumentCoder.h:
+        (): Deleted.
+        * Shared/WebPageCreationParameters.h:
+        * Shared/WebPageGroupData.h:
+        * Shared/WebsitePolicies.h:
+
+2017-08-29  Alex Christensen  <achristen...@webkit.org>
+
         Begin transition to modern IPC decoding
         https://bugs.webkit.org/show_bug.cgi?id=176043
 

Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h (221332 => 221333)


--- trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h	2017-08-30 01:29:25 UTC (rev 221332)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h	2017-08-30 01:38:32 UTC (rev 221333)
@@ -31,11 +31,17 @@
 
 class Decoder;
 class Encoder;
-    
-template <typename... T> using IsUsingModernDecoder = void;
-template <typename T, typename = void> struct UsesModernDecoder : std::false_type { };
-template <typename T> struct UsesModernDecoder<T, IsUsingModernDecoder<typename T::ModernDecoder>> : std::true_type { };
 
+template<typename U>
+class UsesModernDecoder {
+private:
+    template<typename T, T> struct Helper;
+    template<typename T> static uint8_t check(Helper<std::optional<U> (*)(Decoder&), &T::decode>*);
+    template<typename T> static uint16_t check(...);
+public:
+    static constexpr bool value = sizeof(check<U>(0)) == sizeof(uint8_t);
+};
+
 template<typename T> struct ArgumentCoder {
     static void encode(Encoder& encoder, const T& t)
     {

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (221332 => 221333)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2017-08-30 01:29:25 UTC (rev 221332)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2017-08-30 01:38:32 UTC (rev 221333)
@@ -60,7 +60,6 @@
 struct WebPageCreationParameters {
     void encode(IPC::Encoder&) const;
     static std::optional<WebPageCreationParameters> decode(IPC::Decoder&);
-    using ModernDecoder = std::true_type;
 
     WebCore::IntSize viewSize;
 

Modified: trunk/Source/WebKit/Shared/WebPageGroupData.h (221332 => 221333)


--- trunk/Source/WebKit/Shared/WebPageGroupData.h	2017-08-30 01:29:25 UTC (rev 221332)
+++ trunk/Source/WebKit/Shared/WebPageGroupData.h	2017-08-30 01:38:32 UTC (rev 221333)
@@ -37,7 +37,6 @@
 struct WebPageGroupData {
     void encode(IPC::Encoder&) const;
     static std::optional<WebPageGroupData> decode(IPC::Decoder&);
-    using ModernDecoder = std::true_type;
 
     String identifier;
     uint64_t pageGroupID;

Modified: trunk/Source/WebKit/Shared/WebsitePolicies.h (221332 => 221333)


--- trunk/Source/WebKit/Shared/WebsitePolicies.h	2017-08-30 01:29:25 UTC (rev 221332)
+++ trunk/Source/WebKit/Shared/WebsitePolicies.h	2017-08-30 01:38:32 UTC (rev 221333)
@@ -50,7 +50,6 @@
 
     template<class Encoder> void encode(Encoder&) const;
     template<class Decoder> static std::optional<WebsitePolicies> decode(Decoder&);
-    using ModernDecoder = std::true_type;
 };
 
 template<class Encoder> void WebsitePolicies::encode(Encoder& encoder) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to