Changeset 163959 in webkit


Ignore:
Timestamp:
Feb 12, 2014 9:10:25 AM (10 years ago)
Author:
Brent Fulgham
Message:

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

Reviewed by Anders Carlsson.

../JavaScriptCore:

  • 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.

Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r163948 r163959  
     12014-02-11  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Remove some unintended copies in ranged for loops
     4        https://bugs.webkit.org/show_bug.cgi?id=128644
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * inspector/InjectedScriptHost.cpp:
     9        (Inspector::InjectedScriptHost::clearAllWrappers): Avoid creating/destroying
     10        a std::pair<> and pointer each loop iteration.
     11        * parser/Parser.cpp:
     12        (JSC::Parser<LexerType>::Parser): Avoid copying object containing a string
     13        each loop iteration.
     14
    1152014-02-11  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp

    r161563 r163959  
    7373void InjectedScriptHost::clearAllWrappers()
    7474{
    75     for (auto wrapper : m_wrappers)
     75    for (auto& wrapper : m_wrappers)
    7676        clearWrapperFromValue(wrapper.value.get());
    7777
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r163844 r163959  
    238238                parameter->collectBoundIdentifiers(boundParameterNames);
    239239            }
    240             for (auto boundParameterName : boundParameterNames)
     240            for (auto& boundParameterName : boundParameterNames)
    241241                scope->declareVariable(&boundParameterName);
    242242        }
  • trunk/Source/WebCore/ChangeLog

    r163958 r163959  
     12014-02-11  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Remove some unintended copies in ranged for loops
     4        https://bugs.webkit.org/show_bug.cgi?id=128644
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * css/StyleResolver.cpp:
     9        (WebCore::StyleResolver::loadPendingSVGDocuments): Avoid creating/destroying
     10        RefPtrs in loop.
     11
    1122014-02-12  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    213
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r163888 r163959  
    33253325
    33263326    CachedResourceLoader* cachedResourceLoader = state.document().cachedResourceLoader();
    3327     for (auto filterOperation : state.filtersWithPendingSVGDocuments())
     3327    for (auto& filterOperation : state.filtersWithPendingSVGDocuments())
    33283328        filterOperation->getOrCreateCachedSVGDocumentReference()->load(cachedResourceLoader);
    33293329
  • trunk/Source/WebKit2/ChangeLog

    r163958 r163959  
     12014-02-11  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Remove some unintended copies in ranged for loops
     4        https://bugs.webkit.org/show_bug.cgi?id=128644
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * Shared/WebCrossThreadCopier.cpp:
     9        (WebCore::Vector<Vector<IDBKeyData>>>::copy): Each iteration copies a vector of
     10        vectors,
     11        * Shared/mac/RemoteLayerBackingStore.mm:
     12        (RemoteLayerBackingStore::enumerateRectsBeingDrawn): Avoid copying a FloatRect
     13        on each iteration.
     14        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
     15        (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer): Avoid copying
     16        a LayerProperty object each iteration.
     17        * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
     18        (WebKit::GeolocationPermissionRequestManagerProxy::invalidateRequests): Avoid
     19        copying a pair<int64_t, pointer> each iteration.
     20        * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
     21        (WebKit::NotificationPermissionRequestManagerProxy::invalidateRequests): Ditto
     22        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
     23        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto
     24        * UIProcess/WebContext.cpp:
     25        (WebKit::WebContext::postMessageToInjectedBundle): Avoid creating/destroying a
     26        RefPtr each loop iteration.
     27        * UIProcess/WebPageProxy.cpp:
     28        (WebKit::WebPageProxy::shouldStartTrackingTouchEvents): Avoid copying a WebPlatformTouchPoint
     29        object each cycle.
     30        * UIProcess/mac/RemoteLayerTreeHost.mm:
     31        (WebKit::RemoteLayerTreeHost::updateLayerTree): Avoid copying a pair each iteration.
     32        * UIProcess/mac/WindowServerConnection.mm:
     33        (WebKit::WindowServerConnection::WindowServerConnection): Avoid copying the struct
     34        of occlusionNotificationHandlers each iteration.
     35        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
     36        (WebKit::WebIDBServerConnection::put): Avoid copying a vector-of-vectors each
     37        iteration.
     38        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     39        (PlatformCALayerRemote::recursiveBuildTransaction): Avoid creating/destroying a
     40        RefPtr each loop iteration.
     41
    1422014-02-12  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    243
  • trunk/Source/WebKit2/Shared/WebCrossThreadCopier.cpp

    r162911 r163959  
    7171    Vector<Vector<IDBKeyData>> result;
    7272
    73     for (auto keys : vector) {
     73    for (const auto& keys : vector) {
    7474        result.append(Vector<IDBKeyData>());
    75         for (auto key : keys)
     75        for (const auto& key : keys)
    7676            result.last().append(WebCore::CrossThreadCopier<IDBKeyData>::copy(key));
    7777    }
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm

    r163079 r163959  
    343343    inverseTransform = CGAffineTransformTranslate(inverseTransform, 0, -m_size.height());
    344344
    345     for (auto rect : m_paintingRects) {
     345    for (const auto& rect : m_paintingRects) {
    346346        CGRect rectToDraw = CGRectApplyAffineTransform(rect, inverseTransform);
    347347        block(rectToDraw);
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm

    r162453 r163959  
    103103    if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
    104104        RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
    105         for (auto child : properties.children)
     105        for (auto& child : properties.children)
    106106            [children addObject:relatedLayers.get(child)];
    107107        layer.sublayers = children.get();
  • trunk/Source/WebKit2/UIProcess/GeolocationPermissionRequestManagerProxy.cpp

    r159903 r163959  
    4040void GeolocationPermissionRequestManagerProxy::invalidateRequests()
    4141{
    42     for (auto request : m_pendingRequests.values())
     42    for (auto& request : m_pendingRequests.values())
    4343        request->invalidate();
    4444
  • trunk/Source/WebKit2/UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp

    r159903 r163959  
    4141void NotificationPermissionRequestManagerProxy::invalidateRequests()
    4242{
    43     for (auto request : m_pendingRequests.values())
     43    for (auto& request : m_pendingRequests.values())
    4444        request->invalidate();
    4545
  • trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp

    r163837 r163959  
    9292void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost)
    9393{
    94     for (auto it : stateTree.nodeMap()) {
     94    for (auto& it : stateTree.nodeMap()) {
    9595        ScrollingStateNode* currNode = it.value;
    9696        switch (currNode->nodeType()) {
  • trunk/Source/WebKit2/UIProcess/WebContext.cpp

    r163844 r163959  
    815815    }
    816816
    817     for (auto process : m_processes) {
     817    for (auto& process : m_processes) {
    818818        // FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process.
    819819        IPC::ArgumentEncoder messageData;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r163908 r163959  
    14051405{
    14061406#if ENABLE(ASYNC_SCROLLING)
    1407     for (auto touchPoint : touchStartEvent.touchPoints()) {
     1407    for (auto& touchPoint : touchStartEvent.touchPoints()) {
    14081408        if (m_scrollingCoordinatorProxy->isPointInNonFastScrollableRegion(touchPoint.location()))
    14091409            return true;
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm

    r163837 r163959  
    5757    LOG(RemoteLayerTree, "%s", transaction.description().data());
    5858
    59     for (auto createdLayer : transaction.createdLayers())
     59    for (const auto& createdLayer : transaction.createdLayers())
    6060        createLayer(createdLayer);
    6161
     
    6767    }
    6868
    69     for (auto changedLayer : transaction.changedLayers()) {
     69    for (auto& changedLayer : transaction.changedLayers()) {
    7070        auto layerID = changedLayer.key;
    7171        const auto& properties = changedLayer.value;
     
    7676        RemoteLayerTreePropertyApplier::RelatedLayerMap relatedLayers;
    7777        if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
    78             for (auto child : properties.children)
     78            for (auto& child : properties.children)
    7979                relatedLayers.set(child, getLayer(child));
    8080        }
  • trunk/Source/WebKit2/UIProcess/mac/WindowServerConnection.mm

    r161301 r163959  
    8181    };
    8282
    83     for (auto occlusionNotificationHandler : occlusionNotificationHandlers) {
     83    for (const auto& occlusionNotificationHandler : occlusionNotificationHandlers) {
    8484        bool result = WKRegisterOcclusionNotificationHandler(occlusionNotificationHandler.notificationType, occlusionNotificationHandler.handler);
    8585        UNUSED_PARAM(result);
  • trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp

    r163817 r163959  
    422422
    423423    Vector<Vector<IDBKeyData>> indexKeys;
    424     for (auto keys : operation.indexKeys()) {
     424    for (const auto& keys : operation.indexKeys()) {
    425425        indexKeys.append(Vector<IDBKeyData>());
    426         for (auto key : keys)
     426        for (const auto& key : keys)
    427427            indexKeys.last().append(IDBKeyData(key.get()));
    428428    }
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r163079 r163959  
    102102        if (m_properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
    103103            m_properties.children.clear();
    104             for (auto layer : m_children)
     104            for (const auto& layer : m_children)
    105105                m_properties.children.append(layer->layerID());
    106106        }
Note: See TracChangeset for help on using the changeset viewer.