| 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 "modules/fetch/Response.h" | 5 #include "modules/fetch/Response.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8ArrayBuffer.h" | 10 #include "bindings/core/v8/V8ArrayBuffer.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 BodyStreamBuffer* bodyBuffer = nullptr; | 122 BodyStreamBuffer* bodyBuffer = nullptr; |
| 123 String contentType; | 123 String contentType; |
| 124 if (bodyValue.isUndefined() || bodyValue.isNull()) { | 124 if (bodyValue.isUndefined() || bodyValue.isNull()) { |
| 125 // Note: The IDL processor cannot handle this situation. See | 125 // Note: The IDL processor cannot handle this situation. See |
| 126 // https://crbug.com/335871. | 126 // https://crbug.com/335871. |
| 127 } else if (V8Blob::hasInstance(body, isolate)) { | 127 } else if (V8Blob::hasInstance(body, isolate)) { |
| 128 Blob* blob = V8Blob::toImpl(body.As<v8::Object>()); | 128 Blob* blob = V8Blob::toImpl(body.As<v8::Object>()); |
| 129 bodyBuffer = new BodyStreamBuffer(scriptState, FetchBlobDataConsumerHand
le::create(executionContext, blob->blobDataHandle())); | 129 bodyBuffer = new BodyStreamBuffer(scriptState, FetchBlobDataConsumerHand
le::create(executionContext, blob->blobDataHandle())); |
| 130 contentType = blob->type(); | 130 contentType = blob->type(); |
| 131 } else if (V8ArrayBuffer::hasInstance(body, isolate)) { | 131 } else if (body->IsArrayBuffer()) { |
| 132 bodyBuffer = new BodyStreamBuffer(scriptState, FetchFormDataConsumerHand
le::create(V8ArrayBuffer::toImpl(body.As<v8::Object>()))); | 132 bodyBuffer = new BodyStreamBuffer(scriptState, FetchFormDataConsumerHand
le::create(V8ArrayBuffer::toImpl(body.As<v8::Object>()))); |
| 133 } else if (V8ArrayBufferView::hasInstance(body, isolate)) { | 133 } else if (body->IsArrayBufferView()) { |
| 134 bodyBuffer = new BodyStreamBuffer(scriptState, FetchFormDataConsumerHand
le::create(V8ArrayBufferView::toImpl(body.As<v8::Object>()))); | 134 bodyBuffer = new BodyStreamBuffer(scriptState, FetchFormDataConsumerHand
le::create(V8ArrayBufferView::toImpl(body.As<v8::Object>()))); |
| 135 } else if (V8FormData::hasInstance(body, isolate)) { | 135 } else if (V8FormData::hasInstance(body, isolate)) { |
| 136 RefPtr<EncodedFormData> formData = V8FormData::toImpl(body.As<v8::Object
>())->encodeMultiPartFormData(); | 136 RefPtr<EncodedFormData> formData = V8FormData::toImpl(body.As<v8::Object
>())->encodeMultiPartFormData(); |
| 137 // Here we handle formData->boundary() as a C-style string. See | 137 // Here we handle formData->boundary() as a C-style string. See |
| 138 // FormDataEncoder::generateUniqueBoundaryString. | 138 // FormDataEncoder::generateUniqueBoundaryString. |
| 139 contentType = AtomicString("multipart/form-data; boundary=") + formData-
>boundary().data(); | 139 contentType = AtomicString("multipart/form-data; boundary=") + formData-
>boundary().data(); |
| 140 bodyBuffer = new BodyStreamBuffer(scriptState, FetchFormDataConsumerHand
le::create(executionContext, formData.release())); | 140 bodyBuffer = new BodyStreamBuffer(scriptState, FetchFormDataConsumerHand
le::create(executionContext, formData.release())); |
| 141 } else if (RuntimeEnabledFeatures::responseConstructedWithReadableStreamEnab
led() && ReadableStreamOperations::isReadableStream(scriptState, bodyValue)) { | 141 } else if (RuntimeEnabledFeatures::responseConstructedWithReadableStreamEnab
led() && ReadableStreamOperations::isReadableStream(scriptState, bodyValue)) { |
| 142 if (RuntimeEnabledFeatures::responseBodyWithV8ExtraStreamEnabled()) { | 142 if (RuntimeEnabledFeatures::responseBodyWithV8ExtraStreamEnabled()) { |
| 143 bodyBuffer = new BodyStreamBuffer(scriptState, bodyValue); | 143 bodyBuffer = new BodyStreamBuffer(scriptState, bodyValue); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 417 } |
| 418 | 418 |
| 419 DEFINE_TRACE(Response) | 419 DEFINE_TRACE(Response) |
| 420 { | 420 { |
| 421 Body::trace(visitor); | 421 Body::trace(visitor); |
| 422 visitor->trace(m_response); | 422 visitor->trace(m_response); |
| 423 visitor->trace(m_headers); | 423 visitor->trace(m_headers); |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace blink | 426 } // namespace blink |
| OLD | NEW |