void CachedRawResource::switchClientsToRevalidatedResource()
{
    ASSERT(m_loader);
    // If we're in the middle of a successful revalidation, responseReceived() hasn't been called, so we haven't set m_identifier.
    ASSERT(!m_identifier);
    downcast<CachedRawResource>(*resourceToRevalidate()).m_identifier = m_loader->identifier();
    CachedResource::switchClientsToRevalidatedResource();
}
示例#2
0
void CachedImage::switchClientsToRevalidatedResource()
{
    ASSERT(is<CachedImage>(resourceToRevalidate()));
    // Pending container size requests need to be transferred to the revalidated resource.
    if (!m_pendingContainerSizeRequests.isEmpty()) {
        // A copy of pending size requests is needed as they are deleted during CachedResource::switchClientsToRevalidateResouce().
        ContainerSizeRequests switchContainerSizeRequests;
        for (auto& request : m_pendingContainerSizeRequests)
            switchContainerSizeRequests.set(request.key, request.value);
        CachedResource::switchClientsToRevalidatedResource();
        CachedImage& revalidatedCachedImage = downcast<CachedImage>(*resourceToRevalidate());
        for (auto& request : switchContainerSizeRequests)
            revalidatedCachedImage.setContainerSizeForRenderer(request.key, request.value.first, request.value.second);
        return;
    }

    CachedResource::switchClientsToRevalidatedResource();
}
示例#3
0
void CachedImage::switchClientsToRevalidatedResource()
{
    ASSERT(resourceToRevalidate());
    ASSERT(resourceToRevalidate()->isImage());
    // Pending container size requests need to be transferred to the revalidated resource.
    if (!m_pendingContainerSizeRequests.isEmpty()) {
        // A copy of pending size requests is needed as they are deleted during CachedResource::switchClientsToRevalidateResouce().
        ContainerSizeRequests switchContainerSizeRequests;
        for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests.begin(); it != m_pendingContainerSizeRequests.end(); ++it)
            switchContainerSizeRequests.set(it->key, it->value);
        CachedResource::switchClientsToRevalidatedResource();
        CachedImage* revalidatedCachedImage = static_cast<CachedImage*>(resourceToRevalidate());
        for (ContainerSizeRequests::iterator it = switchContainerSizeRequests.begin(); it != switchContainerSizeRequests.end(); ++it)
            revalidatedCachedImage->setContainerSizeForRenderer(it->key, it->value.first, it->value.second);
        return;
    }

    CachedResource::switchClientsToRevalidatedResource();
}
示例#4
0
void ImageResource::switchClientsToRevalidatedResource()
{
    ASSERT(resourceToRevalidate());
    ASSERT(resourceToRevalidate()->isImage());
    // Pending container size requests need to be transferred to the revalidated resource.
    if (!m_pendingContainerSizeRequests.isEmpty()) {
        // A copy of pending size requests is needed as they are deleted during Resource::switchClientsToRevalidateResource().
        ContainerSizeRequests switchContainerSizeRequests;
        for (const auto& containerSizeRequest : m_pendingContainerSizeRequests)
            switchContainerSizeRequests.set(containerSizeRequest.key, containerSizeRequest.value);
        Resource::switchClientsToRevalidatedResource();
        ImageResource* revalidatedImageResource = toImageResource(resourceToRevalidate());
        for (const auto& containerSizeRequest : switchContainerSizeRequests)
            revalidatedImageResource->setContainerSizeForLayoutObject(containerSizeRequest.key, containerSizeRequest.value.first, containerSizeRequest.value.second);
        return;
    }

    Resource::switchClientsToRevalidatedResource();
}