diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp')
-rw-r--r-- | Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp index 8138c2ff7..61e1f9402 100644 --- a/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp +++ b/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp @@ -32,7 +32,6 @@ #include "NPObjectProxy.h" #include "NPRuntimeUtilities.h" #include "NPVariantData.h" -#include <wtf/OwnPtr.h> namespace WebKit { @@ -42,9 +41,9 @@ static uint64_t generateNPObjectID() return ++generateNPObjectID; } -PassRefPtr<NPRemoteObjectMap> NPRemoteObjectMap::create(IPC::Connection* connection) +Ref<NPRemoteObjectMap> NPRemoteObjectMap::create(IPC::Connection* connection) { - return adoptRef(new NPRemoteObjectMap(connection)); + return adoptRef(*new NPRemoteObjectMap(connection)); } NPRemoteObjectMap::NPRemoteObjectMap(IPC::Connection* connection) @@ -196,38 +195,29 @@ NPVariant NPRemoteObjectMap::npVariantDataToNPVariant(const NPVariantData& npVar void NPRemoteObjectMap::pluginDestroyed(Plugin* plugin) { - Vector<NPObjectMessageReceiver*> messageReceivers; - - // Gather the receivers associated with this plug-in. - for (HashMap<uint64_t, NPObjectMessageReceiver*>::const_iterator it = m_registeredNPObjects.begin(), end = m_registeredNPObjects.end(); it != end; ++it) { - NPObjectMessageReceiver* npObjectMessageReceiver = it->value; - if (npObjectMessageReceiver->plugin() == plugin) - messageReceivers.append(npObjectMessageReceiver); - } - - // Now delete all the receivers. - deprecatedDeleteAllValues(messageReceivers); - - Vector<NPObjectProxy*> objectProxies; - for (HashSet<NPObjectProxy*>::const_iterator it = m_npObjectProxies.begin(), end = m_npObjectProxies.end(); it != end; ++it) { - NPObjectProxy* npObjectProxy = *it; - - if (npObjectProxy->plugin() == plugin) - objectProxies.append(npObjectProxy); + // Gather and delete the receivers associated with this plug-in. + Vector<NPObjectMessageReceiver*> receivers; + for (auto* receiver : m_registeredNPObjects.values()) { + if (receiver->plugin() == plugin) + receivers.append(receiver); } + for (auto* receiver : receivers) + delete receiver; // Invalidate and remove all proxies associated with this plug-in. - for (size_t i = 0; i < objectProxies.size(); ++i) { - NPObjectProxy* npObjectProxy = objectProxies[i]; - - npObjectProxy->invalidate(); - - ASSERT(m_npObjectProxies.contains(npObjectProxy)); - m_npObjectProxies.remove(npObjectProxy); + Vector<NPObjectProxy*> proxies; + for (auto* proxy : m_npObjectProxies) { + if (proxy->plugin() == plugin) + proxies.append(proxy); + } + for (auto* proxy : proxies) { + proxy->invalidate(); + ASSERT(m_npObjectProxies.contains(proxy)); + m_npObjectProxies.remove(proxy); } } -void NPRemoteObjectMap::didReceiveSyncMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder) +void NPRemoteObjectMap::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder) { NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(decoder.destinationID()); if (!messageReceiver) |