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/RequestInit.h" | 5 #include "modules/fetch/RequestInit.h" |
6 | 6 |
7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
8 #include "bindings/core/v8/V8ArrayBuffer.h" | 8 #include "bindings/core/v8/V8ArrayBuffer.h" |
9 #include "bindings/core/v8/V8ArrayBufferView.h" | 9 #include "bindings/core/v8/V8ArrayBufferView.h" |
10 #include "bindings/core/v8/V8BindingForCore.h" | 10 #include "bindings/core/v8/V8BindingForCore.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if (v8_body->IsArrayBuffer()) { | 143 if (v8_body->IsArrayBuffer()) { |
144 body = new FormDataBytesConsumer( | 144 body = new FormDataBytesConsumer( |
145 V8ArrayBuffer::toImpl(v8_body.As<v8::Object>())); | 145 V8ArrayBuffer::toImpl(v8_body.As<v8::Object>())); |
146 } else if (v8_body->IsArrayBufferView()) { | 146 } else if (v8_body->IsArrayBufferView()) { |
147 body = new FormDataBytesConsumer( | 147 body = new FormDataBytesConsumer( |
148 V8ArrayBufferView::toImpl(v8_body.As<v8::Object>())); | 148 V8ArrayBufferView::toImpl(v8_body.As<v8::Object>())); |
149 } else if (V8Blob::hasInstance(v8_body, isolate)) { | 149 } else if (V8Blob::hasInstance(v8_body, isolate)) { |
150 RefPtr<BlobDataHandle> blob_data_handle = | 150 RefPtr<BlobDataHandle> blob_data_handle = |
151 V8Blob::toImpl(v8_body.As<v8::Object>())->GetBlobDataHandle(); | 151 V8Blob::toImpl(v8_body.As<v8::Object>())->GetBlobDataHandle(); |
152 content_type = blob_data_handle->GetType(); | 152 content_type = blob_data_handle->GetType(); |
153 body = new BlobBytesConsumer(context, blob_data_handle.Release()); | 153 body = new BlobBytesConsumer(context, std::move(blob_data_handle)); |
154 } else if (V8FormData::hasInstance(v8_body, isolate)) { | 154 } else if (V8FormData::hasInstance(v8_body, isolate)) { |
155 RefPtr<EncodedFormData> form_data = | 155 RefPtr<EncodedFormData> form_data = |
156 V8FormData::toImpl(v8_body.As<v8::Object>())->EncodeMultiPartFormData(); | 156 V8FormData::toImpl(v8_body.As<v8::Object>())->EncodeMultiPartFormData(); |
157 // Here we handle formData->boundary() as a C-style string. See | 157 // Here we handle formData->boundary() as a C-style string. See |
158 // FormDataEncoder::generateUniqueBoundaryString. | 158 // FormDataEncoder::generateUniqueBoundaryString. |
159 content_type = AtomicString("multipart/form-data; boundary=") + | 159 content_type = AtomicString("multipart/form-data; boundary=") + |
160 form_data->Boundary().data(); | 160 form_data->Boundary().data(); |
161 body = new FormDataBytesConsumer(context, form_data.Release()); | 161 body = new FormDataBytesConsumer(context, std::move(form_data)); |
162 } else if (V8URLSearchParams::hasInstance(v8_body, isolate)) { | 162 } else if (V8URLSearchParams::hasInstance(v8_body, isolate)) { |
163 RefPtr<EncodedFormData> form_data = | 163 RefPtr<EncodedFormData> form_data = |
164 V8URLSearchParams::toImpl(v8_body.As<v8::Object>()) | 164 V8URLSearchParams::toImpl(v8_body.As<v8::Object>()) |
165 ->ToEncodedFormData(); | 165 ->ToEncodedFormData(); |
166 content_type = | 166 content_type = |
167 AtomicString("application/x-www-form-urlencoded;charset=UTF-8"); | 167 AtomicString("application/x-www-form-urlencoded;charset=UTF-8"); |
168 body = new FormDataBytesConsumer(context, form_data.Release()); | 168 body = new FormDataBytesConsumer(context, std::move(form_data)); |
169 } else if (v8_body->IsString()) { | 169 } else if (v8_body->IsString()) { |
170 content_type = "text/plain;charset=UTF-8"; | 170 content_type = "text/plain;charset=UTF-8"; |
171 body = new FormDataBytesConsumer( | 171 body = new FormDataBytesConsumer( |
172 ToUSVString(isolate, v8_body, exception_state)); | 172 ToUSVString(isolate, v8_body, exception_state)); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 } // namespace blink | 176 } // namespace blink |
OLD | NEW |