Commit 9be08721 authored by kenneth@webkit.org's avatar kenneth@webkit.org

2009-07-30 Kenneth Rohde Christiansen <kenneth@webkit.org>

        Reviewed by Ariya Hidayat.

        Improve efficiency by rewriting code doing three hash table
        lookups, which can be replaced by just one as pointed out
        by Darin Adler.

        Though being slightly less clear, this should be considerable
        faster.

        * plugins/PluginDatabase.cpp:
        (WebCore::PluginDatabase::remove):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b173d663
2009-07-30 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Ariya Hidayat.
Improve efficiency by rewriting code doing three hash table
lookups, which can be replaced by just one as pointed out
by Darin Adler.
Though being slightly less clear, this should be considerable
faster.
* plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::remove):
2009-07-30 Antonio Gomes <antonio.gomes@openbossa.org>
Reviewed by Gustavo Noronha.
......
......@@ -34,6 +34,8 @@
namespace WebCore {
typedef HashMap<String, RefPtr<PluginPackage> > PluginPackageByNameMap;
PluginDatabase* PluginDatabase::installedPlugins(bool populate)
{
static PluginDatabase* plugins = 0;
......@@ -292,8 +294,9 @@ void PluginDatabase::remove(PluginPackage* package)
MIMEToExtensionsMap::const_iterator it = package->mimeToExtensions().begin();
MIMEToExtensionsMap::const_iterator end = package->mimeToExtensions().end();
for ( ; it != end; ++it) {
if (m_preferredPlugins.contains(it->first) && m_preferredPlugins.get(it->first) == package)
m_preferredPlugins.remove(it->first);
PluginPackageByNameMap::iterator packageInMap = m_preferredPlugins.find(it->first);
if (packageInMap != m_preferredPlugins.end() && packageInMap->second == package)
m_preferredPlugins.remove(packageInMap);
}
m_plugins.remove(package);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment