[webkit-changes] [WebKit/WebKit] 376d44: Allow EnumeratedArray to infer the size of its int...

Myles C. Maxfield noreply at github.com
Thu Jul 13 01:36:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 376d4439778b24d4d73abf7e291f27912aa3017f
      https://github.com/WebKit/WebKit/commit/376d4439778b24d4d73abf7e291f27912aa3017f
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-07-13 (Thu, 13 Jul 2023)

  Changed paths:
    M Source/WTF/wtf/EnumTraits.h
    M Source/WTF/wtf/EnumeratedArray.h
    M Source/WebCore/platform/graphics/filters/FEComponentTransfer.h
    M Source/WebGPU/WebGPU/BindGroupLayout.h
    M Tools/Scripts/webkitpy/style/checkers/cpp.py
    M Tools/TestWebKitAPI/Tests/WTF/EnumTraits.cpp
    M Tools/TestWebKitAPI/Tests/WTF/EnumeratedArray.cpp

  Log Message:
  -----------
  Allow EnumeratedArray to infer the size of its internal array
https://bugs.webkit.org/show_bug.cgi?id=259174
rdar://112177459

Reviewed by Yusuke Suzuki.

We can use our existing pattern of EnumTraits to automatically calculate
what the maximum value of the enum is at compile time.

This patch also adds isZeroBasedContiguousEnum() which indicates whether the
enum is a good candidate for EnumeratedArray, but doesn't require it because
we have a few places in WebKit which use EnumeratedArray but aren't suitable
for using the EnumTraits pattern. Once these places are migrated, we can require
all enums used in EnumeratedArray to be isZeroBasedContiguousEnum().

* Source/WTF/wtf/EnumTraits.h:
(WTF::isZeroBasedContiguousEnum):
* Source/WTF/wtf/EnumeratedArray.h:
* Source/WebCore/platform/graphics/filters/FEComponentTransfer.h:
* Source/WebGPU/WebGPU/BindGroupLayout.h:
* Tools/TestWebKitAPI/Tests/WTF/EnumTraits.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WTF/EnumeratedArray.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/266026@main




More information about the webkit-changes mailing list