Storage::Record SubresourcesEntry::encodeAsStorageRecord() const
{
    Encoder encoder;
    encoder << m_subresources;

    encoder.encodeChecksum();

    return { m_key, m_timeStamp, { encoder.buffer(), encoder.bufferSize() } , { } };
}
Esempio n. 2
0
Storage::Record Entry::encodeAsStorageRecord() const
{
    Encoder encoder;
    encoder << m_response;

    bool hasVaryingRequestHeaders = !m_varyingRequestHeaders.isEmpty();
    encoder << hasVaryingRequestHeaders;
    if (hasVaryingRequestHeaders)
        encoder << m_varyingRequestHeaders;

    bool isRedirect = !!m_redirectRequest;
    encoder << isRedirect;
    if (isRedirect)
        m_redirectRequest->encodeWithoutPlatformData(encoder);

    encoder.encodeChecksum();

    Data header(encoder.buffer(), encoder.bufferSize());
    Data body;
    if (m_buffer)
        body = { reinterpret_cast<const uint8_t*>(m_buffer->data()), m_buffer->size() };

    return { m_key, m_timeStamp, header, body };
}