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 #ifndef V8ScriptValueDeserializer_h | 5 #ifndef V8ScriptValueDeserializer_h |
6 #define V8ScriptValueDeserializer_h | 6 #define V8ScriptValueDeserializer_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/SerializationTag.h" | 9 #include "bindings/core/v8/SerializationTag.h" |
10 #include "bindings/core/v8/SerializedScriptValue.h" | 10 #include "bindings/core/v8/SerializedScriptValue.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // modules types is implemented in a subclass. | 25 // modules types is implemented in a subclass. |
26 // | 26 // |
27 // A deserializer cannot be used multiple times; it is expected that its | 27 // A deserializer cannot be used multiple times; it is expected that its |
28 // deserialize method will be invoked exactly once. | 28 // deserialize method will be invoked exactly once. |
29 class GC_PLUGIN_IGNORE("https://crbug.com/644725") CORE_EXPORT | 29 class GC_PLUGIN_IGNORE("https://crbug.com/644725") CORE_EXPORT |
30 V8ScriptValueDeserializer : public v8::ValueDeserializer::Delegate { | 30 V8ScriptValueDeserializer : public v8::ValueDeserializer::Delegate { |
31 STACK_ALLOCATED(); | 31 STACK_ALLOCATED(); |
32 WTF_MAKE_NONCOPYABLE(V8ScriptValueDeserializer); | 32 WTF_MAKE_NONCOPYABLE(V8ScriptValueDeserializer); |
33 | 33 |
34 public: | 34 public: |
35 V8ScriptValueDeserializer(RefPtr<ScriptState>, RefPtr<SerializedScriptValue>); | 35 using Options = SerializedScriptValue::DeserializeOptions; |
36 | 36 V8ScriptValueDeserializer(RefPtr<ScriptState>, |
37 void setTransferredMessagePorts(const MessagePortArray* ports) { | 37 RefPtr<SerializedScriptValue>, |
38 m_transferredMessagePorts = ports; | 38 const Options& = Options()); |
39 } | |
40 void setBlobInfoArray(const WebBlobInfoArray* blobInfoArray) { | |
41 m_blobInfoArray = blobInfoArray; | |
42 } | |
43 | 39 |
44 v8::Local<v8::Value> deserialize(); | 40 v8::Local<v8::Value> deserialize(); |
45 | 41 |
46 protected: | 42 protected: |
47 virtual ScriptWrappable* readDOMObject(SerializationTag); | 43 virtual ScriptWrappable* readDOMObject(SerializationTag); |
48 | 44 |
49 ScriptState* getScriptState() const { return m_scriptState.get(); } | 45 ScriptState* getScriptState() const { return m_scriptState.get(); } |
50 | 46 |
51 uint32_t version() const { return m_version; } | 47 uint32_t version() const { return m_version; } |
52 bool readTag(SerializationTag* tag) { | 48 bool readTag(SerializationTag* tag) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Set during deserialize after the header is read. | 90 // Set during deserialize after the header is read. |
95 uint32_t m_version = 0; | 91 uint32_t m_version = 0; |
96 #if DCHECK_IS_ON() | 92 #if DCHECK_IS_ON() |
97 bool m_deserializeInvoked = false; | 93 bool m_deserializeInvoked = false; |
98 #endif | 94 #endif |
99 }; | 95 }; |
100 | 96 |
101 } // namespace blink | 97 } // namespace blink |
102 | 98 |
103 #endif // V8ScriptValueDeserializer_h | 99 #endif // V8ScriptValueDeserializer_h |
OLD | NEW |