зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1648440 - Use range-based for in WorkerDebuggerManager. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81059
This commit is contained in:
Родитель
e2e2fb7640
Коммит
945865f778
|
@ -278,15 +278,8 @@ void WorkerDebuggerManager::RegisterDebuggerMainThread(
|
|||
aWorkerPrivate->SetDebugger(debugger);
|
||||
|
||||
if (aNotifyListeners) {
|
||||
nsTArray<nsCOMPtr<nsIWorkerDebuggerManagerListener>> listeners;
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
listeners = mListeners.Clone();
|
||||
}
|
||||
|
||||
for (size_t index = 0; index < listeners.Length(); ++index) {
|
||||
listeners[index]->OnRegister(debugger);
|
||||
for (const auto& listener : CloneListeners()) {
|
||||
listener->OnRegister(debugger);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,15 +303,8 @@ void WorkerDebuggerManager::UnregisterDebuggerMainThread(
|
|||
|
||||
aWorkerPrivate->SetDebugger(nullptr);
|
||||
|
||||
nsTArray<nsCOMPtr<nsIWorkerDebuggerManagerListener>> listeners;
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
listeners = mListeners.Clone();
|
||||
}
|
||||
|
||||
for (size_t index = 0; index < listeners.Length(); ++index) {
|
||||
listeners[index]->OnUnregister(debugger);
|
||||
for (const auto& listener : CloneListeners()) {
|
||||
listener->OnUnregister(debugger);
|
||||
}
|
||||
|
||||
debugger->Close();
|
||||
|
@ -333,5 +319,12 @@ WorkerDebugger* WorkerDebuggerManager::GetDebuggerAt(uint32_t aIndex) const {
|
|||
return mDebuggers.SafeElementAt(aIndex, nullptr);
|
||||
}
|
||||
|
||||
nsTArray<nsCOMPtr<nsIWorkerDebuggerManagerListener>>
|
||||
WorkerDebuggerManager::CloneListeners() {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
return mListeners.Clone();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -72,6 +72,8 @@ class WorkerDebuggerManager final : public nsIObserver,
|
|||
WorkerDebugger* GetDebuggerAt(uint32_t aIndex) const;
|
||||
|
||||
private:
|
||||
nsTArray<nsCOMPtr<nsIWorkerDebuggerManagerListener>> CloneListeners();
|
||||
|
||||
virtual ~WorkerDebuggerManager();
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче