PassRefPtr<FormData> FormData::deepCopy() const { RefPtr<FormData> formData(create()); formData->m_alwaysStream = m_alwaysStream; size_t n = m_elements.size(); formData->m_elements.reserveInitialCapacity(n); for (size_t i = 0; i < n; ++i) { const FormDataElement& e = m_elements[i]; switch (e.m_type) { case FormDataElement::data: formData->m_elements.uncheckedAppend(FormDataElement(e.m_data)); break; case FormDataElement::encodedFile: #if ENABLE(BLOB) formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenerateFile)); #else formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e.m_shouldGenerateFile)); #endif break; #if ENABLE(BLOB) case FormDataElement::encodedBlob: formData->m_elements.uncheckedAppend(FormDataElement(e.m_url)); break; #endif } } return formData.release(); }
void FormData::appendFile(const String& filename, bool shouldGenerateFile) { #if ENABLE(BLOB) m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, invalidFileTime(), shouldGenerateFile)); #else m_elements.append(FormDataElement(filename, shouldGenerateFile)); #endif }
void FormData::appendFile(const String& filename, bool shouldGenerateFile) { #if ENABLE(BLOB_SLICE) m_elements.append(FormDataElement(filename, 0, FormDataElement::toEndOfFile, FormDataElement::doNotCheckFileChange, shouldGenerateFile)); #else m_elements.append(FormDataElement(filename, shouldGenerateFile)); #endif }
char* FormData::expandDataStore(size_t size) { if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::Type::Data) m_elements.append(FormDataElement()); FormDataElement& e = m_elements.last(); size_t oldSize = e.m_data.size(); e.m_data.grow(oldSize + size); return e.m_data.data() + oldSize; }
void FormData::appendData(const void* data, size_t size) { if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::data) m_elements.append(FormDataElement()); FormDataElement& e = m_elements.last(); size_t oldSize = e.m_data.size(); e.m_data.grow(oldSize + size); memcpy(e.m_data.data() + oldSize, data, size); }
PassRefPtr<FormData> FormData::deepCopy() const { RefPtr<FormData> formData(create()); formData->m_alwaysStream = m_alwaysStream; size_t n = m_elements.size(); formData->m_elements.reserveCapacity(n); for (size_t i = 0; i < n; ++i) { const FormDataElement& e = m_elements[i]; switch (e.m_type) { case FormDataElement::data: formData->m_elements.append(FormDataElement(e.m_data)); break; case FormDataElement::encodedFile: formData->m_elements.append(FormDataElement(e.m_filename, e.m_shouldGenerateFile)); break; } } return formData.release(); }
PassRefPtr<FormData> FormData::deepCopy() const { RefPtr<FormData> formData(create()); formData->m_alwaysStream = m_alwaysStream; formData->m_elements.reserveInitialCapacity(m_elements.size()); for (const FormDataElement& element : m_elements) { switch (element.m_type) { case FormDataElement::Type::Data: formData->m_elements.uncheckedAppend(FormDataElement(element.m_data)); break; case FormDataElement::Type::EncodedFile: formData->m_elements.uncheckedAppend(FormDataElement(element.m_filename, element.m_fileStart, element.m_fileLength, element.m_expectedFileModificationTime, element.m_shouldGenerateFile)); break; case FormDataElement::Type::EncodedBlob: formData->m_elements.uncheckedAppend(FormDataElement(element.m_url)); break; } } return formData.release(); }
PassRefPtr<FormData> FormData::deepCopy() const { RefPtr<FormData> formData(create()); formData->m_alwaysStream = m_alwaysStream; size_t n = m_elements.size(); formData->m_elements.reserveInitialCapacity(n); for (size_t i = 0; i < n; ++i) { const FormDataElement& e = m_elements[i]; switch (e.m_type) { case FormDataElement::data: formData->m_elements.uncheckedAppend(FormDataElement(e.m_data)); break; } } return formData.release(); }
void FormData::appendBlob(const URL& blobURL) { m_elements.append(FormDataElement(blobURL)); }
void FormData::appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile) { m_elements.append(FormDataElement(filename, start, length, expectedModificationTime, shouldGenerateFile)); }
void FormData::appendFile(const String& filename, bool shouldGenerateFile) { m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, invalidFileTime(), shouldGenerateFile)); }
void FormData::appendFile(const String& filename, bool shouldGenerateFile) { m_elements.append(FormDataElement(filename, shouldGenerateFile)); }
void FormData::appendURLRange(const KURL& url, long long start, long long length, double expectedModificationTime) { m_elements.append(FormDataElement(url, start, length, expectedModificationTime)); }
void FormData::appendURL(const KURL& url) { m_elements.append(FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalidFileTime())); }
void FormData::appendFile(const String& filename) { m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, invalidFileTime())); }