[webkit-reviews] review granted: [Bug 220410] WebKit::IPC::Encoder needs definitions of all enum types with custom validity checker at the Encoder definition time : [Attachment 417179] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 7 11:10:01 PST 2021


Darin Adler <darin at apple.com> has granted Kimmo Kinnunen
<kkinnunen at apple.com>'s request for review:
Bug 220410: WebKit::IPC::Encoder needs definitions of all enum types with
custom validity checker at the Encoder definition time
https://bugs.webkit.org/show_bug.cgi?id=220410

Attachment 417179: Patch

https://bugs.webkit.org/attachment.cgi?id=417179&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 417179
  --> https://bugs.webkit.org/attachment.cgi?id=417179
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=417179&action=review

> Source/WTF/wtf/EnumTraits.h:63
> +auto isValidEnum(T t) -> decltype(EnumTraits<E>::isValidEnum(t), bool())

Why isn’t this one constexpr?

> Source/WebCore/platform/ContextMenuItem.h:213
> +    static bool isValidEnum(T action)

Why isn’t this one constexpr?

> Source/WebKit/Scripts/webkit/messages.py:993
> +    result.append('	  static bool isValidEnum(T messageName)\n')

Why isn’t this one constexpr?

> Source/WebKit/Scripts/webkit/messages.py:996
> +    result.append('	      static_assert(sizeof(T) ==
sizeof(IPC::MessageName), "isValidEnum<IPC::MessageName> should only be called
with 16-bit types");\n')
> +    result.append('	      static_assert(std::is_unsigned<T>::value,
"isValidEnum<IPC::MessageName> should only be called with unsigned types");\n')

These could be done with enable_if instead of static_assert inside the
function. How did you choose?


More information about the webkit-reviews mailing list