void BlobResourceHandle::getSizeForNext()
{
    // Do we finish validating and counting size for all items?
    if (m_sizeItemCount >= m_blobData->items().size()) {
        seek();

        // Start reading if in asynchronous mode.
        if (m_async) {
            notifyResponse();
            m_buffer.resize(bufferSize);
            readAsync();
        }
        return;
    }

    const BlobDataItem& item = m_blobData->items().at(m_sizeItemCount);
    switch (item.type) {
    case BlobDataItem::Data:
        didGetSize(item.length);
        break;
    case BlobDataItem::File:
        if (m_async)
            m_asyncStream->getSize(item.path, item.expectedModificationTime);
        else
            didGetSize(m_stream->getSize(item.path, item.expectedModificationTime));
        break;
    default:
        ASSERT_NOT_REACHED();
    }
}
Esempio n. 2
0
void BlobResourceHandle::getSizeForNext()
{
    ASSERT(isMainThread());

    // Do we finish validating and counting size for all items?
    if (m_sizeItemCount >= m_blobData->items().size()) {
        seek();

        // Start reading if in asynchronous mode.
        if (m_async) {
            Ref<BlobResourceHandle> protect(*this);
            notifyResponse();
            m_buffer.resize(bufferSize);
            readAsync();
        }
        return;
    }

    const BlobDataItem& item = m_blobData->items().at(m_sizeItemCount);
    switch (item.type) {
    case BlobDataItem::Data:
        didGetSize(item.length());
        break;
    case BlobDataItem::File:
        // Files know their sizes, but asking the stream to verify that the file wasn't modified.
        if (m_async)
            m_asyncStream->getSize(item.file->path(), item.file->expectedModificationTime());
        else
            didGetSize(m_stream->getSize(item.file->path(), item.file->expectedModificationTime()));
        break;
    default:
        ASSERT_NOT_REACHED();
    }
}
Esempio n. 3
0
void NetworkDataTaskBlob::getSizeForNext()
{
    ASSERT(isMainThread());

    // Do we finish validating and counting size for all items?
    if (m_sizeItemCount >= m_blobData->items().size()) {
        seek();
        didReceiveResponse();
        return;
    }

    const BlobDataItem& item = m_blobData->items().at(m_sizeItemCount);
    switch (item.type()) {
    case BlobDataItem::Type::Data:
        didGetSize(item.length());
        break;
    case BlobDataItem::Type::File:
        // Files know their sizes, but asking the stream to verify that the file wasn't modified.
        m_stream->getSize(item.file()->path(), item.file()->expectedModificationTime());
        break;
    default:
        ASSERT_NOT_REACHED();
    }
}