[Webkit-unassigned] [Bug 271337] New: Add static assertions to ensure RefCounted and ThreadSafeRefCounted are the same size
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Mar 20 14:02:47 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=271337
Bug ID: 271337
Summary: Add static assertions to ensure RefCounted and
ThreadSafeRefCounted are the same size
Product: WebKit
Version: WebKit Nightly Build
Hardware: PC
OS: Linux
Status: NEW
Severity: Normal
Priority: P2
Component: WebKit Misc.
Assignee: webkit-unassigned at lists.webkit.org
Reporter: mcatanzaro at redhat.com
Currently GeneratedSerializers.cpp assumes that RefCounted and ThreadSafeRefCounted are both the same size. Arguably it shouldn't, since this surely relies on implementation-defined behavior, but it apparently works in practice. If it's not true, then the build will fail on one of various static assertions in GeneratedSerializers.cpp because VirtualTableAndRefCountOverhead inherits from RefCounted<VirtualTableAndRefCountOverhead> and gets compared to the size of ThreadSafeRefCounted objects. Since it's easy to test for, let's add more static asserts to catch this problem specifically. This way, if the assumption fails in the future, the sad developer who has to deal with it will hopefully be moderately less confused.
Let's also adjust the preprocessor guards in ThreadSafeRefCounted.h to match RefCounted.h. The size of both classes depends on whether debug assertions are enabled, but ThreadSafeRefCounted is directly checking NDEBUG rather than checking ASSERT_ENABLED, so they could easily wind up enabled in one place and not the other. This would likely cause the size checks in GeneratedSerializers.cpp to fail.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240320/697c43ef/attachment.htm>
More information about the webkit-unassigned
mailing list