Title: [167431] trunk/Source/WebKit2
Revision
167431
Author
da...@apple.com
Date
2014-04-17 09:58:33 -0700 (Thu, 17 Apr 2014)

Log Message

Remove use of deprecatedDeleteAllValues in NPRemoteObjectMap::pluginDestroyed
https://bugs.webkit.org/show_bug.cgi?id=122496

Reviewed by Brent Fulgham.

* Shared/Plugins/NPRemoteObjectMap.cpp:
(WebKit::NPRemoteObjectMap::pluginDestroyed): Use new-style code and write the
deprecatedDeleteAllValues function out using a loop. Might be nice to return here
and use unique_ptr instead some day, but I tried that before and got it wrong, so
lets do that another time.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (167430 => 167431)


--- trunk/Source/WebKit2/ChangeLog	2014-04-17 16:47:56 UTC (rev 167430)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-17 16:58:33 UTC (rev 167431)
@@ -1,5 +1,18 @@
 2014-04-17  Darin Adler  <da...@apple.com>
 
+        Remove use of deprecatedDeleteAllValues in NPRemoteObjectMap::pluginDestroyed
+        https://bugs.webkit.org/show_bug.cgi?id=122496
+
+        Reviewed by Brent Fulgham.
+
+        * Shared/Plugins/NPRemoteObjectMap.cpp:
+        (WebKit::NPRemoteObjectMap::pluginDestroyed): Use new-style code and write the
+        deprecatedDeleteAllValues function out using a loop. Might be nice to return here
+        and use unique_ptr instead some day, but I tried that before and got it wrong, so
+        lets do that another time.
+
+2014-04-17  Darin Adler  <da...@apple.com>
+
         Add separate flag for IndexedDatabase in workers since the current implementation is not threadsafe
         https://bugs.webkit.org/show_bug.cgi?id=131785
         rdar://problem/16003108

Modified: trunk/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp (167430 => 167431)


--- trunk/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp	2014-04-17 16:47:56 UTC (rev 167430)
+++ trunk/Source/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp	2014-04-17 16:58:33 UTC (rev 167431)
@@ -196,35 +196,26 @@
 
 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);
+    // 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;
 
-    // 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);
-    }
-
     // 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)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to