| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" | 
| 6 #include "modules/fetch/Response.h" | 6 #include "modules/fetch/Response.h" | 
| 7 | 7 | 
| 8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" | 
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" | 
| 10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" | 
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108     } | 108     } | 
| 109     if (body.isArrayBufferView()) { | 109     if (body.isArrayBufferView()) { | 
| 110         RefPtr<DOMArrayBufferView> arrayBufferView = body.getAsArrayBufferView()
     ; | 110         RefPtr<DOMArrayBufferView> arrayBufferView = body.getAsArrayBufferView()
     ; | 
| 111         OwnPtr<BlobData> blobData = BlobData::create(); | 111         OwnPtr<BlobData> blobData = BlobData::create(); | 
| 112         blobData->appendBytes(arrayBufferView->baseAddress(), arrayBufferView->b
     yteLength()); | 112         blobData->appendBytes(arrayBufferView->baseAddress(), arrayBufferView->b
     yteLength()); | 
| 113         const long long length = blobData->length(); | 113         const long long length = blobData->length(); | 
| 114         Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), len
     gth)); | 114         Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), len
     gth)); | 
| 115         return create(context, blob, ResponseInit(responseInit, exceptionState),
      exceptionState); | 115         return create(context, blob, ResponseInit(responseInit, exceptionState),
      exceptionState); | 
| 116     } | 116     } | 
| 117     if (body.isFormData()) { | 117     if (body.isFormData()) { | 
| 118         RefPtrWillBeRawPtr<DOMFormData> domFormData = body.getAsFormData(); | 118         DOMFormData* domFormData = body.getAsFormData(); | 
| 119         OwnPtr<BlobData> blobData = BlobData::create(); | 119         OwnPtr<BlobData> blobData = BlobData::create(); | 
| 120         // FIXME: the same code exist in RequestInit::RequestInit(). | 120         // FIXME: the same code exist in RequestInit::RequestInit(). | 
| 121         RefPtr<FormData> httpBody = domFormData->createMultiPartFormData(); | 121         RefPtr<FormData> httpBody = domFormData->createMultiPartFormData(); | 
| 122         for (size_t i = 0; i < httpBody->elements().size(); ++i) { | 122         for (size_t i = 0; i < httpBody->elements().size(); ++i) { | 
| 123             const FormDataElement& element = httpBody->elements()[i]; | 123             const FormDataElement& element = httpBody->elements()[i]; | 
| 124             switch (element.m_type) { | 124             switch (element.m_type) { | 
| 125             case FormDataElement::data: { | 125             case FormDataElement::data: { | 
| 126                 blobData->appendBytes(element.m_data.data(), element.m_data.size
     ()); | 126                 blobData->appendBytes(element.m_data.data(), element.m_data.size
     ()); | 
| 127                 break; | 127                 break; | 
| 128             } | 128             } | 
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 396 } | 396 } | 
| 397 | 397 | 
| 398 DEFINE_TRACE(Response) | 398 DEFINE_TRACE(Response) | 
| 399 { | 399 { | 
| 400     Body::trace(visitor); | 400     Body::trace(visitor); | 
| 401     visitor->trace(m_response); | 401     visitor->trace(m_response); | 
| 402     visitor->trace(m_headers); | 402     visitor->trace(m_headers); | 
| 403 } | 403 } | 
| 404 | 404 | 
| 405 } // namespace blink | 405 } // namespace blink | 
| OLD | NEW | 
|---|