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); | |
27 bool writeCryptoKey(const WebCryptoKey&); | 26 bool writeCryptoKey(const WebCryptoKey&); |
28 | 27 |
29 private: | 28 private: |
30 void doWriteHmacKey(const WebCryptoKey&); | 29 void doWriteHmacKey(const WebCryptoKey&); |
31 void doWriteAesKey(const WebCryptoKey&); | 30 void doWriteAesKey(const WebCryptoKey&); |
32 void doWriteRsaHashedKey(const WebCryptoKey&); | 31 void doWriteRsaHashedKey(const WebCryptoKey&); |
33 void doWriteEcKey(const WebCryptoKey&); | 32 void doWriteEcKey(const WebCryptoKey&); |
34 void doWriteKeyWithoutParams(const WebCryptoKey&); | 33 void doWriteKeyWithoutParams(const WebCryptoKey&); |
35 void doWriteAlgorithmId(WebCryptoAlgorithmId); | 34 void doWriteAlgorithmId(WebCryptoAlgorithmId); |
36 void doWriteAsymmetricKeyType(WebCryptoKeyType); | 35 void doWriteAsymmetricKeyType(WebCryptoKeyType); |
(...skipping 27 matching lines...) Expand all Loading... |
64 bool doReadNamedCurve(WebCryptoNamedCurve&); | 63 bool doReadNamedCurve(WebCryptoNamedCurve&); |
65 bool doReadKeyUsages(WebCryptoKeyUsageMask& usages, bool& extractable); | 64 bool doReadKeyUsages(WebCryptoKeyUsageMask& usages, bool& extractable); |
66 }; | 65 }; |
67 | 66 |
68 DEFINE_TYPE_CASTS(SerializedScriptValueReaderForModules, SerializedScriptValueRe
ader, reader, true, true); | 67 DEFINE_TYPE_CASTS(SerializedScriptValueReaderForModules, SerializedScriptValueRe
ader, reader, true, true); |
69 | 68 |
70 class ScriptValueSerializerForModules final : public ScriptValueSerializer { | 69 class ScriptValueSerializerForModules final : public ScriptValueSerializer { |
71 STACK_ALLOCATED(); | 70 STACK_ALLOCATED(); |
72 WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules); | 71 WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules); |
73 public: | 72 public: |
74 ScriptValueSerializerForModules(SerializedScriptValueWriter&, Transferables*
, WebBlobInfoArray*, BlobDataHandleMap&, v8::TryCatch&, ScriptState*); | 73 ScriptValueSerializerForModules(SerializedScriptValueWriter&, const Transfer
ables*, WebBlobInfoArray*, BlobDataHandleMap&, v8::TryCatch&, ScriptState*); |
75 | 74 |
76 private: | 75 private: |
77 ScriptValueSerializer::StateBase* doSerializeValue(v8::Local<v8::Value>, Scr
iptValueSerializer::StateBase* next) override; | 76 ScriptValueSerializer::StateBase* doSerializeValue(v8::Local<v8::Value>, Scr
iptValueSerializer::StateBase* next) override; |
78 | 77 |
79 ScriptValueSerializer::StateBase* writeDOMFileSystem(v8::Local<v8::Value>, S
criptValueSerializer::StateBase* next); | 78 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); | |
81 bool writeCryptoKey(v8::Local<v8::Value>); | 79 bool writeCryptoKey(v8::Local<v8::Value>); |
82 typedef V8ObjectMap<v8::Object, uint32_t> ObjectPool; | |
83 ObjectPool m_transferredOffscreenCanvas; | |
84 SerializedScriptValueWriter& m_writer; | |
85 }; | 80 }; |
86 | 81 |
87 class ScriptValueDeserializerForModules final : public ScriptValueDeserializer { | 82 class ScriptValueDeserializerForModules final : public ScriptValueDeserializer { |
88 STACK_ALLOCATED(); | 83 STACK_ALLOCATED(); |
89 WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules); | 84 WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules); |
90 public: | 85 public: |
91 ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules&, Me
ssagePortArray* messagePorts, ArrayBufferContentsArray*, ImageBitmapContentsArra
y*); | 86 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; | |
93 | 87 |
94 private: | 88 private: |
95 bool read(v8::Local<v8::Value>*) override; | 89 bool read(v8::Local<v8::Value>*) override; |
96 SerializedScriptValueReader& m_reader; | |
97 }; | 90 }; |
98 | 91 |
99 } // namespace blink | 92 } // namespace blink |
100 | 93 |
101 #endif // ScriptValueSerializerForModules_h | 94 #endif // ScriptValueSerializerForModules_h |
OLD | NEW |