[webkit-changes] [WebKit/WebKit] 8c8d35: CustomElementReactionQueueItem: don't allocate all...

Commit Queue noreply at github.com
Mon Jan 9 19:31:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c8d35286037ce901078dc15bc2f20172a976889
      https://github.com/WebKit/WebKit/commit/8c8d35286037ce901078dc15bc2f20172a976889
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2023-01-09 (Mon, 09 Jan 2023)

  Changed paths:
    M Source/WebCore/dom/CustomElementReactionQueue.cpp
    M Source/WebCore/dom/CustomElementReactionQueue.h

  Log Message:
  -----------
  CustomElementReactionQueueItem: don't allocate all arguments for all callback types
https://bugs.webkit.org/show_bug.cgi?id=249956

Reviewed by Ryosuke Niwa.

This change leverages std::variant to:
  * shrink sizeof(CustomElementReactionQueueItem) from 88 to 56;
  * remove 5 constructors;
  * make correspondence between Item's type() and payload obvious,
    adding asserts about existence / shape of the latter;
  * refine some types by removing std::optional and using Ref instead of RefPtr.

No new tests, no behavior change.

* Source/WebCore/dom/CustomElementReactionQueue.cpp:
(WebCore::CustomElementReactionQueueItem::CustomElementReactionQueueItem):
(WebCore::CustomElementReactionQueueItem::invoke):
(WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
(WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormAssociatedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormResetCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormDisabledCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueFormStateRestoreCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions):
(WebCore::CustomElementReactionQueue::invokeAll):
* Source/WebCore/dom/CustomElementReactionQueue.h:

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




More information about the webkit-changes mailing list