OLD | NEW |
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 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 String FormData::flattenToString() const | 158 String FormData::flattenToString() const |
159 { | 159 { |
160 Vector<char> bytes; | 160 Vector<char> bytes; |
161 flatten(bytes); | 161 flatten(bytes); |
162 return Latin1Encoding().decode(reinterpret_cast<const char*>(bytes.data()),
bytes.size()); | 162 return Latin1Encoding().decode(reinterpret_cast<const char*>(bytes.data()),
bytes.size()); |
163 } | 163 } |
164 | 164 |
| 165 unsigned long long FormData::sizeInBytes() const |
| 166 { |
| 167 unsigned size = 0; |
| 168 size_t n = m_elements.size(); |
| 169 for (size_t i = 0; i < n; ++i) { |
| 170 const FormDataElement& e = m_elements[i]; |
| 171 switch (e.m_type) { |
| 172 case FormDataElement::data: |
| 173 size += e.m_data.size(); |
| 174 break; |
| 175 case FormDataElement::encodedFile: |
| 176 size += e.m_fileLength - e.m_fileStart; |
| 177 break; |
| 178 case FormDataElement::encodedBlob: |
| 179 if (e.m_optionalBlobDataHandle) |
| 180 size += e.m_optionalBlobDataHandle->size(); |
| 181 break; |
| 182 case FormDataElement::encodedFileSystemURL: |
| 183 size += e.m_fileLength - e.m_fileStart; |
| 184 break; |
| 185 } |
| 186 } |
| 187 return size; |
| 188 } |
| 189 |
165 } // namespace WebCore | 190 } // namespace WebCore |
OLD | NEW |