Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Unified Diff: WebCore/platform/network/FormData.h

Issue 1769002: BlobBuilder/FormData refactor attempt (Closed)
Patch Set: back to simple FormData Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « WebCore/platform/BlobItem.cpp ('k') | WebCore/platform/network/FormData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/platform/network/FormData.h
diff --git a/WebCore/platform/network/FormData.h b/WebCore/platform/network/FormData.h
index a4390234796a0e2f14f5d349f5dd0effc0a4b7cd..773c901d7528b07cd4b3eda586eeb4fca5987be0 100644
--- a/WebCore/platform/network/FormData.h
+++ b/WebCore/platform/network/FormData.h
@@ -20,21 +20,25 @@
#ifndef FormData_h
#define FormData_h
+#include "BlobItem.h"
#include "PlatformString.h"
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
namespace WebCore {
-class DOMFormData;
class Document;
+class TextEncoding;
+// A wrapper class of BlobItem for FormData.
class FormDataElement {
public:
- FormDataElement() : m_type(data) { }
+ FormDataElement() : m_data(0) { }
FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { }
+
#if ENABLE(BLOB_SLICE)
- FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenerateFile(shouldGenerateFile) { }
+ FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime), m_shouldGenerateFile(shouldGenerateFile) {
+ }
#else
FormDataElement(const String& filename, bool shouldGenerateFile) : m_type(encodedFile), m_filename(filename), m_shouldGenerateFile(shouldGenerateFile) { }
#endif
@@ -46,6 +50,9 @@ public:
long long m_fileStart;
long long m_fileLength;
double m_expectedFileModificationTime;
+
+ static const long long toEndOfFile;
+ static const double doNotCheckFileChange;
#endif
String m_generatedFilename;
bool m_shouldGenerateFile;
@@ -55,7 +62,7 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b)
{
if (&a == &b)
return true;
-
+
if (a.m_type != b.m_type)
return false;
if (a.m_data != b.m_data)
@@ -69,25 +76,26 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b)
return true;
}
-
+
inline bool operator!=(const FormDataElement& a, const FormDataElement& b)
{
return !(a == b);
}
-
+
class FormData : public RefCounted<FormData> {
public:
static PassRefPtr<FormData> create();
static PassRefPtr<FormData> create(const void*, size_t);
static PassRefPtr<FormData> create(const WTF::CString&);
static PassRefPtr<FormData> create(const Vector<char>&);
- static PassRefPtr<FormData> create(const DOMFormData&);
- static PassRefPtr<FormData> createMultiPart(const DOMFormData&, Document*);
+ static PassRefPtr<FormData> create(const BlobItemList&, const TextEncoding&);
+ static PassRefPtr<FormData> createMultiPart(const BlobItemList&, const TextEncoding&, Document*);
PassRefPtr<FormData> copy() const;
PassRefPtr<FormData> deepCopy() const;
~FormData();
-
+
void appendData(const void* data, size_t);
+ void appendItems(const BlobItemList&);
void appendFile(const String& filename, bool shouldGenerateFile = false);
#if ENABLE(BLOB_SLICE)
void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile = false);
@@ -115,9 +123,11 @@ private:
FormData();
FormData(const FormData&);
- void appendDOMFormData(const DOMFormData& domFormData, bool isMultiPartForm, Document* document);
+ void appendItem(const BlobItem*, bool shouldGenerateFile);
+ void appendKeyValuePairItems(const BlobItemList&, const TextEncoding&, bool isMultiPartForm, Document*);
Vector<FormDataElement> m_elements;
+
int64_t m_identifier;
bool m_hasGeneratedFiles;
bool m_alwaysStream;
@@ -131,7 +141,7 @@ inline bool operator==(const FormData& a, const FormData& b)
inline bool operator!=(const FormData& a, const FormData& b)
{
- return a.elements() != b.elements();
+ return !(a == b);
}
} // namespace WebCore
« no previous file with comments | « WebCore/platform/BlobItem.cpp ('k') | WebCore/platform/network/FormData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698