| 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..6602bd4b72ad6d9aea5eeef446bf1e50d898aacb
|
| --- /dev/null
|
| +++ b/Source/bindings/core/v8/SerializedScriptValueFactory.h
|
| @@ -0,0 +1,58 @@
|
| +// 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& 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;
|
| + }
|
| +
|
| +private:
|
| + static SerializedScriptValueFactory* m_instance;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // SerializedScriptValueFactory_h
|
| +
|
|
|