Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: Source/bindings/modules/v8/ScriptValueSerializerForModules.h

Issue 718383003: bindings: fixed incorrect dependency of SerializedScriptValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added fast/js/structured-clone.html Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..16fbf74c30833e59737bfa3d2d4c6b0cd4fff4e2
--- /dev/null
+++ b/Source/bindings/modules/v8/ScriptValueSerializerForModules.h
@@ -0,0 +1,92 @@
+// 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 {
+
+class SerializedScriptValueWriterForModules final : public SerializedScriptValueWriter {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(SerializedScriptValueWriterForModules);
+public:
+ SerializedScriptValueWriterForModules()
+ : SerializedScriptValueWriter()
+ {
+ }
+
+ void writeDOMFileSystem(int type, const String& name, const String& url);
+ bool writeCryptoKey(const WebCryptoKey&);
+
+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(SerializedScriptValueWriterForModules, SerializedScriptValueWriter, writer, true, true);
+
+class SerializedScriptValueReaderForModules final : public SerializedScriptValueReader {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(SerializedScriptValueReaderForModules);
+public:
+ SerializedScriptValueReaderForModules(const uint8_t* buffer, int length, const WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, ScriptState* scriptState)
+ : SerializedScriptValueReader(buffer, length, blobInfo, blobDataHandles, scriptState)
+ {
+ }
+
+ virtual bool read(v8::Handle<v8::Value>*, ScriptValueCompositeCreator&) 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);
+};
+
+DEFINE_TYPE_CASTS(SerializedScriptValueReaderForModules, SerializedScriptValueReader, reader, true, true);
+
+class ScriptValueSerializerForModules final : public ScriptValueSerializer {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(ScriptValueSerializerForModules);
+public:
+ ScriptValueSerializerForModules(SerializedScriptValueWriter&, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*);
+
+private:
+ virtual ScriptValueSerializer::StateBase* doSerializeValue(v8::Handle<v8::Value>, ScriptValueSerializer::StateBase* next) override;
+
+ ScriptValueSerializer::StateBase* writeDOMFileSystem(v8::Handle<v8::Value>, ScriptValueSerializer::StateBase* next);
+ bool writeCryptoKey(v8::Handle<v8::Value>);
+};
+
+class ScriptValueDeserializerForModules final : public ScriptValueDeserializer {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(ScriptValueDeserializerForModules);
+public:
+ ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules&, MessagePortArray* messagePorts, ArrayBufferContentsArray*);
+
+private:
+ virtual bool read(v8::Local<v8::Value>*) override;
+};
+
+} // namespace blink
+
+#endif // ScriptValueSerializerForModules_h

Powered by Google App Engine
This is Rietveld 408576698