Make all edit command classes singleton
Categories
(Core :: DOM: Editor, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox68 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Most edit command classes are created per editor instance. This means that we have not reasonable runtime cost to allocate them when there are too many editors. Fortunately, most classes are stateless, and the statefull classes can be changed to stateless. Therefore, we can make them singleton.
If we make them singleton, we might be able to access them from nsHTMLDocument::ExecCommand() directly.
Updated•6 years ago
|
| Assignee | ||
Comment 1•6 years ago
|
||
Different from the comment in EditorCommands.h, editing commands and
editor commands are instantiated for each editable document or each
HTMLInputElement or HTMLTextareaElement. Therefore, even though they
are stateless, we allocate too many instances of them. We should make
them singleton classes to reduce the footprint and save runtime allocation
cost.
| Assignee | ||
Comment 2•6 years ago
|
||
Some "HTML editor commands" are stateful due to storing tag name to handle it
with specific command. However, we can make it stateless with retrieving
tag name from command name once per command only when it's necessary. The
runtime cost must be really cheap since we can map it with hash table.
This patch makes them stateless and singleton classes. So, we can save
footprint and allocation runtime cost with this change.
Comment 4•6 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/47b6254afb9a
https://hg.mozilla.org/mozilla-central/rev/b742fcff4f2b
Description
•