Title: [218767] trunk/Source/WebKit2
Revision
218767
Author
[email protected]
Date
2017-06-23 15:08:52 -0700 (Fri, 23 Jun 2017)

Log Message

Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks()
https://bugs.webkit.org/show_bug.cgi?id=173786

Reviewed by Geoffrey Garen.

Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks().
Instead, just move the HashSet and iterate on that. This is OK since we were
clearing the HashSet right after copying it to the vector anyway.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::clearLoadDependentCallbacks):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (218766 => 218767)


--- trunk/Source/WebKit2/ChangeLog	2017-06-23 21:34:31 UTC (rev 218766)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-23 22:08:52 UTC (rev 218767)
@@ -1,5 +1,19 @@
 2017-06-23  Chris Dumez  <[email protected]>
 
+        Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks()
+        https://bugs.webkit.org/show_bug.cgi?id=173786
+
+        Reviewed by Geoffrey Garen.
+
+        Avoid copying HashSet to Vector in WebPageProxy::clearLoadDependentCallbacks().
+        Instead, just move the HashSet and iterate on that. This is OK since we were
+        clearing the HashSet right after copying it to the vector anyway.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::clearLoadDependentCallbacks):
+
+2017-06-23  Chris Dumez  <[email protected]>
+
         Unreviewed, fix Debug build after r218763
 
         * NetworkProcess/NetworkDataTask.cpp:

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (218766 => 218767)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2017-06-23 21:34:31 UTC (rev 218766)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2017-06-23 22:08:52 UTC (rev 218767)
@@ -3243,13 +3243,9 @@
 
 void WebPageProxy::clearLoadDependentCallbacks()
 {
-    Vector<uint64_t> callbackIDsCopy;
-    copyToVector(m_loadDependentStringCallbackIDs, callbackIDsCopy);
-    m_loadDependentStringCallbackIDs.clear();
-
-    for (size_t i = 0; i < callbackIDsCopy.size(); ++i) {
-        auto callback = m_callbacks.take<StringCallback>(callbackIDsCopy[i]);
-        if (callback)
+    HashSet<uint64_t> loadDependentStringCallbackIDs = WTFMove(m_loadDependentStringCallbackIDs);
+    for (auto& callbackID : loadDependentStringCallbackIDs) {
+        if (auto callback = m_callbacks.take<StringCallback>(callbackID))
             callback->invalidate();
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to