| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SerializedScriptValueFactory_h | 5 #ifndef SerializedScriptValueFactory_h |
| 6 #define SerializedScriptValueFactory_h | 6 #define SerializedScriptValueFactory_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptValueSerializer.h" | 8 #include "bindings/core/v8/ScriptValueSerializer.h" |
| 9 #include "bindings/core/v8/SerializedScriptValue.h" | 9 #include "bindings/core/v8/SerializedScriptValue.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class CORE_EXPORT SerializedScriptValueFactory { | 16 class CORE_EXPORT SerializedScriptValueFactory { |
| 17 WTF_MAKE_NONCOPYABLE(SerializedScriptValueFactory); | 17 WTF_MAKE_NONCOPYABLE(SerializedScriptValueFactory); |
| 18 USING_FAST_MALLOC(SerializedScriptValueFactory); | 18 USING_FAST_MALLOC(SerializedScriptValueFactory); |
| 19 public: | 19 public: |
| 20 SerializedScriptValueFactory() { } | 20 SerializedScriptValueFactory() { } |
| 21 | 21 |
| 22 // If a serialization error occurs (e.g., cyclic input value) this | 22 // If a serialization error occurs (e.g., cyclic input value) this |
| 23 // function returns an empty representation, schedules a V8 exception to | 23 // function returns an empty representation, schedules a V8 exception to |
| 24 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case | 24 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case |
| 25 // the caller must not invoke any V8 operations until control returns to | 25 // the caller must not invoke any V8 operations until control returns to |
| 26 // V8. When serialization is successful, |didThrow| is false. | 26 // V8. When serialization is successful, |didThrow| is false. |
| 27 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8:
:Value>, Transferables*, WebBlobInfoArray*, ExceptionState&); | 27 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8:
:Value>, Transferables*, WebBlobInfoArray*, ExceptionState&); |
| 28 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
SerializedScriptValueWriter&, Transferables*, WebBlobInfoArray*, ExceptionState
&); | 28 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
SerializedScriptValueWriter&, Transferables*, WebBlobInfoArray*, ExceptionState
&); |
| 29 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
Transferables*, ExceptionState&); | 29 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
Transferables*, ExceptionState&); |
| 30 PassRefPtr<SerializedScriptValue> createFromWire(const String&); | |
| 31 PassRefPtr<SerializedScriptValue> createFromWireBytes(const char* data, size
_t length); | |
| 32 PassRefPtr<SerializedScriptValue> create(const String&); | 30 PassRefPtr<SerializedScriptValue> create(const String&); |
| 33 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const String&
); | |
| 34 PassRefPtr<SerializedScriptValue> create(); | |
| 35 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const ScriptValue&, W
ebBlobInfoArray*, ExceptionState&); | 31 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const ScriptValue&, W
ebBlobInfoArray*, ExceptionState&); |
| 36 | 32 |
| 37 // Never throws exceptions. | 33 // Never throws exceptions. |
| 38 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v
8::Local<v8::Value>); | 34 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v
8::Local<v8::Value>); |
| 39 | 35 |
| 40 v8::Local<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, Messa
gePortArray*, const WebBlobInfoArray*); | 36 v8::Local<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, Messa
gePortArray*, const WebBlobInfoArray*); |
| 41 | 37 |
| 42 static SerializedScriptValueFactory& instance() | 38 static SerializedScriptValueFactory& instance() |
| 43 { | 39 { |
| 44 if (!m_instance) { | 40 if (!m_instance) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 | 59 |
| 64 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl
obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate
*, MessagePortArray* messagePorts, const WebBlobInfoArray*); | 60 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl
obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate
*, MessagePortArray* messagePorts, const WebBlobInfoArray*); |
| 65 | 61 |
| 66 private: | 62 private: |
| 67 static SerializedScriptValueFactory* m_instance; | 63 static SerializedScriptValueFactory* m_instance; |
| 68 }; | 64 }; |
| 69 | 65 |
| 70 } // namespace blink | 66 } // namespace blink |
| 71 | 67 |
| 72 #endif // SerializedScriptValueFactory_h | 68 #endif // SerializedScriptValueFactory_h |
| OLD | NEW |