From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp | 48 +++++++++------------- 1 file changed, 19 insertions(+), 29 deletions(-) (limited to 'Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp') 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 namespace WebKit { @@ -42,9 +41,9 @@ static uint64_t generateNPObjectID() return ++generateNPObjectID; } -PassRefPtr NPRemoteObjectMap::create(IPC::Connection* connection) +Ref 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 messageReceivers; - - // Gather the receivers associated with this plug-in. - for (HashMap::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 objectProxies; - for (HashSet::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 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 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& replyEncoder) +void NPRemoteObjectMap::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr& replyEncoder) { NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(decoder.destinationID()); if (!messageReceiver) -- cgit v1.2.1