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

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: 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..94d6a08445015702c0b2e1bb6f68fb386ae0d58e
--- /dev/null
+++ b/Source/bindings/core/v8/SerializedScriptValueFactory.h
@@ -0,0 +1,54 @@
+// 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/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*, ExceptionState&, v8::Isolate*);
+ virtual 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*);
+ virtual PassRefPtr<SerializedScriptValue> create();
+ virtual PassRefPtr<SerializedScriptValue> create(const ScriptValue&, WebBlobInfoArray*, ExceptionState&, v8::Isolate*);
+
+ // Never throws exceptions.
+ PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v8::Handle<v8::Value>);
+
+ static SerializedScriptValueFactory& factory()
+ {
haraken 2014/11/17 01:27:49 Shouldn't this be ASSERT_NOT_REACHED()? I guess S
tasak 2014/11/17 08:42:30 Done.
+ if (!m_singleton)
+ m_singleton = new SerializedScriptValueFactory();
+ return *m_singleton;
+ }
+
+ static void initialize(SerializedScriptValueFactory* newFactory)
tasak 2014/11/14 08:07:39 initialize is invoked when Blink is initlized. i.e
haraken 2014/11/17 01:27:50 Add a comment about this behavior.
tasak 2014/11/17 08:42:30 Done.
+ {
+ ASSERT(!m_singleton);
+ m_singleton = newFactory;
+ }
+
+private:
+ static SerializedScriptValueFactory* m_singleton;
+};
+
+} // namespace blink
+
+#endif // SerializedScriptValueFactory_h
+

Powered by Google App Engine
This is Rietveld 408576698