Bug 1336011 part.2 Create an alias of the type of mEditorObservers r=smaug a=gchang
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 07 Feb 2017 22:36:16 +0900
changeset 376081 12fc66e0bd09cdb9df716021155d2902f36e7c1d
parent 376080 18159c08997bf5d5f3cdd4b3521824f1701f3890
child 376082 b1ce19322f8dc1075000b36df64f403848ae9108
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, gchang
bugs1336011
milestone53.0a2
Bug 1336011 part.2 Create an alias of the type of mEditorObservers r=smaug a=gchang MozReview-Commit-ID: 7LWl5F4C0Ge
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -1871,17 +1871,17 @@ private:
   nsCOMPtr<nsIContent> mTarget;
   bool mIsComposing;
 };
 
 void
 EditorBase::NotifyEditorObservers(NotificationForEditorObservers aNotification)
 {
   // Copy the observers since EditAction()s can modify mEditorObservers.
-  nsTArray<mozilla::OwningNonNull<nsIEditorObserver>> observers(mEditorObservers);
+  AutoEditorObserverArray observers(mEditorObservers);
   switch (aNotification) {
     case eNotifyEditorObserversOfEnd:
       mIsInEditAction = false;
       for (auto& observer : observers) {
         observer->EditAction();
       }
 
       if (!mDispatchInputEvent) {
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -998,17 +998,19 @@ protected:
   // compositionend.
   RefPtr<TextComposition> mComposition;
 
   // Listens to all low level actions on the doc.
   typedef AutoTArray<OwningNonNull<nsIEditActionListener>, 5>
             AutoActionListenerArray;
   AutoActionListenerArray mActionListeners;
   // Just notify once per high level change.
-  nsTArray<OwningNonNull<nsIEditorObserver>> mEditorObservers;
+  typedef AutoTArray<OwningNonNull<nsIEditorObserver>, 3>
+            AutoEditorObserverArray;
+  AutoEditorObserverArray mEditorObservers;
   // Listen to overall doc state (dirty or not, just created, etc.).
   nsTArray<OwningNonNull<nsIDocumentStateListener>> mDocStateListeners;
 
   // Cached selection for AutoSelectionRestorer.
   SelectionState mSavedSel;
   // Utility class object for maintaining preserved ranges.
   RangeUpdater mRangeUpdater;