| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 FormDataElement(e.m_fileSystemURL.copy(), e.m_fileStart, | 102 FormDataElement(e.m_fileSystemURL.copy(), e.m_fileStart, |
| 103 e.m_fileLength, e.m_expectedFileModificationTime)); | 103 e.m_fileLength, e.m_expectedFileModificationTime)); |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 return formData.release(); | 107 return formData.release(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void EncodedFormData::appendData(const void* data, size_t size) { | 110 void EncodedFormData::appendData(const void* data, size_t size) { |
| 111 if (m_elements.isEmpty() || m_elements.back().m_type != FormDataElement::data) | 111 if (m_elements.isEmpty() || m_elements.back().m_type != FormDataElement::data) |
| 112 m_elements.append(FormDataElement()); | 112 m_elements.push_back(FormDataElement()); |
| 113 FormDataElement& e = m_elements.back(); | 113 FormDataElement& e = m_elements.back(); |
| 114 size_t oldSize = e.m_data.size(); | 114 size_t oldSize = e.m_data.size(); |
| 115 e.m_data.grow(oldSize + size); | 115 e.m_data.grow(oldSize + size); |
| 116 memcpy(e.m_data.data() + oldSize, data, size); | 116 memcpy(e.m_data.data() + oldSize, data, size); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void EncodedFormData::appendFile(const String& filename) { | 119 void EncodedFormData::appendFile(const String& filename) { |
| 120 m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, | 120 m_elements.push_back(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, |
| 121 invalidFileTime())); | 121 invalidFileTime())); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void EncodedFormData::appendFileRange(const String& filename, | 124 void EncodedFormData::appendFileRange(const String& filename, |
| 125 long long start, | 125 long long start, |
| 126 long long length, | 126 long long length, |
| 127 double expectedModificationTime) { | 127 double expectedModificationTime) { |
| 128 m_elements.append( | 128 m_elements.push_back( |
| 129 FormDataElement(filename, start, length, expectedModificationTime)); | 129 FormDataElement(filename, start, length, expectedModificationTime)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void EncodedFormData::appendBlob(const String& uuid, | 132 void EncodedFormData::appendBlob(const String& uuid, |
| 133 PassRefPtr<BlobDataHandle> optionalHandle) { | 133 PassRefPtr<BlobDataHandle> optionalHandle) { |
| 134 m_elements.append(FormDataElement(uuid, std::move(optionalHandle))); | 134 m_elements.push_back(FormDataElement(uuid, std::move(optionalHandle))); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void EncodedFormData::appendFileSystemURL(const KURL& url) { | 137 void EncodedFormData::appendFileSystemURL(const KURL& url) { |
| 138 m_elements.append( | 138 m_elements.push_back( |
| 139 FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalidFileTime())); | 139 FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalidFileTime())); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void EncodedFormData::appendFileSystemURLRange( | 142 void EncodedFormData::appendFileSystemURLRange( |
| 143 const KURL& url, | 143 const KURL& url, |
| 144 long long start, | 144 long long start, |
| 145 long long length, | 145 long long length, |
| 146 double expectedModificationTime) { | 146 double expectedModificationTime) { |
| 147 m_elements.append( | 147 m_elements.push_back( |
| 148 FormDataElement(url, start, length, expectedModificationTime)); | 148 FormDataElement(url, start, length, expectedModificationTime)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void EncodedFormData::flatten(Vector<char>& data) const { | 151 void EncodedFormData::flatten(Vector<char>& data) const { |
| 152 // Concatenate all the byte arrays, but omit any files. | 152 // Concatenate all the byte arrays, but omit any files. |
| 153 data.clear(); | 153 data.clear(); |
| 154 size_t n = m_elements.size(); | 154 size_t n = m_elements.size(); |
| 155 for (size_t i = 0; i < n; ++i) { | 155 for (size_t i = 0; i < n; ++i) { |
| 156 const FormDataElement& e = m_elements[i]; | 156 const FormDataElement& e = m_elements[i]; |
| 157 if (e.m_type == FormDataElement::data) | 157 if (e.m_type == FormDataElement::data) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (!hasOneRef()) | 194 if (!hasOneRef()) |
| 195 return false; | 195 return false; |
| 196 for (auto& element : m_elements) { | 196 for (auto& element : m_elements) { |
| 197 if (!element.isSafeToSendToAnotherThread()) | 197 if (!element.isSafeToSendToAnotherThread()) |
| 198 return false; | 198 return false; |
| 199 } | 199 } |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |