Title: [163959] trunk/Source
Revision
163959
Author
[email protected]
Date
2014-02-12 09:10:25 -0800 (Wed, 12 Feb 2014)

Log Message

Remove some unintended copies in ranged for loops
https://bugs.webkit.org/show_bug.cgi?id=128644

Reviewed by Anders Carlsson.

../_javascript_Core: 

* inspector/InjectedScriptHost.cpp:
(Inspector::InjectedScriptHost::clearAllWrappers): Avoid creating/destroying
a std::pair<> and pointer each loop iteration.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::Parser): Avoid copying object containing a string
each loop iteration.

../WebCore: 

* css/StyleResolver.cpp:
(WebCore::StyleResolver::loadPendingSVGDocuments): Avoid creating/destroying
RefPtrs in loop.

../WebKit2: 

* Shared/WebCrossThreadCopier.cpp:
(WebCore::Vector<Vector<IDBKeyData>>>::copy): Each iteration copies a vector of
vectors, 
* Shared/mac/RemoteLayerBackingStore.mm:
(RemoteLayerBackingStore::enumerateRectsBeingDrawn): Avoid copying a FloatRect
on each iteration.
* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer): Avoid copying
a LayerProperty object each iteration.
* UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
(WebKit::GeolocationPermissionRequestManagerProxy::invalidateRequests): Avoid
copying a pair<int64_t, pointer> each iteration.
* UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
(WebKit::NotificationPermissionRequestManagerProxy::invalidateRequests): Ditto
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto
* UIProcess/WebContext.cpp:
(WebKit::WebContext::postMessageToInjectedBundle): Avoid creating/destroying a
RefPtr each loop iteration.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::shouldStartTrackingTouchEvents): Avoid copying a WebPlatformTouchPoint
object each cycle.
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree): Avoid copying a pair each iteration.
* UIProcess/mac/WindowServerConnection.mm:
(WebKit::WindowServerConnection::WindowServerConnection): Avoid copying the struct
of occlusionNotificationHandlers each iteration.
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::put): Avoid copying a vector-of-vectors each
iteration.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::recursiveBuildTransaction): Avoid creating/destroying a
RefPtr each loop iteration.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (163958 => 163959)


--- trunk/Source/_javascript_Core/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-02-12 17:10:25 UTC (rev 163959)
@@ -1,3 +1,17 @@
+2014-02-11  Brent Fulgham  <[email protected]>
+
+        Remove some unintended copies in ranged for loops
+        https://bugs.webkit.org/show_bug.cgi?id=128644
+
+        Reviewed by Anders Carlsson.
+
+        * inspector/InjectedScriptHost.cpp:
+        (Inspector::InjectedScriptHost::clearAllWrappers): Avoid creating/destroying
+        a std::pair<> and pointer each loop iteration.
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::Parser): Avoid copying object containing a string
+        each loop iteration.
+
 2014-02-11  Ryosuke Niwa  <[email protected]>
 
         Debug build fix after r163946.

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptHost.cpp (163958 => 163959)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptHost.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptHost.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -72,7 +72,7 @@
 
 void InjectedScriptHost::clearAllWrappers()
 {
-    for (auto wrapper : m_wrappers)
+    for (auto& wrapper : m_wrappers)
         clearWrapperFromValue(wrapper.value.get());
 
     m_wrappers.clear();

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (163958 => 163959)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -237,7 +237,7 @@
                     continue;
                 parameter->collectBoundIdentifiers(boundParameterNames);
             }
-            for (auto boundParameterName : boundParameterNames)
+            for (auto& boundParameterName : boundParameterNames)
                 scope->declareVariable(&boundParameterName);
         }
     }

Modified: trunk/Source/WebCore/ChangeLog (163958 => 163959)


--- trunk/Source/WebCore/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebCore/ChangeLog	2014-02-12 17:10:25 UTC (rev 163959)
@@ -1,3 +1,14 @@
+2014-02-11  Brent Fulgham  <[email protected]>
+
+        Remove some unintended copies in ranged for loops
+        https://bugs.webkit.org/show_bug.cgi?id=128644
+
+        Reviewed by Anders Carlsson.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::loadPendingSVGDocuments): Avoid creating/destroying
+        RefPtrs in loop.
+
 2014-02-12  Raphael Kubo da Costa  <[email protected]>
 
         Update the HTML Media Capture implementation.

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (163958 => 163959)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -3324,7 +3324,7 @@
         return;
 
     CachedResourceLoader* cachedResourceLoader = state.document().cachedResourceLoader();
-    for (auto filterOperation : state.filtersWithPendingSVGDocuments())
+    for (auto& filterOperation : state.filtersWithPendingSVGDocuments())
         filterOperation->getOrCreateCachedSVGDocumentReference()->load(cachedResourceLoader);
 
     state.filtersWithPendingSVGDocuments().clear();

Modified: trunk/Source/WebKit2/ChangeLog (163958 => 163959)


--- trunk/Source/WebKit2/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-12 17:10:25 UTC (rev 163959)
@@ -1,3 +1,44 @@
+2014-02-11  Brent Fulgham  <[email protected]>
+
+        Remove some unintended copies in ranged for loops
+        https://bugs.webkit.org/show_bug.cgi?id=128644
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/WebCrossThreadCopier.cpp:
+        (WebCore::Vector<Vector<IDBKeyData>>>::copy): Each iteration copies a vector of
+        vectors, 
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (RemoteLayerBackingStore::enumerateRectsBeingDrawn): Avoid copying a FloatRect
+        on each iteration.
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer): Avoid copying
+        a LayerProperty object each iteration.
+        * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
+        (WebKit::GeolocationPermissionRequestManagerProxy::invalidateRequests): Avoid
+        copying a pair<int64_t, pointer> each iteration.
+        * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
+        (WebKit::NotificationPermissionRequestManagerProxy::invalidateRequests): Ditto
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::postMessageToInjectedBundle): Avoid creating/destroying a
+        RefPtr each loop iteration.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::shouldStartTrackingTouchEvents): Avoid copying a WebPlatformTouchPoint
+        object each cycle.
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::updateLayerTree): Avoid copying a pair each iteration.
+        * UIProcess/mac/WindowServerConnection.mm:
+        (WebKit::WindowServerConnection::WindowServerConnection): Avoid copying the struct
+        of occlusionNotificationHandlers each iteration.
+        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
+        (WebKit::WebIDBServerConnection::put): Avoid copying a vector-of-vectors each
+        iteration.
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (PlatformCALayerRemote::recursiveBuildTransaction): Avoid creating/destroying a
+        RefPtr each loop iteration.
+
 2014-02-12  Raphael Kubo da Costa  <[email protected]>
 
         Update the HTML Media Capture implementation.

Modified: trunk/Source/WebKit2/Shared/WebCrossThreadCopier.cpp (163958 => 163959)


--- trunk/Source/WebKit2/Shared/WebCrossThreadCopier.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/Shared/WebCrossThreadCopier.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -70,9 +70,9 @@
 {
     Vector<Vector<IDBKeyData>> result;
 
-    for (auto keys : vector) {
+    for (const auto& keys : vector) {
         result.append(Vector<IDBKeyData>());
-        for (auto key : keys)
+        for (const auto& key : keys)
             result.last().append(WebCore::CrossThreadCopier<IDBKeyData>::copy(key));
     }
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (163958 => 163959)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2014-02-12 17:10:25 UTC (rev 163959)
@@ -342,7 +342,7 @@
     inverseTransform = CGAffineTransformScale(inverseTransform, m_scale, -m_scale);
     inverseTransform = CGAffineTransformTranslate(inverseTransform, 0, -m_size.height());
 
-    for (auto rect : m_paintingRects) {
+    for (const auto& rect : m_paintingRects) {
         CGRect rectToDraw = CGRectApplyAffineTransform(rect, inverseTransform);
         block(rectToDraw);
     }

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (163958 => 163959)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2014-02-12 17:10:25 UTC (rev 163959)
@@ -102,7 +102,7 @@
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
         RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
-        for (auto child : properties.children)
+        for (auto& child : properties.children)
             [children addObject:relatedLayers.get(child)];
         layer.sublayers = children.get();
     }

Modified: trunk/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -39,7 +39,7 @@
 
 void GeolocationPermissionRequestManagerProxy::invalidateRequests()
 {
-    for (auto request : m_pendingRequests.values())
+    for (auto& request : m_pendingRequests.values())
         request->invalidate();
 
     m_pendingRequests.clear();

Modified: trunk/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -40,7 +40,7 @@
 
 void NotificationPermissionRequestManagerProxy::invalidateRequests()
 {
-    for (auto request : m_pendingRequests.values())
+    for (auto& request : m_pendingRequests.values())
         request->invalidate();
 
     m_pendingRequests.clear();

Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -91,7 +91,7 @@
 
 void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost)
 {
-    for (auto it : stateTree.nodeMap()) {
+    for (auto& it : stateTree.nodeMap()) {
         ScrollingStateNode* currNode = it.value;
         switch (currNode->nodeType()) {
         case ScrollingNode: {

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -814,7 +814,7 @@
         return;
     }
 
-    for (auto process : m_processes) {
+    for (auto& process : m_processes) {
         // FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process.
         IPC::ArgumentEncoder messageData;
         messageData.encode(messageName);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -1404,7 +1404,7 @@
 bool WebPageProxy::shouldStartTrackingTouchEvents(const WebTouchEvent& touchStartEvent) const
 {
 #if ENABLE(ASYNC_SCROLLING)
-    for (auto touchPoint : touchStartEvent.touchPoints()) {
+    for (auto& touchPoint : touchStartEvent.touchPoints()) {
         if (m_scrollingCoordinatorProxy->isPointInNonFastScrollableRegion(touchPoint.location()))
             return true;
     }

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2014-02-12 17:10:25 UTC (rev 163959)
@@ -56,7 +56,7 @@
 {
     LOG(RemoteLayerTree, "%s", transaction.description().data());
 
-    for (auto createdLayer : transaction.createdLayers())
+    for (const auto& createdLayer : transaction.createdLayers())
         createLayer(createdLayer);
 
     bool rootLayerChanged = false;
@@ -66,7 +66,7 @@
         rootLayerChanged = true;
     }
 
-    for (auto changedLayer : transaction.changedLayers()) {
+    for (auto& changedLayer : transaction.changedLayers()) {
         auto layerID = changedLayer.key;
         const auto& properties = changedLayer.value;
 
@@ -75,7 +75,7 @@
 
         RemoteLayerTreePropertyApplier::RelatedLayerMap relatedLayers;
         if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
-            for (auto child : properties.children)
+            for (auto& child : properties.children)
                 relatedLayers.set(child, getLayer(child));
         }
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WindowServerConnection.mm (163958 => 163959)


--- trunk/Source/WebKit2/UIProcess/mac/WindowServerConnection.mm	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/UIProcess/mac/WindowServerConnection.mm	2014-02-12 17:10:25 UTC (rev 163959)
@@ -80,7 +80,7 @@
         { WKOcclusionNotificationTypeApplicationWindowModificationsStopped, applicationWindowModificationsStopped, "Application Window Modifications Stopped" },
     };
 
-    for (auto occlusionNotificationHandler : occlusionNotificationHandlers) {
+    for (const auto& occlusionNotificationHandler : occlusionNotificationHandlers) {
         bool result = WKRegisterOcclusionNotificationHandler(occlusionNotificationHandler.notificationType, occlusionNotificationHandler.handler);
         UNUSED_PARAM(result);
         ASSERT_WITH_MESSAGE(result, "Registration of \"%s\" notification handler failed.\n", occlusionNotificationHandler.name);

Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp (163958 => 163959)


--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -421,9 +421,9 @@
     IPC::DataReference value(reinterpret_cast<const uint8_t*>(operation.value()->data()), operation.value()->size());
 
     Vector<Vector<IDBKeyData>> indexKeys;
-    for (auto keys : operation.indexKeys()) {
+    for (const auto& keys : operation.indexKeys()) {
         indexKeys.append(Vector<IDBKeyData>());
-        for (auto key : keys)
+        for (const auto& key : keys)
             indexKeys.last().append(IDBKeyData(key.get()));
     }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (163958 => 163959)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-02-12 14:58:40 UTC (rev 163958)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-02-12 17:10:25 UTC (rev 163959)
@@ -101,7 +101,7 @@
     if (m_properties.changedProperties != RemoteLayerTreeTransaction::NoChange) {
         if (m_properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
             m_properties.children.clear();
-            for (auto layer : m_children)
+            for (const auto& layer : m_children)
                 m_properties.children.append(layer->layerID());
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to