| 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 <memory> | 7 #include <memory> |
| 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 "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| 11 #include "bindings/core/v8/V8ArrayBuffer.h" | 11 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 12 #include "bindings/core/v8/V8ArrayBufferView.h" | 12 #include "bindings/core/v8/V8ArrayBufferView.h" |
| 13 #include "bindings/core/v8/V8Binding.h" | 13 #include "bindings/core/v8/V8Binding.h" |
| 14 #include "bindings/core/v8/V8Blob.h" | 14 #include "bindings/core/v8/V8Blob.h" |
| 15 #include "bindings/core/v8/V8FormData.h" | 15 #include "bindings/core/v8/V8FormData.h" |
| 16 #include "bindings/core/v8/V8HiddenValue.h" | 16 #include "bindings/core/v8/V8PrivateProperty.h" |
| 17 #include "bindings/core/v8/V8URLSearchParams.h" | 17 #include "bindings/core/v8/V8URLSearchParams.h" |
| 18 #include "bindings/modules/v8/ByteStringSequenceSequenceOrDictionaryOrHeaders.h" | 18 #include "bindings/modules/v8/ByteStringSequenceSequenceOrDictionaryOrHeaders.h" |
| 19 #include "core/dom/DOMArrayBuffer.h" | 19 #include "core/dom/DOMArrayBuffer.h" |
| 20 #include "core/dom/DOMArrayBufferView.h" | 20 #include "core/dom/DOMArrayBufferView.h" |
| 21 #include "core/dom/URLSearchParams.h" | 21 #include "core/dom/URLSearchParams.h" |
| 22 #include "core/fileapi/Blob.h" | 22 #include "core/fileapi/Blob.h" |
| 23 #include "core/frame/UseCounter.h" | 23 #include "core/frame/UseCounter.h" |
| 24 #include "core/html/FormData.h" | 24 #include "core/html/FormData.h" |
| 25 #include "core/streams/ReadableStreamOperations.h" | 25 #include "core/streams/ReadableStreamOperations.h" |
| 26 #include "modules/fetch/BlobBytesConsumer.h" | 26 #include "modules/fetch/BlobBytesConsumer.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 v8::Local<v8::Value> bodyBuffer = ToV8(internalBodyBuffer(), scriptState); | 448 v8::Local<v8::Value> bodyBuffer = ToV8(internalBodyBuffer(), scriptState); |
| 449 v8::Local<v8::Value> response = ToV8(this, scriptState); | 449 v8::Local<v8::Value> response = ToV8(this, scriptState); |
| 450 if (response.IsEmpty()) { | 450 if (response.IsEmpty()) { |
| 451 // |toV8| can return an empty handle when the worker is terminating. | 451 // |toV8| can return an empty handle when the worker is terminating. |
| 452 // We don't want the renderer to crash in such cases. | 452 // We don't want the renderer to crash in such cases. |
| 453 // TODO(yhirano): Delete this block after the graceful shutdown | 453 // TODO(yhirano): Delete this block after the graceful shutdown |
| 454 // mechanism is introduced. | 454 // mechanism is introduced. |
| 455 return; | 455 return; |
| 456 } | 456 } |
| 457 DCHECK(response->IsObject()); | 457 DCHECK(response->IsObject()); |
| 458 V8HiddenValue::setHiddenValue( | 458 V8PrivateProperty::getInternalBodyBuffer(scriptState->isolate()) |
| 459 scriptState, response.As<v8::Object>(), | 459 .set(scriptState->context(), response.As<v8::Object>(), bodyBuffer); |
| 460 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | |
| 461 } | 460 } |
| 462 | 461 |
| 463 DEFINE_TRACE(Response) { | 462 DEFINE_TRACE(Response) { |
| 464 Body::trace(visitor); | 463 Body::trace(visitor); |
| 465 visitor->trace(m_response); | 464 visitor->trace(m_response); |
| 466 visitor->trace(m_headers); | 465 visitor->trace(m_headers); |
| 467 } | 466 } |
| 468 | 467 |
| 469 } // namespace blink | 468 } // namespace blink |
| OLD | NEW |