void WebGraphicsLayer::setLayerTreeTileClient(WebKit::WebLayerTreeTileClient* client)
{
    if (m_layerTreeTileClient == client)
        return;

    if (WebGraphicsLayer* replica = toWebGraphicsLayer(replicaLayer()))
        replica->setLayerTreeTileClient(client);
    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
        mask->setLayerTreeTileClient(client);
    for (size_t i = 0; i < children().size(); ++i) {
        WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
        layer->setLayerTreeTileClient(client);
    }

    // Have to force detach from remote layer here if layer tile client changes.
    if (m_layerTreeTileClient)
        m_layerTreeTileClient->didDeleteLayer(id());
    m_layerTreeTileClient = client;
}
void WebGraphicsLayer::setMaskLayer(GraphicsLayer* layer)
{
    if (layer == maskLayer())
        return;

    GraphicsLayer::setMaskLayer(layer);

    if (!layer)
        return;

    layer->setSize(size());
    WebGraphicsLayer* webGraphicsLayer = toWebGraphicsLayer(layer);
    webGraphicsLayer->setLayerTreeTileClient(layerTreeTileClient());
    webGraphicsLayer->setMaskTarget(this);
    webGraphicsLayer->setContentsScale(m_contentsScale);
    webGraphicsLayer->notifyChange();
    notifyChange();

}