Title: [223537] releases/WebKitGTK/webkit-2.18/Source/WebKit
Revision
223537
Author
[email protected]
Date
2017-10-17 07:07:25 -0700 (Tue, 17 Oct 2017)

Log Message

Merge r223416 - [WPE] Build failure due to invalid cast of EGLNativeWindowType when targetting 64-bit ARM
https://bugs.webkit.org/show_bug.cgi?id=178090

Reviewed by Michael Catanzaro.

EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
implementation, its build options, and the libepoxy build options.  Using "static_cast"
works when it is a numeric value and the width of the value needs to be optionally
extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
cases. Therefore it seems reasonable to use a plain C cast _expression_ to solve this
particular situation.

* WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
(WebKit::AcceleratedSurfaceWPE::window const): Use a good old plain C cast _expression_.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog (223536 => 223537)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog	2017-10-17 13:54:55 UTC (rev 223536)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog	2017-10-17 14:07:25 UTC (rev 223537)
@@ -1,3 +1,21 @@
+2017-10-16  Adrian Perez de Castro  <[email protected]>
+
+        [WPE] Build failure due to invalid cast of EGLNativeWindowType when targetting 64-bit ARM
+        https://bugs.webkit.org/show_bug.cgi?id=178090
+
+        Reviewed by Michael Catanzaro.
+
+        EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
+        implementation, its build options, and the libepoxy build options.  Using "static_cast"
+        works when it is a numeric value and the width of the value needs to be optionally
+        extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
+        and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
+        cases. Therefore it seems reasonable to use a plain C cast _expression_ to solve this
+        particular situation.
+
+        * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
+        (WebKit::AcceleratedSurfaceWPE::window const): Use a good old plain C cast _expression_.
+
 2017-10-10  Adrian Perez de Castro  <[email protected]>
 
         [WPE] Remove the possibility of installing the old WebKit2 C API

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp (223536 => 223537)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp	2017-10-17 13:54:55 UTC (rev 223536)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp	2017-10-17 14:07:25 UTC (rev 223537)
@@ -75,7 +75,12 @@
 uint64_t AcceleratedSurfaceWPE::window() const
 {
     ASSERT(m_backend);
-    return reinterpret_cast<uint64_t>(wpe_renderer_backend_egl_target_get_native_window(m_backend));
+    // EGLNativeWindowType changes depending on the EGL implementation: reinterpret_cast works
+    // for pointers (only if they are 64-bit wide and not for other cases), and static_cast for
+    // numeric types (and when needed they get extended to 64-bit) but not for pointers. Using
+    // a plain C cast _expression_ in this one instance works in all cases.
+    static_assert(sizeof(EGLNativeWindowType) <= sizeof(uint64_t), "EGLNativeWindowType must not be longer than 64 bits.");
+    return (uint64_t) wpe_renderer_backend_egl_target_get_native_window(m_backend);
 }
 
 uint64_t AcceleratedSurfaceWPE::surfaceID() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to