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

Side by Side Diff: WebCore/platform/network/FormData.cpp

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 8 years, 1 month 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
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 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 22
23 #include "FormData.h" 23 #include "FormData.h"
24 24
25 #include "BlobData.h"
26 #include "BlobURL.h"
27 #include "Chrome.h" 25 #include "Chrome.h"
28 #include "ChromeClient.h" 26 #include "ChromeClient.h"
29 #include "Document.h" 27 #include "Document.h"
30 #include "File.h" 28 #include "File.h"
31 #include "FileSystem.h" 29 #include "FileSystem.h"
32 #include "FormDataBuilder.h" 30 #include "FormDataBuilder.h"
33 #include "FormDataList.h" 31 #include "FormDataList.h"
34 #include "MIMETypeRegistry.h" 32 #include "MIMETypeRegistry.h"
35 #include "Page.h" 33 #include "Page.h"
36 #include "PlatformMemoryInstrumentation.h" 34 #include "PlatformMemoryInstrumentation.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 break; 136 break;
139 case FormDataElement::encodedFile: 137 case FormDataElement::encodedFile:
140 #if ENABLE(BLOB) 138 #if ENABLE(BLOB)
141 formData->m_elements.append(FormDataElement(e.m_filename, e.m_fileSt art, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenerateFile)); 139 formData->m_elements.append(FormDataElement(e.m_filename, e.m_fileSt art, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenerateFile));
142 #else 140 #else
143 formData->m_elements.append(FormDataElement(e.m_filename, e.m_should GenerateFile)); 141 formData->m_elements.append(FormDataElement(e.m_filename, e.m_should GenerateFile));
144 #endif 142 #endif
145 break; 143 break;
146 #if ENABLE(BLOB) 144 #if ENABLE(BLOB)
147 case FormDataElement::encodedBlob: 145 case FormDataElement::encodedBlob:
148 formData->m_elements.append(FormDataElement(e.m_url)); 146 formData->m_elements.append(FormDataElement(e.m_blobDataHandle));
149 break; 147 break;
150 #endif 148 #endif
151 #if ENABLE(FILE_SYSTEM) 149 #if ENABLE(FILE_SYSTEM)
152 case FormDataElement::encodedURL: 150 case FormDataElement::encodedURL:
153 formData->m_elements.append(FormDataElement(e.m_url, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime)); 151 formData->m_elements.append(FormDataElement(e.m_url, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime));
154 break; 152 break;
155 #endif 153 #endif
156 } 154 }
157 } 155 }
158 return formData.release(); 156 return formData.release();
(...skipping 17 matching lines...) Expand all
176 m_elements.append(FormDataElement(filename, shouldGenerateFile)); 174 m_elements.append(FormDataElement(filename, shouldGenerateFile));
177 #endif 175 #endif
178 } 176 }
179 177
180 #if ENABLE(BLOB) 178 #if ENABLE(BLOB)
181 void FormData::appendFileRange(const String& filename, long long start, long lon g length, double expectedModificationTime, bool shouldGenerateFile) 179 void FormData::appendFileRange(const String& filename, long long start, long lon g length, double expectedModificationTime, bool shouldGenerateFile)
182 { 180 {
183 m_elements.append(FormDataElement(filename, start, length, expectedModificat ionTime, shouldGenerateFile)); 181 m_elements.append(FormDataElement(filename, start, length, expectedModificat ionTime, shouldGenerateFile));
184 } 182 }
185 183
186 void FormData::appendBlob(const KURL& blobURL) 184 void FormData::appendBlob(PassRefPtr<BlobDataHandle> blobDataHandle)
187 { 185 {
188 m_elements.append(FormDataElement(blobURL)); 186 m_elements.append(FormDataElement(blobDataHandle));
189 } 187 }
190 #endif 188 #endif
191 #if ENABLE(FILE_SYSTEM) 189 #if ENABLE(FILE_SYSTEM)
192 void FormData::appendURL(const KURL& url) 190 void FormData::appendURL(const KURL& url)
193 { 191 {
194 m_elements.append(FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalid FileTime())); 192 m_elements.append(FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalid FileTime()));
195 } 193 }
196 194
197 void FormData::appendURLRange(const KURL& url, long long start, long long length , double expectedModificationTime) 195 void FormData::appendURLRange(const KURL& url, long long start, long long length , double expectedModificationTime)
198 { 196 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // Do not add the file if the path is empty. 268 // Do not add the file if the path is empty.
271 if (!file->path().isEmpty()) 269 if (!file->path().isEmpty())
272 appendFile(file->path(), shouldGenerateFile); 270 appendFile(file->path(), shouldGenerateFile);
273 #if ENABLE(FILE_SYSTEM) 271 #if ENABLE(FILE_SYSTEM)
274 if (!file->fileSystemURL().isEmpty()) 272 if (!file->fileSystemURL().isEmpty())
275 appendURL(file->fileSystemURL()); 273 appendURL(file->fileSystemURL());
276 #endif 274 #endif
277 } 275 }
278 #if ENABLE(BLOB) 276 #if ENABLE(BLOB)
279 else 277 else
280 appendBlob(value.blob()->url()); 278 appendBlob(value.blob()->blobDataHandle());
281 #endif 279 #endif
282 } else 280 } else
283 appendData(value.data().data(), value.data().length()); 281 appendData(value.data().data(), value.data().length());
284 appendData("\r\n", 2); 282 appendData("\r\n", 2);
285 } else { 283 } else {
286 // Omit the name "isindex" if it's the first form data element. 284 // Omit the name "isindex" if it's the first form data element.
287 // FIXME: Why is this a good rule? Is this obsolete now? 285 // FIXME: Why is this a good rule? Is this obsolete now?
288 if (encodedData.isEmpty() && key.data() == "isindex") 286 if (encodedData.isEmpty() && key.data() == "isindex")
289 FormDataBuilder::encodeStringAsFormData(encodedData, value.data( )); 287 FormDataBuilder::encodeStringAsFormData(encodedData, value.data( ));
290 else 288 else
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (!decoder.decodeBool(data->m_hasGeneratedFiles)) 520 if (!decoder.decodeBool(data->m_hasGeneratedFiles))
523 return 0; 521 return 0;
524 522
525 if (!decoder.decodeInt64(data->m_identifier)) 523 if (!decoder.decodeInt64(data->m_identifier))
526 return 0; 524 return 0;
527 525
528 return data.release(); 526 return data.release();
529 } 527 }
530 528
531 } // namespace WebCore 529 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698