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 #ifndef ScriptValueSerializerForModules_h | 5 #ifndef ScriptValueSerializerForModules_h |
6 #define ScriptValueSerializerForModules_h | 6 #define ScriptValueSerializerForModules_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptValueSerializer.h" | 8 #include "bindings/core/v8/ScriptValueSerializer.h" |
9 #include "public/platform/WebCrypto.h" | 9 #include "public/platform/WebCrypto.h" |
10 #include "public/platform/WebCryptoKey.h" | 10 #include "public/platform/WebCryptoKey.h" |
11 #include "public/platform/WebCryptoKeyAlgorithm.h" | 11 #include "public/platform/WebCryptoKeyAlgorithm.h" |
12 #include <v8.h> | 12 #include <v8.h> |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class SerializedScriptValueWriterForModules final : public SerializedScriptValue
Writer { | 16 class SerializedScriptValueWriterForModules final : public SerializedScriptValue
Writer { |
17 STACK_ALLOCATED(); | 17 STACK_ALLOCATED(); |
18 WTF_MAKE_NONCOPYABLE(SerializedScriptValueWriterForModules); | 18 WTF_MAKE_NONCOPYABLE(SerializedScriptValueWriterForModules); |
19 public: | 19 public: |
20 SerializedScriptValueWriterForModules() | 20 SerializedScriptValueWriterForModules() |
21 : SerializedScriptValueWriter() | 21 : SerializedScriptValueWriter() |
22 { | 22 { |
23 } | 23 } |
24 | 24 |
25 void writeDOMFileSystem(int type, const String& name, const String& url); | 25 void writeDOMFileSystem(int type, const String& name, const String& url); |
| 26 void writeTransferredOffscreenCanvas(uint32_t index, uint32_t width, uint32_
t height, uint32_t id); |
26 bool writeCryptoKey(const WebCryptoKey&); | 27 bool writeCryptoKey(const WebCryptoKey&); |
27 | 28 |
28 private: | 29 private: |
29 void doWriteHmacKey(const WebCryptoKey&); | 30 void doWriteHmacKey(const WebCryptoKey&); |
30 void doWriteAesKey(const WebCryptoKey&); | 31 void doWriteAesKey(const WebCryptoKey&); |
31 void doWriteRsaHashedKey(const WebCryptoKey&); | 32 void doWriteRsaHashedKey(const WebCryptoKey&); |
32 void doWriteEcKey(const WebCryptoKey&); | 33 void doWriteEcKey(const WebCryptoKey&); |
33 void doWriteKeyWithoutParams(const WebCryptoKey&); | 34 void doWriteKeyWithoutParams(const WebCryptoKey&); |
34 void doWriteAlgorithmId(WebCryptoAlgorithmId); | 35 void doWriteAlgorithmId(WebCryptoAlgorithmId); |
35 void doWriteAsymmetricKeyType(WebCryptoKeyType); | 36 void doWriteAsymmetricKeyType(WebCryptoKeyType); |
(...skipping 27 matching lines...) Expand all Loading... |
63 bool doReadNamedCurve(WebCryptoNamedCurve&); | 64 bool doReadNamedCurve(WebCryptoNamedCurve&); |
64 bool doReadKeyUsages(WebCryptoKeyUsageMask& usages, bool& extractable); | 65 bool doReadKeyUsages(WebCryptoKeyUsageMask& usages, bool& extractable); |
65 }; | 66 }; |
66 | 67 |
67 DEFINE_TYPE_CASTS(SerializedScriptValueReaderForModules, SerializedScriptValueRe
ader, reader, true, true); | 68 DEFINE_TYPE_CASTS(SerializedScriptValueReaderForModules, SerializedScriptValueRe
ader, reader, true, true); |
68 | 69 |
69 class ScriptValueSerializerForModules final : public ScriptValueSerializer { | 70 class ScriptValueSerializerForModules final : public ScriptValueSerializer { |
70 STACK_ALLOCATED(); | 71 STACK_ALLOCATED(); |
71 WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules); | 72 WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules); |
72 public: | 73 public: |
73 ScriptValueSerializerForModules(SerializedScriptValueWriter&, const Transfer
ables*, WebBlobInfoArray*, BlobDataHandleMap&, v8::TryCatch&, ScriptState*); | 74 ScriptValueSerializerForModules(SerializedScriptValueWriter&, Transferables*
, WebBlobInfoArray*, BlobDataHandleMap&, v8::TryCatch&, ScriptState*); |
74 | 75 |
75 private: | 76 private: |
76 ScriptValueSerializer::StateBase* doSerializeValue(v8::Local<v8::Value>, Scr
iptValueSerializer::StateBase* next) override; | 77 ScriptValueSerializer::StateBase* doSerializeValue(v8::Local<v8::Value>, Scr
iptValueSerializer::StateBase* next) override; |
77 | 78 |
78 ScriptValueSerializer::StateBase* writeDOMFileSystem(v8::Local<v8::Value>, S
criptValueSerializer::StateBase* next); | 79 ScriptValueSerializer::StateBase* writeDOMFileSystem(v8::Local<v8::Value>, S
criptValueSerializer::StateBase* next); |
| 80 ScriptValueSerializer::StateBase* writeTransferredOffscreenCanvas(v8::Local<
v8::Value>, uint32_t index, ScriptValueSerializer::StateBase* next); |
79 bool writeCryptoKey(v8::Local<v8::Value>); | 81 bool writeCryptoKey(v8::Local<v8::Value>); |
| 82 typedef V8ObjectMap<v8::Object, uint32_t> ObjectPool; |
| 83 ObjectPool m_transferredOffscreenCanvas; |
| 84 SerializedScriptValueWriter& m_writer; |
80 }; | 85 }; |
81 | 86 |
82 class ScriptValueDeserializerForModules final : public ScriptValueDeserializer { | 87 class ScriptValueDeserializerForModules final : public ScriptValueDeserializer { |
83 STACK_ALLOCATED(); | 88 STACK_ALLOCATED(); |
84 WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules); | 89 WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules); |
85 public: | 90 public: |
86 ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules&, Me
ssagePortArray* messagePorts, ArrayBufferContentsArray*, ImageBitmapContentsArra
y*); | 91 ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules&, Me
ssagePortArray* messagePorts, ArrayBufferContentsArray*, ImageBitmapContentsArra
y*); |
| 92 bool tryGetTransferredOffscreenCanvas(uint32_t index, uint32_t width, uint32
_t height, uint32_t id, v8::Local<v8::Value>*) override; |
87 | 93 |
88 private: | 94 private: |
89 bool read(v8::Local<v8::Value>*) override; | 95 bool read(v8::Local<v8::Value>*) override; |
| 96 SerializedScriptValueReader& m_reader; |
90 }; | 97 }; |
91 | 98 |
92 } // namespace blink | 99 } // namespace blink |
93 | 100 |
94 #endif // ScriptValueSerializerForModules_h | 101 #endif // ScriptValueSerializerForModules_h |
OLD | NEW |