From 35f6d9fd0f77680bc9b5fa3d3e7ef1f4216691f6 Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Thu, 16 Jul 2015 17:00:00 -0400 Subject: [PATCH] Bug 1184432 - Use nsClassHashtable::ConstIter in GeckoMediaPluginServiceParent::AsyncShutdownPluginStates. r=cpearce --- dom/media/gmp/GMPServiceParent.cpp | 52 ++++++++++-------------------- dom/media/gmp/GMPServiceParent.h | 6 ---- 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 2b56e60c1453..ee84da67ed54 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -423,7 +423,23 @@ GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::Update(const nsCString state->mStateSequence += aId; state->mLastStateDescription = aState; note += '{'; - mStates.EnumerateRead(EnumReadPlugins, ¬e); + bool firstPlugin = true; + for (auto pluginIt = mStates.ConstIter(); !pluginIt.Done(); pluginIt.Next()) { + if (!firstPlugin) { note += ','; } else { firstPlugin = false; } + note += pluginIt.GetKey(); + note += ":{"; + bool firstInstance = true; + for (auto instanceIt = pluginIt.GetData()->ConstIter(); !instanceIt.Done(); instanceIt.Next()) { + if (!firstInstance) { note += ','; } else { firstInstance = false; } + note += instanceIt.GetKey(); + note += ":\""; + note += instanceIt.GetData()->mStateSequence; + note += '='; + note += instanceIt.GetData()->mLastStateDescription; + note += '"'; + } + note += '}'; + } note += '}'; LOGD(("%s::%s states[%s][%s]='%c'/'%s' -> %s", __CLASS__, __FUNCTION__, aPlugin.get(), aInstance.get(), aId, aState.get(), note.get())); @@ -431,40 +447,6 @@ GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::Update(const nsCString NS_LITERAL_CSTRING("AsyncPluginShutdownStates"), note); } - -// static -PLDHashOperator -GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::EnumReadPlugins( - StateInstancesByPlugin::KeyType aKey, - StateInstancesByPlugin::UserDataType aData, - void* aUserArg) -{ - nsCString& note = *static_cast(aUserArg); - if (note.Last() != '{') { note += ','; } - note += aKey; - note += ":{"; - aData->EnumerateRead(EnumReadInstances, ¬e); - note += '}'; - return PL_DHASH_NEXT; -} - -// static -PLDHashOperator -GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::EnumReadInstances( - StatesByInstance::KeyType aKey, - StatesByInstance::UserDataType aData, - void* aUserArg) -{ - nsCString& note = *static_cast(aUserArg); - if (note.Last() != '{') { note += ','; } - note += aKey; - note += ":\""; - note += aData->mStateSequence; - note += '='; - note += aData->mLastStateDescription; - note += '"'; - return PL_DHASH_NEXT; -} #endif // MOZ_CRASHREPORTER void diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index 16de1d78c06e..3677753b55b6 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -152,12 +152,6 @@ private: struct State { nsAutoCString mStateSequence; nsCString mLastStateDescription; }; typedef nsClassHashtable StatesByInstance; typedef nsClassHashtable StateInstancesByPlugin; - static PLDHashOperator EnumReadPlugins(StateInstancesByPlugin::KeyType aKey, - StateInstancesByPlugin::UserDataType aData, - void* aUserArg); - static PLDHashOperator EnumReadInstances(StatesByInstance::KeyType aKey, - StatesByInstance::UserDataType aData, - void* aUserArg); StateInstancesByPlugin mStates; } mAsyncShutdownPluginStates; #endif // MOZ_CRASHREPORTER