diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index e29b13917672..d52c192ca162 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -1927,10 +1927,10 @@ NPError PluginModuleChild::PluginRequiresAudioDeviceChanges( } } if (rv == NPERR_NO_ERROR) { - mAudioNotificationSet.PutEntry(aInstance); + mAudioNotificationSet.Insert(aInstance); } } else if (!mAudioNotificationSet.IsEmpty()) { - mAudioNotificationSet.RemoveEntry(aInstance); + mAudioNotificationSet.Remove(aInstance); if (mAudioNotificationSet.IsEmpty()) { // We released the last plugin. Unregister from the PluginModuleParent. if (!CallNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( @@ -1954,9 +1954,7 @@ PluginModuleChild::RecvNPP_SetValue_NPNVaudioDeviceChangeDetails( details.flow = detailsIPC.flow; details.role = detailsIPC.role; details.defaultDevice = detailsIPC.defaultDevice.c_str(); - for (auto iter = mAudioNotificationSet.ConstIter(); !iter.Done(); - iter.Next()) { - PluginInstanceChild* pluginInst = iter.Get()->GetKey(); + for (PluginInstanceChild* pluginInst : mAudioNotificationSet) { pluginInst->DefaultAudioDeviceChanged(details); } return IPC_OK(); @@ -1973,9 +1971,7 @@ PluginModuleChild::RecvNPP_SetValue_NPNVaudioDeviceStateChanged( NPAudioDeviceStateChanged stateChange; stateChange.newState = aDeviceStateIPC.state; stateChange.device = aDeviceStateIPC.device.c_str(); - for (auto iter = mAudioNotificationSet.ConstIter(); !iter.Done(); - iter.Next()) { - PluginInstanceChild* pluginInst = iter.Get()->GetKey(); + for (PluginInstanceChild* pluginInst : mAudioNotificationSet) { pluginInst->AudioDeviceStateChanged(stateChange); } return IPC_OK(); diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 493fe4e7606e..8909ca09a565 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -19,8 +19,9 @@ #include "npapi.h" #include "npfunctions.h" -#include "nsTHashtable.h" -#include "nsHashKeys.h" +#if defined(XP_WIN) +# include "nsTHashSet.h" +#endif #ifdef MOZ_WIDGET_COCOA # include "PluginInterposeOSX.h" @@ -282,7 +283,7 @@ class PluginModuleChild : public PPluginModuleChild { #endif #if defined(XP_WIN) - typedef nsTHashtable> PluginInstanceSet; + typedef nsTHashSet PluginInstanceSet; // Set of plugins that have registered to be notified when the audio device // changes. PluginInstanceSet mAudioNotificationSet; diff --git a/dom/plugins/ipc/PluginProcessParent.cpp b/dom/plugins/ipc/PluginProcessParent.cpp index 2f6531126359..8a960ebc966f 100644 --- a/dom/plugins/ipc/PluginProcessParent.cpp +++ b/dom/plugins/ipc/PluginProcessParent.cpp @@ -47,7 +47,7 @@ PluginProcessParent::PluginProcessParent(const std::string& aPluginFilePath) PluginProcessParent::~PluginProcessParent() { #ifdef XP_WIN if (sPidSet && mChildPid) { - sPidSet->RemoveEntry(mChildPid); + sPidSet->Remove(mChildPid); if (sPidSet->IsEmpty()) { delete sPidSet; sPidSet = nullptr; @@ -165,7 +165,7 @@ void PluginProcessParent::OnChannelConnected(int32_t peer_pid) { if (!sPidSet) { sPidSet = new PluginProcessParent::PidSet(); } - sPidSet->PutEntry(mChildPid); + sPidSet->Insert(mChildPid); #endif GeckoChildProcessHost::OnChannelConnected(peer_pid); diff --git a/dom/plugins/ipc/PluginProcessParent.h b/dom/plugins/ipc/PluginProcessParent.h index 48ce24cc7043..b2810865a584 100644 --- a/dom/plugins/ipc/PluginProcessParent.h +++ b/dom/plugins/ipc/PluginProcessParent.h @@ -19,8 +19,10 @@ #include "mozilla/ipc/TaskFactory.h" #include "mozilla/UniquePtr.h" #include "nsCOMPtr.h" -#include "nsTHashtable.h" -#include "nsHashKeys.h" + +#if defined(XP_WIN) +# include "nsTHashSet.h" +#endif namespace mozilla { namespace plugins { @@ -80,7 +82,7 @@ class PluginProcessParent final : public mozilla::ipc::GeckoChildProcessHost { UniquePtr mLaunchCompleteTask; MessageLoop* mMainMsgLoop; #ifdef XP_WIN - typedef nsTHashtable PidSet; + typedef nsTHashSet PidSet; // Set of PIDs for all plugin child processes or NULL if empty. static PidSet* sPidSet; uint32_t mChildPid; diff --git a/dom/plugins/ipc/PluginUtilsWin.cpp b/dom/plugins/ipc/PluginUtilsWin.cpp index 647d0d385e93..c913321d745f 100644 --- a/dom/plugins/ipc/PluginUtilsWin.cpp +++ b/dom/plugins/ipc/PluginUtilsWin.cpp @@ -9,13 +9,14 @@ #include "PluginUtilsWin.h" #include "PluginModuleParent.h" #include "mozilla/StaticMutex.h" +#include "nsTHashSet.h" namespace mozilla { namespace plugins { namespace PluginUtilsWin { class AudioNotification; -typedef nsTHashtable> PluginModuleSet; +typedef nsTHashSet PluginModuleSet; StaticMutex sMutex; class AudioDeviceMessageRunnable : public Runnable { @@ -147,12 +148,12 @@ class AudioNotification final : public IMMNotificationClient { void AddModule(PluginModuleParent* aModule) { StaticMutexAutoLock lock(sMutex); - mAudioNotificationSet.PutEntry(aModule); + mAudioNotificationSet.Insert(aModule); } void RemoveModule(PluginModuleParent* aModule) { StaticMutexAutoLock lock(sMutex); - mAudioNotificationSet.RemoveEntry(aModule); + mAudioNotificationSet.Remove(aModule); } /* @@ -247,9 +248,7 @@ AudioDeviceMessageRunnable::Run() { mAudioNotification->GetModuleSet()->Count())); bool success = true; - for (auto iter = mAudioNotification->GetModuleSet()->ConstIter(); - !iter.Done(); iter.Next()) { - PluginModuleParent* pluginModule = iter.Get()->GetKey(); + for (PluginModuleParent* pluginModule : *mAudioNotification->GetModuleSet()) { switch (mMessageType) { case DEFAULT_DEVICE_CHANGED: success &= pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(