зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1413604 P2 Make WorkerHolderToken use an nsTObserverArray to allow for mutation during iteration. r=asuth
This commit is contained in:
Родитель
ad2679cd26
Коммит
55385cd906
|
@ -96,14 +96,17 @@ WorkerHolderToken::Notify(Status aStatus)
|
|||
return true;
|
||||
}
|
||||
|
||||
mShuttingDown = true;
|
||||
|
||||
// Start the asynchronous destruction of our actors. These will call back
|
||||
// into RemoveActor() once the actor is destroyed.
|
||||
for (uint32_t i = 0; i < mListenerList.Length(); ++i) {
|
||||
mListenerList[i]->WorkerShuttingDown();
|
||||
nsTObserverArray<Listener*>::ForwardIterator iter(mListenerList);
|
||||
while (iter.HasMore()) {
|
||||
iter.GetNext()->WorkerShuttingDown();
|
||||
}
|
||||
|
||||
// Set this after calling WorkerShuttingDown() on listener list in case
|
||||
// one callback triggers another listener to be added.
|
||||
mShuttingDown = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define mozilla_dom_workers_WorkerHolderToken_h
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "WorkerHolder.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
@ -67,7 +67,7 @@ private:
|
|||
virtual bool
|
||||
Notify(workers::Status aStatus) override;
|
||||
|
||||
nsTArray<Listener*> mListenerList;
|
||||
nsTObserverArray<Listener*> mListenerList;
|
||||
const Status mShutdownStatus;
|
||||
bool mShuttingDown;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче