Bug 1497746 - part 5: Make EditorBase not reserve array for its listeners unless listeners are important r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 26 Nov 2018 06:32:34 +0000
changeset 507168 324232a1330c2a0661973d49f54ab5d29ca30a64
parent 507167 ceb75e2e0421b36d6d9e680830902d4196e94717
child 507169 fb45231e386d90110cdc7b93297e609e02c2b2a7
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1497746
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
editor/libeditor/EditorBase.h
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -2337,24 +2337,31 @@ protected:
 
   RefPtr<TextEditRules> mRules;
 
   RefPtr<TextInputListener> mTextInputListener;
 
   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;
 
   // Number of modifications (for undo/redo stack).
   uint32_t mModCount;
   // Behavior flags. See nsIPlaintextEditor.idl for the flags we use.
   uint32_t mFlags;