OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "bindings/core/v8/serialization/V8ScriptValueDeserializer.h" | 5 #include "bindings/core/v8/serialization/V8ScriptValueDeserializer.h" |
6 | 6 |
7 #include "bindings/core/v8/ToV8.h" | 7 #include "bindings/core/v8/ToV8.h" |
8 #include "core/dom/CompositorProxy.h" | 8 #include "core/dom/CompositorProxy.h" |
9 #include "core/dom/DOMArrayBuffer.h" | 9 #include "core/dom/DOMArrayBuffer.h" |
10 #include "core/dom/DOMSharedArrayBuffer.h" | 10 #include "core/dom/DOMSharedArrayBuffer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Otherwise, we did read the envelope. Hurray! | 73 // Otherwise, we did read the envelope. Hurray! |
74 *outVersion = version; | 74 *outVersion = version; |
75 return i; | 75 return i; |
76 } | 76 } |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 V8ScriptValueDeserializer::V8ScriptValueDeserializer( | 80 V8ScriptValueDeserializer::V8ScriptValueDeserializer( |
81 RefPtr<ScriptState> scriptState, | 81 RefPtr<ScriptState> scriptState, |
82 RefPtr<SerializedScriptValue> serializedScriptValue) | 82 RefPtr<SerializedScriptValue> serializedScriptValue, |
| 83 const Options& options) |
83 : m_scriptState(std::move(scriptState)), | 84 : m_scriptState(std::move(scriptState)), |
84 m_serializedScriptValue(std::move(serializedScriptValue)), | 85 m_serializedScriptValue(std::move(serializedScriptValue)), |
85 m_deserializer(m_scriptState->isolate(), | 86 m_deserializer(m_scriptState->isolate(), |
86 m_serializedScriptValue->data(), | 87 m_serializedScriptValue->data(), |
87 m_serializedScriptValue->dataLengthInBytes(), | 88 m_serializedScriptValue->dataLengthInBytes(), |
88 this) { | 89 this), |
| 90 m_transferredMessagePorts(options.messagePorts), |
| 91 m_blobInfoArray(options.blobInfo) { |
89 m_deserializer.SetSupportsLegacyWireFormat(true); | 92 m_deserializer.SetSupportsLegacyWireFormat(true); |
90 } | 93 } |
91 | 94 |
92 v8::Local<v8::Value> V8ScriptValueDeserializer::deserialize() { | 95 v8::Local<v8::Value> V8ScriptValueDeserializer::deserialize() { |
93 #if DCHECK_IS_ON() | 96 #if DCHECK_IS_ON() |
94 DCHECK(!m_deserializeInvoked); | 97 DCHECK(!m_deserializeInvoked); |
95 m_deserializeInvoked = true; | 98 m_deserializeInvoked = true; |
96 #endif | 99 #endif |
97 | 100 |
98 v8::Isolate* isolate = m_scriptState->isolate(); | 101 v8::Isolate* isolate = m_scriptState->isolate(); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 "Unable to deserialize cloned data."); | 399 "Unable to deserialize cloned data."); |
397 return v8::MaybeLocal<v8::Object>(); | 400 return v8::MaybeLocal<v8::Object>(); |
398 } | 401 } |
399 v8::Local<v8::Object> creationContext = m_scriptState->context()->Global(); | 402 v8::Local<v8::Object> creationContext = m_scriptState->context()->Global(); |
400 v8::Local<v8::Value> wrapper = ToV8(wrappable, creationContext, isolate); | 403 v8::Local<v8::Value> wrapper = ToV8(wrappable, creationContext, isolate); |
401 DCHECK(wrapper->IsObject()); | 404 DCHECK(wrapper->IsObject()); |
402 return wrapper.As<v8::Object>(); | 405 return wrapper.As<v8::Object>(); |
403 } | 406 } |
404 | 407 |
405 } // namespace blink | 408 } // namespace blink |
OLD | NEW |