Chromium Code Reviews| Index: Source/bindings/modules/v8/ScriptValueSerializerForModules.h |
| diff --git a/Source/bindings/modules/v8/ScriptValueSerializerForModules.h b/Source/bindings/modules/v8/ScriptValueSerializerForModules.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fc6ecf1aa2f437933b0121255ccd4ca5f2994ea5 |
| --- /dev/null |
| +++ b/Source/bindings/modules/v8/ScriptValueSerializerForModules.h |
| @@ -0,0 +1,96 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ScriptValueSerializerForModules_h |
| +#define ScriptValueSerializerForModules_h |
| + |
| +#include "bindings/core/v8/ScriptValueSerializer.h" |
| +#include "public/platform/WebCrypto.h" |
| +#include "public/platform/WebCryptoKey.h" |
| +#include "public/platform/WebCryptoKeyAlgorithm.h" |
| +#include <v8.h> |
| + |
| +namespace blink { |
| + |
| +namespace SerializedScriptValueInternal { |
| + |
| +class WriterForModules final : public Writer { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(WriterForModules); |
| +public: |
| + WriterForModules() |
| + : Writer() |
| + { |
| + } |
| + |
| + void writeDOMFileSystem(int type, const String& name, const String& url); |
| + bool writeCryptoKey(const WebCryptoKey&); |
|
tasak
2014/11/14 08:07:39
DOMFileSystem and Crypto related code are implemen
|
| + |
| +private: |
| + void doWriteHmacKey(const WebCryptoKey&); |
| + void doWriteAesKey(const WebCryptoKey&); |
| + void doWriteRsaHashedKey(const WebCryptoKey&); |
| + void doWriteEcKey(const WebCryptoKey&); |
| + void doWriteAlgorithmId(WebCryptoAlgorithmId); |
| + void doWriteAsymmetricKeyType(WebCryptoKeyType); |
| + void doWriteNamedCurve(WebCryptoNamedCurve); |
| + void doWriteKeyUsages(const WebCryptoKeyUsageMask usages, bool extractable); |
| +}; |
| + |
| +DEFINE_TYPE_CASTS(WriterForModules, Writer, writer, true, true); |
| + |
| +class ReaderForModules final : public Reader { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(ReaderForModules); |
| +public: |
| + ReaderForModules(const uint8_t* buffer, int length, const WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, ScriptState* scriptState) |
| + : Reader(buffer, length, blobInfo, blobDataHandles, scriptState) |
| + { |
| + } |
| + |
| + virtual bool read(v8::Handle<v8::Value>*, CompositeCreator&) override; |
| + |
| +private: |
| + bool readDOMFileSystem(v8::Handle<v8::Value>*); |
| + bool readCryptoKey(v8::Handle<v8::Value>*); |
| + bool doReadHmacKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| + bool doReadAesKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| + bool doReadRsaHashedKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| + bool doReadEcKey(WebCryptoKeyAlgorithm&, WebCryptoKeyType&); |
| + bool doReadAlgorithmId(WebCryptoAlgorithmId&); |
| + bool doReadAsymmetricKeyType(WebCryptoKeyType&); |
| + bool doReadNamedCurve(WebCryptoNamedCurve&); |
| + bool doReadKeyUsages(WebCryptoKeyUsageMask& usages, bool& extractable); |
| +}; |
| + |
| +class SerializerForModules final : public Serializer { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(SerializerForModules); |
| +public: |
| + SerializerForModules(WriterForModules&, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*); |
| + |
| + Serializer::StateBase* doSerialize(v8::Handle<v8::Value>, Serializer::StateBase* 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.
|
| + |
| +private: |
| + Serializer::StateBase* writeDOMFileSystem(v8::Handle<v8::Value>, Serializer::StateBase* next); |
| + bool writeCryptoKey(v8::Handle<v8::Value>); |
| +}; |
| + |
| +class DeserializerForModules final : public Deserializer { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(DeserializerForModules); |
| +public: |
| + DeserializerForModules(ReaderForModules&, MessagePortArray* messagePorts, ArrayBufferContentsArray*); |
| + |
| +private: |
| + virtual bool read(v8::Local<v8::Value>*) override; |
| +}; |
| + |
| +DEFINE_TYPE_CASTS(ReaderForModules, Reader, reader, true, true); |
| + |
| +} // namespace SerializedScriptValueInternal |
| + |
| +} // namespace blink |
| + |
| +#endif // ScriptValueSerializerForModules_h |