Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ScriptValueSerializerForModules_h | |
| 6 #define ScriptValueSerializerForModules_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptValueSerializer.h" | |
| 9 #include "public/platform/WebCrypto.h" | |
| 10 #include "public/platform/WebCryptoKey.h" | |
| 11 #include "public/platform/WebCryptoKeyAlgorithm.h" | |
| 12 #include <v8.h> | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 namespace SerializedScriptValueInternal { | |
| 17 | |
| 18 class WriterForModules final : public Writer { | |
| 19 STACK_ALLOCATED(); | |
| 20 WTF_MAKE_NONCOPYABLE(WriterForModules); | |
| 21 public: | |
| 22 WriterForModules() | |
| 23 : Writer() | |
| 24 { | |
| 25 } | |
| 26 | |
| 27 void writeDOMFileSystem(int type, const String& name, const String& url); | |
| 28 bool writeCryptoKey(const WebCryptoKey&); | |
|
tasak
2014/11/14 08:07:39
DOMFileSystem and Crypto related code are implemen
| |
| 29 | |
| 30 private: | |
| 31 void doWriteHmacKey(const WebCryptoKey&); | |
| 32 void doWriteAesKey(const WebCryptoKey&); | |
| 33 void doWriteRsaHashedKey(const WebCryptoKey&); | |
| 34 void doWriteEcKey(const WebCryptoKey&); | |
| 35 void doWriteAlgorithmId(WebCryptoAlgorithmId); | |
| 36 void doWriteAsymmetricKeyType(WebCryptoKeyType); | |
| 37 void doWriteNamedCurve(WebCryptoNamedCurve); | |
| 38 void doWriteKeyUsages(const WebCryptoKeyUsageMask usages, bool extractable); | |
| 39 }; | |
| 40 | |
| 41 DEFINE_TYPE_CASTS(WriterForModules, Writer, writer, true, true); | |
| 42 | |
| 43 class ReaderForModules final : public Reader { | |
| 44 STACK_ALLOCATED(); | |
| 45 WTF_MAKE_NONCOPYABLE(ReaderForModules); | |
| 46 public: | |
| 47 ReaderForModules(const uint8_t* buffer, int length, const WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, ScriptState* scriptState) | |
| 48 : Reader(buffer, length, blobInfo, blobDataHandles, scriptState) | |
| 49 { | |
| 50 } | |
| 51 | |
| 52 virtual bool read(v8::Handle<v8::Value>*, CompositeCreator&) override; | |
| 53 | |
| 54 private: | |
| 55 bool readDOMFileSystem(v8::Handle<v8::Value>*); | |
| 56 bool readCryptoKey(v8::Handle<v8::Value>*); | |
| 57 bool doReadHmacKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | |
| 58 bool doReadAesKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | |
| 59 bool doReadRsaHashedKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | |
| 60 bool doReadEcKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); | |
| 61 bool doReadAlgorithmId(WebCryptoAlgorithmId&); | |
| 62 bool doReadAsymmetricKeyType(WebCryptoKeyType&); | |
| 63 bool doReadNamedCurve(WebCryptoNamedCurve&); | |
| 64 bool doReadKeyUsages(WebCryptoKeyUsageMask& usages, bool& extractable); | |
| 65 }; | |
| 66 | |
| 67 class SerializerForModules final : public Serializer { | |
| 68 STACK_ALLOCATED(); | |
| 69 WTF_MAKE_NONCOPYABLE(SerializerForModules); | |
| 70 public: | |
| 71 SerializerForModules(WriterForModules&, MessagePortArray* messagePorts, Arra yBufferArray* arrayBuffers, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandle s, v8::TryCatch&, ScriptState*); | |
| 72 | |
| 73 Serializer::StateBase* doSerialize(v8::Handle<v8::Value>, Serializer::StateB ase* next) override; | |
|
haraken
2014/11/17 01:27:50
Add virtual. (I wonder why this doesn't lead to a
tasak
2014/11/17 08:42:30
Done.
| |
| 74 | |
| 75 private: | |
| 76 Serializer::StateBase* writeDOMFileSystem(v8::Handle<v8::Value>, Serializer: :StateBase* next); | |
| 77 bool writeCryptoKey(v8::Handle<v8::Value>); | |
| 78 }; | |
| 79 | |
| 80 class DeserializerForModules final : public Deserializer { | |
| 81 STACK_ALLOCATED(); | |
| 82 WTF_MAKE_NONCOPYABLE(DeserializerForModules); | |
| 83 public: | |
| 84 DeserializerForModules(ReaderForModules&, MessagePortArray* messagePorts, Ar rayBufferContentsArray*); | |
| 85 | |
| 86 private: | |
| 87 virtual bool read(v8::Local<v8::Value>*) override; | |
| 88 }; | |
| 89 | |
| 90 DEFINE_TYPE_CASTS(ReaderForModules, Reader, reader, true, true); | |
| 91 | |
| 92 } // namespace SerializedScriptValueInternal | |
| 93 | |
| 94 } // namespace blink | |
| 95 | |
| 96 #endif // ScriptValueSerializerForModules_h | |
| OLD | NEW |