Bug 1336011 part.3 Create an alias of the type of mDocStateListeners r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 07 Feb 2017 22:52:23 +0900
changeset 479921 7d41f51ff70017fac33351e61e7e924c0d17684f
parent 479920 90e690c023c8d37fbb68a0ecdda551a65200aa11
child 544815 f122a00e5183ca66e83784b4dbb3246f74b41d4f
push id44394
push usermasayuki@d-toybox.com
push dateTue, 07 Feb 2017 14:04:59 +0000
reviewerssmaug
bugs1336011
milestone54.0a1
Bug 1336011 part.3 Create an alias of the type of mDocStateListeners r?smaug 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 @@ nsresult
 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
@@ -1006,17 +1006,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;