⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 238549 in webkit


Ignore:
Timestamp:
Nov 27, 2018, 4:39:27 AM (8 years ago)
Author:
Antti Koivisto
Message:

Stop collecting related layers in RemoteLayerTreeHost::updateLayerTree
https://bugs.webkit.org/show_bug.cgi?id=192003

Reviewed by Tim Horton.

We can pass the node hash directly to RemoteLayerTreePropertyApplier. The collection step doesn't seem
to add anything except an extra hash lookup.

  • Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
  • UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:

(WebKit::RemoteLayerTreeHost::updateLayerTree):

Pass m_nodes directly.
Some random cleanups.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238547 r238549  
     12018-11-27  Antti Koivisto  <antti@apple.com>
     2
     3        Stop collecting related layers in RemoteLayerTreeHost::updateLayerTree
     4        https://bugs.webkit.org/show_bug.cgi?id=192003
     5
     6        Reviewed by Tim Horton.
     7
     8        We can pass the node hash directly to RemoteLayerTreePropertyApplier. The collection step doesn't seem
     9        to add anything except an extra hash lookup.
     10
     11        * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
     12        * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
     13        (WebKit::RemoteLayerTreeHost::updateLayerTree):
     14
     15        Pass m_nodes directly.
     16        Some random cleanups.
     17
    1182018-11-27  Antti Koivisto  <antti@apple.com>
    219
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h

    r238547 r238549  
    3636class RemoteLayerTreePropertyApplier {
    3737public:
    38     using RelatedLayerMap = HashMap<WebCore::GraphicsLayer::PlatformLayerID, RemoteLayerTreeNode*>;
     38    using RelatedLayerMap = HashMap<WebCore::GraphicsLayer::PlatformLayerID, std::unique_ptr<RemoteLayerTreeNode>>;
    3939    static void applyProperties(RemoteLayerTreeNode&, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&, RemoteLayerBackingStore::LayerContentsType);
    4040    static void applyPropertiesToLayer(CALayer *, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, RemoteLayerBackingStore::LayerContentsType);
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm

    r238547 r238549  
    8383    }
    8484
    85     typedef std::pair<GraphicsLayer::PlatformLayerID, GraphicsLayer::PlatformLayerID> LayerIDPair;
    86     Vector<LayerIDPair> clonesToUpdate;
     85    struct LayerAndClone {
     86        GraphicsLayer::PlatformLayerID layerID;
     87        GraphicsLayer::PlatformLayerID cloneLayerID;
     88    };
     89    Vector<LayerAndClone> clonesToUpdate;
    8790
    8891#if PLATFORM(MAC) || PLATFORM(IOSMAC)
     
    100103        ASSERT(node);
    101104
    102         RemoteLayerTreePropertyApplier::RelatedLayerMap relatedLayers;
    103         if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
    104             for (auto& child : properties.children)
    105                 relatedLayers.set(child, nodeForID(child));
    106         }
    107 
    108         if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged && properties.maskLayerID)
    109             relatedLayers.set(properties.maskLayerID, nodeForID(properties.maskLayerID));
    110 
    111         if (properties.changedProperties & RemoteLayerTreeTransaction::ClonedContentsChanged && properties.clonedLayerID)
    112             clonesToUpdate.append(LayerIDPair(layerID, properties.clonedLayerID));
     105        if (properties.changedProperties.contains(RemoteLayerTreeTransaction::ClonedContentsChanged) && properties.clonedLayerID)
     106            clonesToUpdate.append({ layerID, properties.clonedLayerID });
     107
     108        RemoteLayerTreePropertyApplier::applyProperties(*node, this, properties, m_nodes, layerContentsType);
    113109
    114110        if (m_isDebugLayerTreeHost) {
    115             RemoteLayerTreePropertyApplier::applyProperties(*node, this, properties, relatedLayers, layerContentsType);
    116 
    117             if (properties.changedProperties & RemoteLayerTreeTransaction::BorderWidthChanged)
     111            if (properties.changedProperties.contains(RemoteLayerTreeTransaction::BorderWidthChanged))
    118112                node->layer().borderWidth = properties.borderWidth / indicatorScaleFactor;
    119113            node->layer().masksToBounds = false;
    120         } else
    121             RemoteLayerTreePropertyApplier::applyProperties(*node, this, properties, relatedLayers, layerContentsType);
     114        }
    122115    }
    123116   
    124     for (const auto& layerPair : clonesToUpdate) {
    125         auto* layer = layerForID(layerPair.first);
    126         auto* clonedLayer = layerForID(layerPair.second);
    127         layer.contents = clonedLayer.contents;
    128     }
     117    for (const auto& layerAndClone : clonesToUpdate)
     118        layerForID(layerAndClone.layerID).contents = layerForID(layerAndClone.cloneLayerID).contents;
    129119
    130120    for (auto& destroyedLayer : transaction.destroyedLayers())
Note: See TracChangeset for help on using the changeset viewer.