Bug 1336011 part.3 Create an alias of the type of mDocStateListeners r=smaug a=gchang
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 07 Feb 2017 22:52:23 +0900
changeset 378366 b1ce19322f8dc1075000b36df64f403848ae9108
parent 378365 12fc66e0bd09cdb9df716021155d2902f36e7c1d
child 378367 f02cc905662a4008a569381202a9494daf0d1bec
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, gchang
bugs1336011
milestone53.0a2
Bug 1336011 part.3 Create an alias of the type of mDocStateListeners r=smaug a=gchang MozReview-Commit-ID: L0TczDcH4t8
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2617,18 +2617,17 @@ NS_IMETHODIMP
 EditorBase::NotifyDocumentListeners(
               TDocumentListenerNotification aNotificationType)
 {
   if (!mDocStateListeners.Length()) {
     // Maybe there just aren't any.
     return NS_OK;
   }
 
-  nsTArray<OwningNonNull<nsIDocumentStateListener>>
-    listeners(mDocStateListeners);
+  AutoDocumentStateListenerArray listeners(mDocStateListeners);
   nsresult rv = NS_OK;
 
   switch (aNotificationType) {
     case eDocumentCreated:
       for (auto& listener : listeners) {
         rv = listener->NotifyDocumentCreated();
         if (NS_FAILED(rv)) {
           break;
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1002,17 +1002,19 @@ protected:
   typedef AutoTArray<OwningNonNull<nsIEditActionListener>, 5>
             AutoActionListenerArray;
   AutoActionListenerArray mActionListeners;
   // Just notify once per high level change.
   typedef AutoTArray<OwningNonNull<nsIEditorObserver>, 3>
             AutoEditorObserverArray;
   AutoEditorObserverArray mEditorObservers;
   // Listen to overall doc state (dirty or not, just created, etc.).
-  nsTArray<OwningNonNull<nsIDocumentStateListener>> mDocStateListeners;
+  typedef AutoTArray<OwningNonNull<nsIDocumentStateListener>, 1>
+            AutoDocumentStateListenerArray;
+  AutoDocumentStateListenerArray mDocStateListeners;
 
   // Cached selection for AutoSelectionRestorer.
   SelectionState mSavedSel;
   // Utility class object for maintaining preserved ranges.
   RangeUpdater mRangeUpdater;
 
   // Number of modifications (for undo/redo stack).
   uint32_t mModCount;