Title: [204742] trunk/Source/WebKit2
Revision
204742
Author
ander...@apple.com
Date
2016-08-22 15:10:43 -0700 (Mon, 22 Aug 2016)

Log Message

Move tuple coding to ArgumentCoders.h
https://bugs.webkit.org/show_bug.cgi?id=161059

Reviewed by Tim Horton.

* Platform/IPC/ArgumentCoders.h:
(IPC::TupleCoder::encode):
(IPC::TupleCoder::decode):
* Platform/IPC/Arguments.h:
(IPC::TupleCoder::encode): Deleted.
(IPC::TupleCoder::decode): Deleted.
* Scripts/webkit/messages.py:
(forward_declarations_and_headers):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (204741 => 204742)


--- trunk/Source/WebKit2/ChangeLog	2016-08-22 21:59:18 UTC (rev 204741)
+++ trunk/Source/WebKit2/ChangeLog	2016-08-22 22:10:43 UTC (rev 204742)
@@ -1,5 +1,21 @@
 2016-08-22  Anders Carlsson  <ander...@apple.com>
 
+        Move tuple coding to ArgumentCoders.h
+        https://bugs.webkit.org/show_bug.cgi?id=161059
+
+        Reviewed by Tim Horton.
+
+        * Platform/IPC/ArgumentCoders.h:
+        (IPC::TupleCoder::encode):
+        (IPC::TupleCoder::decode):
+        * Platform/IPC/Arguments.h:
+        (IPC::TupleCoder::encode): Deleted.
+        (IPC::TupleCoder::decode): Deleted.
+        * Scripts/webkit/messages.py:
+        (forward_declarations_and_headers):
+
+2016-08-22  Anders Carlsson  <ander...@apple.com>
+
         Simplify the generated message structs
         https://bugs.webkit.org/show_bug.cgi?id=161057
 

Modified: trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h (204741 => 204742)


--- trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h	2016-08-22 21:59:18 UTC (rev 204741)
+++ trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h	2016-08-22 22:10:43 UTC (rev 204742)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ArgumentCoders_h
-#define ArgumentCoders_h
+#pragma once
 
 #include "Decoder.h"
 #include "Encoder.h"
@@ -123,6 +122,47 @@
     }
 };
 
+template<size_t index, typename... Elements>
+struct TupleCoder {
+    static void encode(Encoder& encoder, const std::tuple<Elements...>& tuple)
+    {
+        encoder << std::get<sizeof...(Elements) - index>(tuple);
+        TupleCoder<index - 1, Elements...>::encode(encoder, tuple);
+    }
+
+    static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
+    {
+        if (!decoder.decode(std::get<sizeof...(Elements) - index>(tuple)))
+            return false;
+        return TupleCoder<index - 1, Elements...>::decode(decoder, tuple);
+    }
+};
+
+template<typename... Elements>
+struct TupleCoder<0, Elements...> {
+    static void encode(Encoder&, const std::tuple<Elements...>&)
+    {
+    }
+
+    static bool decode(Decoder&, std::tuple<Elements...>&)
+    {
+        return true;
+    }
+};
+
+template<typename... Elements> struct ArgumentCoder<std::tuple<Elements...>> {
+    static void encode(Encoder& encoder, const std::tuple<Elements...>& tuple)
+    {
+        TupleCoder<sizeof...(Elements), Elements...>::encode(encoder, tuple);
+    }
+
+    static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
+    {
+        return TupleCoder<sizeof...(Elements), Elements...>::decode(decoder, tuple);
+    }
+};
+
+
 template<typename Rep, typename Period> struct ArgumentCoder<std::chrono::duration<Rep, Period>> {
     static void encode(Encoder& encoder, const std::chrono::duration<Rep, Period>& duration)
     {
@@ -359,5 +399,3 @@
 };
 
 } // namespace IPC
-
-#endif // ArgumentCoders_h

Modified: trunk/Source/WebKit2/Platform/IPC/Arguments.h (204741 => 204742)


--- trunk/Source/WebKit2/Platform/IPC/Arguments.h	2016-08-22 21:59:18 UTC (rev 204741)
+++ trunk/Source/WebKit2/Platform/IPC/Arguments.h	2016-08-22 22:10:43 UTC (rev 204742)
@@ -31,46 +31,7 @@
 
 namespace IPC {
 
-template<size_t index, typename... Elements>
-struct TupleCoder {
-    static void encode(Encoder& encoder, const std::tuple<Elements...>& tuple)
-    {
-        encoder << std::get<sizeof...(Elements) - index>(tuple);
-        TupleCoder<index - 1, Elements...>::encode(encoder, tuple);
-    }
 
-    static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
-    {
-        if (!decoder.decode(std::get<sizeof...(Elements) - index>(tuple)))
-            return false;
-        return TupleCoder<index - 1, Elements...>::decode(decoder, tuple);
-    }
-};
-
-template<typename... Elements>
-struct TupleCoder<0, Elements...> {
-    static void encode(Encoder&, const std::tuple<Elements...>&)
-    {
-    }
-
-    static bool decode(Decoder&, std::tuple<Elements...>&)
-    {
-        return true;
-    }
-};
-
-template<typename... Elements> struct ArgumentCoder<std::tuple<Elements...>> {
-    static void encode(Encoder& encoder, const std::tuple<Elements...>& tuple)
-    {
-        TupleCoder<sizeof...(Elements), Elements...>::encode(encoder, tuple);
-    }
-
-    static bool decode(Decoder& decoder, std::tuple<Elements...>& tuple)
-    {
-        return TupleCoder<sizeof...(Elements), Elements...>::decode(decoder, tuple);
-    }
-};
-
 template<typename... Types>
 struct Arguments {
     typedef std::tuple<typename std::decay<Types>::type...> ValueType;

Modified: trunk/Source/WebKit2/Scripts/webkit/messages.py (204741 => 204742)


--- trunk/Source/WebKit2/Scripts/webkit/messages.py	2016-08-22 21:59:18 UTC (rev 204741)
+++ trunk/Source/WebKit2/Scripts/webkit/messages.py	2016-08-22 22:10:43 UTC (rev 204742)
@@ -165,8 +165,7 @@
     types_by_namespace = collections.defaultdict(set)
 
     headers = set([
-        '"Arguments.h"',
-        '"Encoder.h"',
+        '"ArgumentCoders.h"',
     ])
 
     non_template_wtf_types = frozenset([
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to