Esempio n. 1
0
static void encodeElement(Encoder& encoder, const FormDataElement& element)
{
    encoder.encodeUInt32(element.m_type);

    switch (element.m_type) {
    case FormDataElement::data:
        encoder.encodeBytes(reinterpret_cast<const uint8_t*>(element.m_data.data()), element.m_data.size());
        return;

    case FormDataElement::encodedFile:
        encoder.encodeString(element.m_filename);
        encoder.encodeString(element.m_generatedFilename);
        encoder.encodeBool(element.m_shouldGenerateFile);
#if ENABLE(BLOB)
        encoder.encodeInt64(element.m_fileStart);
        encoder.encodeInt64(element.m_fileLength);
        encoder.encodeDouble(element.m_expectedFileModificationTime);
#else
        encoder.encodeInt64(0);
        encoder.encodeInt64(0);
        encoder.encodeDouble(invalidFileTime());
#endif
        return;

#if ENABLE(BLOB)
    case FormDataElement::encodedBlob:
        encoder.encodeString(element.m_url.string());
        return;
#endif
    }

    ASSERT_NOT_REACHED();
}
Esempio n. 2
0
static void encodeElement(Encoder& encoder, const FormDataElement& element)
{
    encoder.encodeUInt32(static_cast<uint32_t>(element.m_type));

    switch (element.m_type) {
    case FormDataElement::Type::Data:
        encoder.encodeBytes(reinterpret_cast<const uint8_t*>(element.m_data.data()), element.m_data.size());
        return;

    case FormDataElement::Type::EncodedFile:
        encoder.encodeString(element.m_filename);
        encoder.encodeString(element.m_generatedFilename);
        encoder.encodeBool(element.m_shouldGenerateFile);
        encoder.encodeInt64(element.m_fileStart);
        encoder.encodeInt64(element.m_fileLength);
        encoder.encodeDouble(element.m_expectedFileModificationTime);
        return;

    case FormDataElement::Type::EncodedBlob:
        encoder.encodeString(element.m_url.string());
        return;
    }

    ASSERT_NOT_REACHED();
}
Esempio n. 3
0
void HistoryItem::encodeBackForwardTreeNode(Encoder& encoder) const
{
    size_t size = m_children.size();
    encoder.encodeUInt64(size);
    for (size_t i = 0; i < size; ++i) {
        const HistoryItem& child = *m_children[i];

        encoder.encodeString(child.m_originalURLString);

        encoder.encodeString(child.m_urlString);

        child.encodeBackForwardTreeNode(encoder);
    }

    encoder.encodeInt64(m_documentSequenceNumber);

    size = m_documentState.size();
    encoder.encodeUInt64(size);
    for (size_t i = 0; i < size; ++i)
        encoder.encodeString(m_documentState[i]);

    encoder.encodeString(m_formContentType);

    encoder.encodeBool(m_formData);
    if (m_formData)
        m_formData->encodeForBackForward(encoder);

    encoder.encodeInt64(m_itemSequenceNumber);

    encoder.encodeString(m_referrer);

    encoder.encodeInt32(m_scrollPoint.x());
    encoder.encodeInt32(m_scrollPoint.y());
    
    encoder.encodeFloat(m_pageScaleFactor);

    encoder.encodeBool(m_stateObject);
    if (m_stateObject) {
#if !USE(V8)
        encoder.encodeBytes(m_stateObject->data().data(), m_stateObject->data().size());
#else
        encoder.encodeString(m_stateObject->toWireString());
#endif
    }

    encoder.encodeString(m_target);
}