OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/fetch/FetchFormDataConsumerHandle.h" | 5 #include "modules/fetch/FetchFormDataConsumerHandle.h" |
6 | 6 |
7 #include "modules/fetch/DataConsumerHandleUtil.h" | 7 #include "modules/fetch/DataConsumerHandleUtil.h" |
8 #include "modules/fetch/FetchBlobDataConsumerHandle.h" | 8 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
9 #include "wtf/ThreadSafeRefCounted.h" | 9 #include "wtf/ThreadSafeRefCounted.h" |
10 #include "wtf/ThreadingPrimitives.h" | 10 #include "wtf/ThreadingPrimitives.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 if (element.m_optionalBlobDataHandle) | 258 if (element.m_optionalBlobDataHandle) |
259 blobData->appendBlob(element.m_optionalBlobDataHandle, 0, el
ement.m_optionalBlobDataHandle->size()); | 259 blobData->appendBlob(element.m_optionalBlobDataHandle, 0, el
ement.m_optionalBlobDataHandle->size()); |
260 break; | 260 break; |
261 case FormDataElement::encodedFileSystemURL: | 261 case FormDataElement::encodedFileSystemURL: |
262 blobData->appendFileSystemURL(element.m_fileSystemURL, element.m
_fileStart, element.m_fileLength, element.m_expectedFileModificationTime); | 262 blobData->appendFileSystemURL(element.m_fileSystemURL, element.m
_fileStart, element.m_fileLength, element.m_expectedFileModificationTime); |
263 break; | 263 break; |
264 } | 264 } |
265 } | 265 } |
266 // Here we handle body->boundary() as a C-style string. See | 266 // Here we handle body->boundary() as a C-style string. See |
267 // FormDataEncoder::generateUniqueBoundaryString. | 267 // FormDataEncoder::generateUniqueBoundaryString. |
268 blobData->setContentType(AtomicString("multipart/form-data; boundary=",
AtomicString::ConstructFromLiteral) + body->boundary().data()); | 268 blobData->setContentType(AtomicString("multipart/form-data; boundary=")
+ body->boundary().data()); |
269 auto size = blobData->length(); | 269 auto size = blobData->length(); |
270 if (factory) { | 270 if (factory) { |
271 // For testing | 271 // For testing |
272 m_handle = FetchBlobDataConsumerHandle::create(executionContext, Blo
bDataHandle::create(blobData.release(), size), factory); | 272 m_handle = FetchBlobDataConsumerHandle::create(executionContext, Blo
bDataHandle::create(blobData.release(), size), factory); |
273 } else { | 273 } else { |
274 m_handle = FetchBlobDataConsumerHandle::create(executionContext, Blo
bDataHandle::create(blobData.release(), size)); | 274 m_handle = FetchBlobDataConsumerHandle::create(executionContext, Blo
bDataHandle::create(blobData.release(), size)); |
275 } | 275 } |
276 // It is important to initialize |m_formData| here, because even | 276 // It is important to initialize |m_formData| here, because even |
277 // read-only operations may make the form data unsharable with implicit | 277 // read-only operations may make the form data unsharable with implicit |
278 // ref-counting. | 278 // ref-counting. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 } | 330 } |
331 FetchFormDataConsumerHandle::~FetchFormDataConsumerHandle() {} | 331 FetchFormDataConsumerHandle::~FetchFormDataConsumerHandle() {} |
332 | 332 |
333 FetchDataConsumerHandle::Reader* FetchFormDataConsumerHandle::obtainReaderIntern
al(Client* client) | 333 FetchDataConsumerHandle::Reader* FetchFormDataConsumerHandle::obtainReaderIntern
al(Client* client) |
334 { | 334 { |
335 return m_context->obtainReader(client).leakPtr(); | 335 return m_context->obtainReader(client).leakPtr(); |
336 } | 336 } |
337 | 337 |
338 } // namespace blink | 338 } // namespace blink |
OLD | NEW |