Title: [252831] trunk/Source/WTF
- Revision
- 252831
- Author
- [email protected]
- Date
- 2019-11-23 08:05:09 -0800 (Sat, 23 Nov 2019)
Log Message
Unreviewed. Try to fix the GTK WebDriver tests in the bots after r252770
They are failing in the bots because g_variant_new_from_data() is failing due to the given data not being
properly aligned for the type being loaded. This is not a problem since GLib 2.60 that checks the alignment and
reallocates the buffer in aligned memory only if needed. For previous versions we need to ensure the memory we
pass to g_variant_new_from_data() is aligned.
* wtf/glib/SocketConnection.cpp:
(WTF::SocketConnection::readMessage):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (252830 => 252831)
--- trunk/Source/WTF/ChangeLog 2019-11-23 15:34:10 UTC (rev 252830)
+++ trunk/Source/WTF/ChangeLog 2019-11-23 16:05:09 UTC (rev 252831)
@@ -1,3 +1,15 @@
+2019-11-23 Carlos Garcia Campos <[email protected]>
+
+ Unreviewed. Try to fix the GTK WebDriver tests in the bots after r252770
+
+ They are failing in the bots because g_variant_new_from_data() is failing due to the given data not being
+ properly aligned for the type being loaded. This is not a problem since GLib 2.60 that checks the alignment and
+ reallocates the buffer in aligned memory only if needed. For previous versions we need to ensure the memory we
+ pass to g_variant_new_from_data() is aligned.
+
+ * wtf/glib/SocketConnection.cpp:
+ (WTF::SocketConnection::readMessage):
+
2019-11-22 Brent Fulgham <[email protected]>
Unreviewed FTW build fix after r252687.
Modified: trunk/Source/WTF/wtf/glib/SocketConnection.cpp (252830 => 252831)
--- trunk/Source/WTF/wtf/glib/SocketConnection.cpp 2019-11-23 15:34:10 UTC (rev 252830)
+++ trunk/Source/WTF/wtf/glib/SocketConnection.cpp 2019-11-23 16:05:09 UTC (rev 252831)
@@ -22,6 +22,7 @@
#include <cstring>
#include <gio/gio.h>
+#include <wtf/FastMalloc.h>
#include <wtf/RunLoop.h>
namespace WTF {
@@ -115,7 +116,20 @@
GRefPtr<GVariant> parameters;
if (!it->value.first.isNull()) {
GUniquePtr<GVariantType> variantType(g_variant_type_new(it->value.first.data()));
+ // g_variant_new_from_data() requires the memory to be properly aligned for the type being loaded,
+ // but it's not possible to know the alignment because g_variant_type_info_query() is not public API.
+ // Since GLib 2.60 g_variant_new_from_data() already checks the alignment and reallocates the buffer
+ // in aligned memory only if needed. For older versions we can simply ensure the memory is 8 aligned.
+#if GLIB_CHECK_VERSION(2, 60, 0)
parameters = g_variant_new_from_data(variantType.get(), messageData, bodySize - messageNameLength, FALSE, nullptr, nullptr);
+#else
+ auto* alignedMemory = fastAlignedMalloc(8, bodySize - messageNameLength);
+ memcpy(alignedMemory, messageData, bodySize - messageNameLength);
+ GRefPtr<GBytes> bytes = g_bytes_new_with_free_func(alignedMemory, bodySize - messageNameLength, [](gpointer data) {
+ fastAlignedFree(data);
+ }, alignedMemory);
+ parameters = g_variant_new_from_bytes(variantType.get(), bytes.get(), FALSE);
+#endif
}
it->value.second(*this, parameters.get(), m_userData);
if (isClosed())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes