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

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

Issue 13497009: Remove ENABLE(FILE_SYSTEM) compile-time flag. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added CodeGeneratorInspector.py change Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/WebCore/platform/network/FormData.h ('k') | Source/WebKit/chromium/features.gypi » ('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 * 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e .m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenera teFile)); 143 formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e .m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenera teFile));
144 #else 144 #else
145 formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e .m_shouldGenerateFile)); 145 formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e .m_shouldGenerateFile));
146 #endif 146 #endif
147 break; 147 break;
148 #if ENABLE(BLOB) 148 #if ENABLE(BLOB)
149 case FormDataElement::encodedBlob: 149 case FormDataElement::encodedBlob:
150 formData->m_elements.uncheckedAppend(FormDataElement(e.m_url)); 150 formData->m_elements.uncheckedAppend(FormDataElement(e.m_url));
151 break; 151 break;
152 #endif 152 #endif
153 #if ENABLE(FILE_SYSTEM)
154 case FormDataElement::encodedURL: 153 case FormDataElement::encodedURL:
155 formData->m_elements.uncheckedAppend(FormDataElement(e.m_url, e.m_fi leStart, e.m_fileLength, e.m_expectedFileModificationTime)); 154 formData->m_elements.uncheckedAppend(FormDataElement(e.m_url, e.m_fi leStart, e.m_fileLength, e.m_expectedFileModificationTime));
156 break; 155 break;
157 #endif
158 } 156 }
159 } 157 }
160 return formData.release(); 158 return formData.release();
161 } 159 }
162 160
163 void FormData::appendData(const void* data, size_t size) 161 void FormData::appendData(const void* data, size_t size)
164 { 162 {
165 if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::dat a) 163 if (m_elements.isEmpty() || m_elements.last().m_type != FormDataElement::dat a)
166 m_elements.append(FormDataElement()); 164 m_elements.append(FormDataElement());
167 FormDataElement& e = m_elements.last(); 165 FormDataElement& e = m_elements.last();
(...skipping 15 matching lines...) Expand all
183 void FormData::appendFileRange(const String& filename, long long start, long lon g length, double expectedModificationTime, bool shouldGenerateFile) 181 void FormData::appendFileRange(const String& filename, long long start, long lon g length, double expectedModificationTime, bool shouldGenerateFile)
184 { 182 {
185 m_elements.append(FormDataElement(filename, start, length, expectedModificat ionTime, shouldGenerateFile)); 183 m_elements.append(FormDataElement(filename, start, length, expectedModificat ionTime, shouldGenerateFile));
186 } 184 }
187 185
188 void FormData::appendBlob(const KURL& blobURL) 186 void FormData::appendBlob(const KURL& blobURL)
189 { 187 {
190 m_elements.append(FormDataElement(blobURL)); 188 m_elements.append(FormDataElement(blobURL));
191 } 189 }
192 #endif 190 #endif
193 #if ENABLE(FILE_SYSTEM)
194 void FormData::appendURL(const KURL& url) 191 void FormData::appendURL(const KURL& url)
195 { 192 {
196 m_elements.append(FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalid FileTime())); 193 m_elements.append(FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalid FileTime()));
197 } 194 }
198 195
199 void FormData::appendURLRange(const KURL& url, long long start, long long length , double expectedModificationTime) 196 void FormData::appendURLRange(const KURL& url, long long start, long long length , double expectedModificationTime)
200 { 197 {
201 m_elements.append(FormDataElement(url, start, length, expectedModificationTi me)); 198 m_elements.append(FormDataElement(url, start, length, expectedModificationTi me));
202 } 199 }
203 #endif
204 200
205 void FormData::appendKeyValuePairItems(const FormDataList& list, const TextEncod ing& encoding, bool isMultiPartForm, Document* document, EncodingType encodingTy pe) 201 void FormData::appendKeyValuePairItems(const FormDataList& list, const TextEncod ing& encoding, bool isMultiPartForm, Document* document, EncodingType encodingTy pe)
206 { 202 {
207 if (isMultiPartForm) 203 if (isMultiPartForm)
208 m_boundary = FormDataBuilder::generateUniqueBoundaryString(); 204 m_boundary = FormDataBuilder::generateUniqueBoundaryString();
209 205
210 Vector<char> encodedData; 206 Vector<char> encodedData;
211 207
212 const Vector<FormDataList::Item>& items = list.items(); 208 const Vector<FormDataList::Item>& items = list.items();
213 size_t formDataListSize = items.size(); 209 size_t formDataListSize = items.size();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 FormDataBuilder::finishMultiPartHeader(header); 265 FormDataBuilder::finishMultiPartHeader(header);
270 266
271 // Append body 267 // Append body
272 appendData(header.data(), header.size()); 268 appendData(header.data(), header.size());
273 if (value.blob()) { 269 if (value.blob()) {
274 if (value.blob()->isFile()) { 270 if (value.blob()->isFile()) {
275 File* file = toFile(value.blob()); 271 File* file = toFile(value.blob());
276 // Do not add the file if the path is empty. 272 // Do not add the file if the path is empty.
277 if (!file->path().isEmpty()) 273 if (!file->path().isEmpty())
278 appendFile(file->path(), shouldGenerateFile); 274 appendFile(file->path(), shouldGenerateFile);
279 #if ENABLE(FILE_SYSTEM)
280 if (!file->fileSystemURL().isEmpty()) 275 if (!file->fileSystemURL().isEmpty())
281 appendURL(file->fileSystemURL()); 276 appendURL(file->fileSystemURL());
282 #endif
283 } 277 }
284 #if ENABLE(BLOB) 278 #if ENABLE(BLOB)
285 else 279 else
286 appendBlob(value.blob()->url()); 280 appendBlob(value.blob()->url());
287 #endif 281 #endif
288 } else 282 } else
289 appendData(value.data().data(), value.data().length()); 283 appendData(value.data().data(), value.data().length());
290 appendData("\r\n", 2); 284 appendData("\r\n", 2);
291 } else { 285 } else {
292 // Omit the name "isindex" if it's the first form data element. 286 // Omit the name "isindex" if it's the first form data element.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 encoder.encodeDouble(invalidFileTime()); 463 encoder.encodeDouble(invalidFileTime());
470 #endif 464 #endif
471 return; 465 return;
472 466
473 #if ENABLE(BLOB) 467 #if ENABLE(BLOB)
474 case FormDataElement::encodedBlob: 468 case FormDataElement::encodedBlob:
475 encoder.encodeString(element.m_url.string()); 469 encoder.encodeString(element.m_url.string());
476 return; 470 return;
477 #endif 471 #endif
478 472
479 #if ENABLE(FILE_SYSTEM)
480 case FormDataElement::encodedURL: 473 case FormDataElement::encodedURL:
481 encoder.encodeString(element.m_url.string()); 474 encoder.encodeString(element.m_url.string());
482 encoder.encodeInt64(element.m_fileStart); 475 encoder.encodeInt64(element.m_fileStart);
483 encoder.encodeInt64(element.m_fileLength); 476 encoder.encodeInt64(element.m_fileLength);
484 encoder.encodeDouble(element.m_expectedFileModificationTime); 477 encoder.encodeDouble(element.m_expectedFileModificationTime);
485 return; 478 return;
486 #endif
487 } 479 }
488 480
489 ASSERT_NOT_REACHED(); 481 ASSERT_NOT_REACHED();
490 } 482 }
491 483
492 static bool decodeElement(Decoder& decoder, FormDataElement& element) 484 static bool decodeElement(Decoder& decoder, FormDataElement& element)
493 { 485 {
494 uint32_t type; 486 uint32_t type;
495 if (!decoder.decodeUInt32(type)) 487 if (!decoder.decodeUInt32(type))
496 return false; 488 return false;
497 489
498 switch (type) { 490 switch (type) {
499 case FormDataElement::data: { 491 case FormDataElement::data: {
500 element.m_type = FormDataElement::data; 492 element.m_type = FormDataElement::data;
501 Vector<uint8_t> data; 493 Vector<uint8_t> data;
502 if (!decoder.decodeBytes(data)) 494 if (!decoder.decodeBytes(data))
503 return false; 495 return false;
504 size_t size = data.size(); 496 size_t size = data.size();
505 element.m_data.resize(size); 497 element.m_data.resize(size);
506 memcpy(element.m_data.data(), data.data(), size); 498 memcpy(element.m_data.data(), data.data(), size);
507 return true; 499 return true;
508 } 500 }
509 501
510 case FormDataElement::encodedFile: 502 case FormDataElement::encodedFile:
511 #if ENABLE(FILE_SYSTEM)
512 case FormDataElement::encodedURL: 503 case FormDataElement::encodedURL:
513 #endif
514 { 504 {
515 element.m_type = static_cast<FormDataElement::Type>(type); 505 element.m_type = static_cast<FormDataElement::Type>(type);
516 String filenameOrURL; 506 String filenameOrURL;
517 if (!decoder.decodeString(filenameOrURL)) 507 if (!decoder.decodeString(filenameOrURL))
518 return false; 508 return false;
519 if (type == FormDataElement::encodedFile) { 509 if (type == FormDataElement::encodedFile) {
520 if (!decoder.decodeString(element.m_generatedFilename)) 510 if (!decoder.decodeString(element.m_generatedFilename))
521 return false; 511 return false;
522 if (!decoder.decodeBool(element.m_shouldGenerateFile)) 512 if (!decoder.decodeBool(element.m_shouldGenerateFile))
523 return false; 513 return false;
524 } 514 }
525 int64_t fileStart; 515 int64_t fileStart;
526 if (!decoder.decodeInt64(fileStart)) 516 if (!decoder.decodeInt64(fileStart))
527 return false; 517 return false;
528 if (fileStart < 0) 518 if (fileStart < 0)
529 return false; 519 return false;
530 int64_t fileLength; 520 int64_t fileLength;
531 if (!decoder.decodeInt64(fileLength)) 521 if (!decoder.decodeInt64(fileLength))
532 return false; 522 return false;
533 if (fileLength != BlobDataItem::toEndOfFile && fileLength < fileStart) 523 if (fileLength != BlobDataItem::toEndOfFile && fileLength < fileStart)
534 return false; 524 return false;
535 double expectedFileModificationTime; 525 double expectedFileModificationTime;
536 if (!decoder.decodeDouble(expectedFileModificationTime)) 526 if (!decoder.decodeDouble(expectedFileModificationTime))
537 return false; 527 return false;
538 528
539 #if ENABLE(FILE_SYSTEM)
540 if (type == FormDataElement::encodedURL) 529 if (type == FormDataElement::encodedURL)
541 element.m_url = KURL(KURL(), filenameOrURL); 530 element.m_url = KURL(KURL(), filenameOrURL);
542 else 531 else
543 #endif
544 element.m_filename = filenameOrURL; 532 element.m_filename = filenameOrURL;
545 533
546 #if ENABLE(BLOB) 534 #if ENABLE(BLOB)
547 element.m_fileStart = fileStart; 535 element.m_fileStart = fileStart;
548 element.m_fileLength = fileLength; 536 element.m_fileLength = fileLength;
549 element.m_expectedFileModificationTime = expectedFileModificationTime; 537 element.m_expectedFileModificationTime = expectedFileModificationTime;
550 #endif 538 #endif
551 return true; 539 return true;
552 } 540 }
553 541
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 if (!decoder.decodeBool(data->m_hasGeneratedFiles)) 597 if (!decoder.decodeBool(data->m_hasGeneratedFiles))
610 return 0; 598 return 0;
611 599
612 if (!decoder.decodeInt64(data->m_identifier)) 600 if (!decoder.decodeInt64(data->m_identifier))
613 return 0; 601 return 0;
614 602
615 return data.release(); 603 return data.release();
616 } 604 }
617 605
618 } // namespace WebCore 606 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/platform/network/FormData.h ('k') | Source/WebKit/chromium/features.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698