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

Side by Side Diff: Source/platform/network/FormData.h

Issue 1276203004: Implement FormData::isSafeToSendToAnotherThread() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use range-based for. Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/platform/network/FormData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 22 matching lines...) Expand all
33 33
34 class PLATFORM_EXPORT FormDataElement { 34 class PLATFORM_EXPORT FormDataElement {
35 public: 35 public:
36 FormDataElement() : m_type(data) { } 36 FormDataElement() : m_type(data) { }
37 explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(a rray) { } 37 explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(a rray) { }
38 38
39 FormDataElement(const String& filename, long long fileStart, long long fileL ength, double expectedFileModificationTime) : m_type(encodedFile), m_filename(fi lename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModific ationTime(expectedFileModificationTime) { } 39 FormDataElement(const String& filename, long long fileStart, long long fileL ength, double expectedFileModificationTime) : m_type(encodedFile), m_filename(fi lename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModific ationTime(expectedFileModificationTime) { }
40 explicit FormDataElement(const String& blobUUID, PassRefPtr<BlobDataHandle> optionalHandle) : m_type(encodedBlob), m_blobUUID(blobUUID), m_optionalBlobDataH andle(optionalHandle) { } 40 explicit FormDataElement(const String& blobUUID, PassRefPtr<BlobDataHandle> optionalHandle) : m_type(encodedBlob), m_blobUUID(blobUUID), m_optionalBlobDataH andle(optionalHandle) { }
41 FormDataElement(const KURL& fileSystemURL, long long start, long long length , double expectedFileModificationTime) : m_type(encodedFileSystemURL), m_fileSys temURL(fileSystemURL), m_fileStart(start), m_fileLength(length), m_expectedFileM odificationTime(expectedFileModificationTime) { } 41 FormDataElement(const KURL& fileSystemURL, long long start, long long length , double expectedFileModificationTime) : m_type(encodedFileSystemURL), m_fileSys temURL(fileSystemURL), m_fileStart(start), m_fileLength(length), m_expectedFileM odificationTime(expectedFileModificationTime) { }
42 42
43 bool isSafeToSendToAnotherThread() const;
44
43 enum Type { 45 enum Type {
44 data, 46 data,
45 encodedFile, 47 encodedFile,
46 encodedBlob, 48 encodedBlob,
47 encodedFileSystemURL 49 encodedFileSystemURL
48 } m_type; 50 } m_type;
49 Vector<char> m_data; 51 Vector<char> m_data;
50 String m_filename; 52 String m_filename;
51 String m_blobUUID; 53 String m_blobUUID;
52 RefPtr<BlobDataHandle> m_optionalBlobDataHandle; 54 RefPtr<BlobDataHandle> m_optionalBlobDataHandle;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (equalIgnoringCase(type, "text/plain")) 127 if (equalIgnoringCase(type, "text/plain"))
126 return TextPlain; 128 return TextPlain;
127 if (equalIgnoringCase(type, "multipart/form-data")) 129 if (equalIgnoringCase(type, "multipart/form-data"))
128 return MultipartFormData; 130 return MultipartFormData;
129 return FormURLEncoded; 131 return FormURLEncoded;
130 } 132 }
131 133
132 // Size of the elements making up the FormData. 134 // Size of the elements making up the FormData.
133 unsigned long long sizeInBytes() const; 135 unsigned long long sizeInBytes() const;
134 136
137 bool isSafeToSendToAnotherThread() const;
138
135 private: 139 private:
136 FormData(); 140 FormData();
137 FormData(const FormData&); 141 FormData(const FormData&);
138 142
139 Vector<FormDataElement> m_elements; 143 Vector<FormDataElement> m_elements;
140 144
141 int64_t m_identifier; 145 int64_t m_identifier;
142 Vector<char> m_boundary; 146 Vector<char> m_boundary;
143 bool m_containsPasswordData; 147 bool m_containsPasswordData;
144 }; 148 };
145 149
146 inline bool operator==(const FormData& a, const FormData& b) 150 inline bool operator==(const FormData& a, const FormData& b)
147 { 151 {
148 return a.elements() == b.elements(); 152 return a.elements() == b.elements();
149 } 153 }
150 154
151 inline bool operator!=(const FormData& a, const FormData& b) 155 inline bool operator!=(const FormData& a, const FormData& b)
152 { 156 {
153 return !(a == b); 157 return !(a == b);
154 } 158 }
155 159
156 } // namespace blink 160 } // namespace blink
157 161
158 #endif 162 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/network/FormData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698