[webkit-changes] [WebKit/WebKit] d1a126: [WebCore] Reduce size of CustomPaintCanvas, HTMLCa...
Commit Queue
noreply at github.com
Mon Feb 17 10:28:27 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d1a126e1325e2bb2dfcb595964988262ef0e14f0
https://github.com/WebKit/WebKit/commit/d1a126e1325e2bb2dfcb595964988262ef0e14f0
Author: David Kilzer <ddkilzer at apple.com>
Date: 2025-02-17 (Mon, 17 Feb 2025)
Changed paths:
M Source/WebCore/html/CanvasBase.h
M Source/WebCore/html/CustomPaintCanvas.h
M Source/WebCore/html/HTMLCanvasElement.cpp
M Source/WebCore/html/HTMLCanvasElement.h
M Source/WebCore/html/OffscreenCanvas.h
Log Message:
-----------
[WebCore] Reduce size of CustomPaintCanvas, HTMLCanvasElement, OffscreenCanvas by 8 bytes each
<https://bugs.webkit.org/show_bug.cgi?id=287777>
<rdar://144952951>
Reviewed by Ryosuke Niwa.
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasBase):
- Move WeakHashSet instance variables so that bool variables are last in
the class. This lets us use the last 6 bytes of padding to save space
in subclasses which inherit from RefCounted<> or that have bool
instance variables. The size of CanvasBase remains at 120 bytes.
* Source/WebCore/html/CustomPaintCanvas.h:
(WebCore::CustomPaintCanvas):
- Reorder class inheritance to inherit from CanvasBase then RefCounted<>
because RefCounted<> fits within the last 6 free bytes of CanvasBase.
This reduces the size of CustomPaintCanvas from 168 to 160 bytes.
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::HTMLCanvasElement):
- Reorder initializer list for change to class definition.
* Source/WebCore/html/HTMLCanvasElement.h:
(WebCore::HTMLCanvasElement):
- Reorder class inheritance to inherit from CanvasBase last since it has
6 bytes of padding. Then move 4 bool instance variables to the
beginning of HTMLCanvasElement so they can be packed in the padding.
This reduces the size of HTMLCanvasElement from 304 to 296 bytes.
* Source/WebCore/html/OffscreenCanvas.h:
(WebCore::OffscreenCanvas):
- Reorder class inheritance to inherit from CanvasBase then RefCounted<>
because RefCounted<> fits within the last 6 free bytes of CanvasBase.
This reduces the size of OffscreenCanvas from 224 to 216 bytes.
Canonical link: https://commits.webkit.org/290488@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list