Bug 314996
| Summary: | Avoid lazy-allocating UndoManager during Document teardown | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> |
| Component: | DOM | Assignee: | David Kilzer (:ddkilzer) <ddkilzer> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
David Kilzer (:ddkilzer)
`Document::willBeRemovedFromFrame()` calls `protect(undoManager())->removeAllItems()` unconditionally. `Document::undoManager()` lazy-creates the `UndoManager` through `ensureUndoManager()` when `m_undoManager` is null.
For clients that do not create `m_undoManager`, every detached `Document` lazy-allocates a 32-byte `UndoManager`, calls a no-op `removeAllItems()` on its empty `HashSet`, and then destroys it in `~Document`.
This is wasted work that scales with every detached `Document`.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/177311258>
David Kilzer (:ddkilzer)
Pull request: https://github.com/WebKit/WebKit/pull/65083
EWS
Committed 313393@main (408429b44b24): <https://commits.webkit.org/313393@main>
Reviewed commits have been landed. Closing PR #65083 and removing active labels.