| 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 "modules/peerconnection/RTCCertificate.h" | 9 #include "modules/peerconnection/RTCCertificate.h" |
| 10 #include "public/platform/WebCrypto.h" | 10 #include "public/platform/WebCrypto.h" |
| 11 #include "public/platform/WebCryptoKey.h" | 11 #include "public/platform/WebCryptoKey.h" |
| 12 #include "public/platform/WebCryptoKeyAlgorithm.h" | 12 #include "public/platform/WebCryptoKeyAlgorithm.h" |
| 13 #include <v8.h> | 13 #include <v8.h> |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class SerializedScriptValueWriterForModules final | 17 class SerializedScriptValueWriterForModules final |
| 18 : public SerializedScriptValueWriter { | 18 : public SerializedScriptValueWriter { |
| 19 STACK_ALLOCATED(); | 19 STACK_ALLOCATED(); |
| 20 WTF_MAKE_NONCOPYABLE(SerializedScriptValueWriterForModules); | 20 WTF_MAKE_NONCOPYABLE(SerializedScriptValueWriterForModules); |
| 21 | 21 |
| 22 public: | 22 public: |
| 23 SerializedScriptValueWriterForModules() : SerializedScriptValueWriter() {} | 23 SerializedScriptValueWriterForModules() : SerializedScriptValueWriter() {} |
| 24 | 24 |
| 25 void writeDOMFileSystem(int type, const String& name, const String& url); | 25 void writeFileSystem(int type, const String& name, const String& url); |
| 26 bool writeCryptoKey(const WebCryptoKey&); | 26 bool writeCryptoKey(const WebCryptoKey&); |
| 27 void writeRTCCertificate(const RTCCertificate&); | 27 void writeRTCCertificate(const RTCCertificate&); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 void doWriteHmacKey(const WebCryptoKey&); | 30 void doWriteHmacKey(const WebCryptoKey&); |
| 31 void doWriteAesKey(const WebCryptoKey&); | 31 void doWriteAesKey(const WebCryptoKey&); |
| 32 void doWriteRsaHashedKey(const WebCryptoKey&); | 32 void doWriteRsaHashedKey(const WebCryptoKey&); |
| 33 void doWriteEcKey(const WebCryptoKey&); | 33 void doWriteEcKey(const WebCryptoKey&); |
| 34 void doWriteKeyWithoutParams(const WebCryptoKey&); | 34 void doWriteKeyWithoutParams(const WebCryptoKey&); |
| 35 void doWriteAlgorithmId(WebCryptoAlgorithmId); | 35 void doWriteAlgorithmId(WebCryptoAlgorithmId); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 ScriptState* scriptState) | 57 ScriptState* scriptState) |
| 58 : SerializedScriptValueReader(buffer, | 58 : SerializedScriptValueReader(buffer, |
| 59 length, | 59 length, |
| 60 blobInfo, | 60 blobInfo, |
| 61 blobDataHandles, | 61 blobDataHandles, |
| 62 scriptState) {} | 62 scriptState) {} |
| 63 | 63 |
| 64 bool read(v8::Local<v8::Value>*, ScriptValueDeserializer&) override; | 64 bool read(v8::Local<v8::Value>*, ScriptValueDeserializer&) override; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 bool readDOMFileSystem(v8::Local<v8::Value>*); | 67 bool readFileSystem(v8::Local<v8::Value>*); |
| 68 bool readCryptoKey(v8::Local<v8::Value>*); | 68 bool readCryptoKey(v8::Local<v8::Value>*); |
| 69 bool readRTCCertificate(v8::Local<v8::Value>*); | 69 bool readRTCCertificate(v8::Local<v8::Value>*); |
| 70 bool doReadHmacKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | 70 bool doReadHmacKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| 71 bool doReadAesKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | 71 bool doReadAesKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| 72 bool doReadRsaHashedKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | 72 bool doReadRsaHashedKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| 73 bool doReadEcKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | 73 bool doReadEcKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| 74 bool doReadKeyWithoutParams(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | 74 bool doReadKeyWithoutParams(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| 75 bool doReadAlgorithmId(WebCryptoAlgorithmId&); | 75 bool doReadAlgorithmId(WebCryptoAlgorithmId&); |
| 76 bool doReadAsymmetricKeyType(WebCryptoKeyType&); | 76 bool doReadAsymmetricKeyType(WebCryptoKeyType&); |
| 77 bool doReadNamedCurve(WebCryptoNamedCurve&); | 77 bool doReadNamedCurve(WebCryptoNamedCurve&); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules); | 89 WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules); |
| 90 | 90 |
| 91 public: | 91 public: |
| 92 ScriptValueSerializerForModules(SerializedScriptValueWriter&, | 92 ScriptValueSerializerForModules(SerializedScriptValueWriter&, |
| 93 WebBlobInfoArray*, | 93 WebBlobInfoArray*, |
| 94 ScriptState*); | 94 ScriptState*); |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 StateBase* doSerializeObject(v8::Local<v8::Object>, StateBase* next) override; | 97 StateBase* doSerializeObject(v8::Local<v8::Object>, StateBase* next) override; |
| 98 | 98 |
| 99 StateBase* writeDOMFileSystem(v8::Local<v8::Value>, StateBase* next); | 99 StateBase* writeFileSystem(v8::Local<v8::Value>, StateBase* next); |
| 100 bool writeCryptoKey(v8::Local<v8::Value>); | 100 bool writeCryptoKey(v8::Local<v8::Value>); |
| 101 StateBase* writeRTCCertificate(v8::Local<v8::Value>, StateBase* next); | 101 StateBase* writeRTCCertificate(v8::Local<v8::Value>, StateBase* next); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 class ScriptValueDeserializerForModules final : public ScriptValueDeserializer { | 104 class ScriptValueDeserializerForModules final : public ScriptValueDeserializer { |
| 105 STACK_ALLOCATED(); | 105 STACK_ALLOCATED(); |
| 106 WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules); | 106 WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules); |
| 107 | 107 |
| 108 public: | 108 public: |
| 109 ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules&, | 109 ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules&, |
| 110 MessagePortArray* messagePorts, | 110 MessagePortArray* messagePorts, |
| 111 ArrayBufferContentsArray*, | 111 ArrayBufferContentsArray*, |
| 112 ImageBitmapContentsArray*); | 112 ImageBitmapContentsArray*); |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 bool read(v8::Local<v8::Value>*) override; | 115 bool read(v8::Local<v8::Value>*) override; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace blink | 118 } // namespace blink |
| 119 | 119 |
| 120 #endif // ScriptValueSerializerForModules_h | 120 #endif // ScriptValueSerializerForModules_h |
| OLD | NEW |