Bug 1497746 - part 5: Make EditorBase not reserve array for its listeners unless listeners are important r=m_kato

A lot of listeners are now notified with RefPtr for concrete classes.
Therefore, we can reduce size of arrays to listeners without damage for
the performance.

Differential Revision: https://phabricator.services.mozilla.com/D12403

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2018-11-26 06:32:34 +00:00
parent b376e84323
commit 674c63397e

View File

@ -2342,14 +2342,21 @@ protected:
RefPtr<IMEContentObserver> mIMEContentObserver;
// Listens to all low level actions on the doc.
typedef AutoTArray<OwningNonNull<nsIEditActionListener>, 5>
// Edit action listener is currently used by highlighter of the findbar and
// the spellchecker. So, we should reserve only 2 items.
typedef AutoTArray<OwningNonNull<nsIEditActionListener>, 2>
AutoActionListenerArray;
AutoActionListenerArray mActionListeners;
// Just notify once per high level change.
typedef AutoTArray<OwningNonNull<nsIEditorObserver>, 3>
// Editor observer is used only by legacy addons for Thunderbird and
// BlueGriffon. So, we don't need to reserve the space for them.
typedef AutoTArray<OwningNonNull<nsIEditorObserver>, 0>
AutoEditorObserverArray;
AutoEditorObserverArray mEditorObservers;
// Listen to overall doc state (dirty or not, just created, etc.).
// Document state listener is currently used by EditingSession and
// BlueGriffon so that reserving only one is enough (although, this is not
// necessary for TextEditor).
typedef AutoTArray<OwningNonNull<nsIDocumentStateListener>, 1>
AutoDocumentStateListenerArray;
AutoDocumentStateListenerArray mDocStateListeners;