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

Unified Diff: Source/bindings/core/v8/SerializedScriptValueFactory.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/core/v8/SerializedScriptValueFactory.h
diff --git a/Source/bindings/core/v8/SerializedScriptValueFactory.h b/Source/bindings/core/v8/SerializedScriptValueFactory.h
new file mode 100644
index 0000000000000000000000000000000000000000..49d136007a187b17685625ea81c29ae57f9373fc
--- /dev/null
+++ b/Source/bindings/core/v8/SerializedScriptValueFactory.h
@@ -0,0 +1,69 @@
+// 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 SerializedScriptValueFactory_h
+#define SerializedScriptValueFactory_h
+
+#include "bindings/core/v8/ScriptValueSerializer.h"
+#include "bindings/core/v8/SerializedScriptValue.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class SerializedScriptValueFactory {
+ WTF_MAKE_NONCOPYABLE(SerializedScriptValueFactory);
+public:
+ SerializedScriptValueFactory() { }
+
+ // If a serialization error occurs (e.g., cyclic input value) this
+ // function returns an empty representation, schedules a V8 exception to
+ // be thrown using v8::ThrowException(), and sets |didThrow|. In this case
+ // the caller must not invoke any V8 operations until control returns to
+ // V8. When serialization is successful, |didThrow| is false.
+ virtual PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferArray*, WebBlobInfoArray*, ExceptionState&, v8::Isolate*);
+ PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferArray*, ExceptionState&, v8::Isolate*);
+ PassRefPtr<SerializedScriptValue> createFromWire(const String&);
+ PassRefPtr<SerializedScriptValue> createFromWireBytes(const Vector<uint8_t>&);
+ PassRefPtr<SerializedScriptValue> create(const String&);
+ virtual PassRefPtr<SerializedScriptValue> create(const String&, v8::Isolate*);
+ PassRefPtr<SerializedScriptValue> create();
+ PassRefPtr<SerializedScriptValue> create(const ScriptValue&, WebBlobInfoArray*, ExceptionState&, v8::Isolate*);
+
+ // Never throws exceptions.
+ PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v8::Handle<v8::Value>);
+
+ v8::Handle<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, MessagePortArray*, const WebBlobInfoArray*);
+
+ static SerializedScriptValueFactory& instance()
+ {
+ if (!m_instance) {
+ ASSERT_NOT_REACHED();
+ m_instance = new SerializedScriptValueFactory();
+ }
+ return *m_instance;
+ }
+
+ // SerializedScriptValueFactory::initialize() should be invoked when Blink is initialized,
+ // i.e. initializeWithoutV8() in WebKit.cpp.
+ static void initialize(SerializedScriptValueFactory* newFactory)
+ {
+ ASSERT(!m_instance);
+ m_instance = newFactory;
+ }
+
+protected:
+ ScriptValueSerializer::Status doSerialize(v8::Handle<v8::Value>, SerializedScriptValueWriter&, MessagePortArray*, ArrayBufferArray*, WebBlobInfoArray*, SerializedScriptValue*, v8::TryCatch&, String& errorMessage, v8::Isolate*);
+ virtual ScriptValueSerializer::Status doSerialize(v8::Handle<v8::Value>, SerializedScriptValueWriter&, MessagePortArray*, ArrayBufferArray*, WebBlobInfoArray*, BlobDataHandleMap&, v8::TryCatch&, String& errorMessage, v8::Isolate*);
+ void transferData(SerializedScriptValue*, SerializedScriptValueWriter&, ArrayBufferArray*, ExceptionState&, v8::Isolate*);
+
+ virtual v8::Handle<v8::Value> deserialize(String& data, BlobDataHandleMap& blobDataHandles, ArrayBufferContentsArray*, v8::Isolate*, MessagePortArray* messagePorts, const WebBlobInfoArray*);
+
+private:
+ static SerializedScriptValueFactory* m_instance;
+};
+
+} // namespace blink
+
+#endif // SerializedScriptValueFactory_h
+
« no previous file with comments | « Source/bindings/core/v8/SerializedScriptValue.cpp ('k') | Source/bindings/core/v8/SerializedScriptValueFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698