mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1181445 (part 9) - Use nsBaseHashTable::Iterator in nsConsoleService. r=froydnj.
This commit is contained in:
parent
85c9fe03d6
commit
16b5e58866
@ -137,17 +137,6 @@ private:
|
||||
nsRefPtr<nsConsoleService> mService;
|
||||
};
|
||||
|
||||
typedef nsCOMArray<nsIConsoleListener> ListenerArrayType;
|
||||
|
||||
PLDHashOperator
|
||||
CollectCurrentListeners(nsISupports* aKey, nsIConsoleListener* aValue,
|
||||
void* aClosure)
|
||||
{
|
||||
ListenerArrayType* listeners = static_cast<ListenerArrayType*>(aClosure);
|
||||
listeners->AppendObject(aValue);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LogMessageRunnable::Run()
|
||||
{
|
||||
@ -156,7 +145,7 @@ LogMessageRunnable::Run()
|
||||
// Snapshot of listeners so that we don't reenter this hash during
|
||||
// enumeration.
|
||||
nsCOMArray<nsIConsoleListener> listeners;
|
||||
mService->EnumerateListeners(CollectCurrentListeners, &listeners);
|
||||
mService->CollectCurrentListeners(listeners);
|
||||
|
||||
mService->SetIsDelivering();
|
||||
|
||||
@ -306,11 +295,14 @@ nsConsoleService::LogMessageWithMode(nsIConsoleMessage* aMessage,
|
||||
}
|
||||
|
||||
void
|
||||
nsConsoleService::EnumerateListeners(ListenerHash::EnumReadFunction aFunction,
|
||||
void* aClosure)
|
||||
nsConsoleService::CollectCurrentListeners(
|
||||
nsCOMArray<nsIConsoleListener>& aListeners)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
mListeners.EnumerateRead(aFunction, aClosure);
|
||||
for (auto iter = mListeners.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsIConsoleListener* value = iter.GetUserData();
|
||||
aListeners.AppendObject(value);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -55,8 +55,7 @@ public:
|
||||
|
||||
typedef nsInterfaceHashtable<nsISupportsHashKey,
|
||||
nsIConsoleListener> ListenerHash;
|
||||
void EnumerateListeners(ListenerHash::EnumReadFunction aFunction,
|
||||
void* aClosure);
|
||||
void CollectCurrentListeners(nsCOMArray<nsIConsoleListener>& aListeners);
|
||||
|
||||
private:
|
||||
~nsConsoleService();
|
||||
|
Loading…
Reference in New Issue
Block a user