Backed out changeset 9d111a95cfbb (bug 1425930) for build bustages at ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskSki on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Mon, 21 May 2018 18:01:29 +0300
changeset 419169 1f0b7e9a6450c28f816ca52d8809c41b6b87b3e5
parent 419168 f5184707be080958b3ae54daef843e7374c25f35
child 419170 8d53d570eedc46bdf4bfe0e2beaf8df21fd4adc2
push id34029
push usershindli@mozilla.com
push dateMon, 21 May 2018 21:30:22 +0000
treeherdermozilla-central@51f2535c7974 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1425930
milestone62.0a1
backs out9d111a95cfbbe2dea1427d22ab342a584d9c8af6
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
Backed out changeset 9d111a95cfbb (bug 1425930) for build bustages at ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskSki on a CLOSED TREE
xpcom/ds/Observer.h
--- a/xpcom/ds/Observer.h
+++ b/xpcom/ds/Observer.h
@@ -52,50 +52,32 @@ public:
   }
 
   /**
    * Remove the observer from the observer list.
    * @return Whether the observer has been found in the list.
    */
   bool RemoveObserver(Observer<T>* aObserver)
   {
-    if (mObservers.RemoveElement(aObserver)) {
-      // Annoyingly, someone could RemoveObserver() an item on the list
-      // while we're in a Broadcast()'s Notify() call.
-      auto i = mBroadcastCopy.IndexOf(aObserver);
-      MOZ_ASSERT(i != mBroadcastCopy.NoIndex);
-      mBroadcastCopy[i] = nullptr;
-      return true;
-    }
-    return false;
+    return mObservers.RemoveElement(aObserver);
   }
 
   uint32_t Length()
   {
     return mObservers.Length();
   }
 
-  /**
-   * Call Notify() on each item in the list.
-   * Handles the case of Notify() calling RemoveObserver()
-   */
   void Broadcast(const T& aParam)
   {
-    MOZ_ASSERT(mBroadcastCopy.IsEmpty());
-    mBroadcastCopy = mObservers;
-    uint32_t size = mBroadcastCopy.Length();
+    nsTArray<Observer<T>*> observersCopy(mObservers);
+    uint32_t size = observersCopy.Length();
     for (uint32_t i = 0; i < size; ++i) {
-      // nulled if Removed during Broadcast
-      if (mBroadcastCopy[i]) {
-        mBroadcastCopy[i]->Notify(aParam);
-      }
+      observersCopy[i]->Notify(aParam);
     }
-    mBroadcastCopy.Clear();
   }
 
 protected:
   nsTArray<Observer<T>*> mObservers;
-  nsTArray<Observer<T>*> mBroadcastCopy;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_Observer_h