| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Following 4 methods are expected to be called by SerializedScriptValue. | 31 // Following 4 methods are expected to be called by SerializedScriptValue. |
| 32 | 32 |
| 33 // If a serialization error occurs (e.g., cyclic input value) this | 33 // If a serialization error occurs (e.g., cyclic input value) this |
| 34 // function returns an empty representation, schedules a V8 exception to | 34 // function returns an empty representation, schedules a V8 exception to |
| 35 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case | 35 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case |
| 36 // the caller must not invoke any V8 operations until control returns to | 36 // the caller must not invoke any V8 operations until control returns to |
| 37 // V8. When serialization is successful, |didThrow| is false. | 37 // V8. When serialization is successful, |didThrow| is false. |
| 38 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8:
:Value>, Transferables*, WebBlobInfoArray*, ExceptionState&); | 38 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8:
:Value>, Transferables*, WebBlobInfoArray*, ExceptionState&); |
| 39 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
SerializedScriptValueWriter&, Transferables*, WebBlobInfoArray*, ExceptionState
&); | 39 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
SerializedScriptValueWriter&, Transferables*, WebBlobInfoArray*, ExceptionState
&); |
| 40 PassRefPtr<SerializedScriptValue> create(const String&); | |
| 41 | 40 |
| 42 v8::Local<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, Messa
gePortArray*, const WebBlobInfoArray*); | 41 v8::Local<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, Messa
gePortArray*, const WebBlobInfoArray*); |
| 43 | 42 |
| 44 // Following methods are expected to be called in SerializedScriptValueFacto
ry{ForModules}. | 43 // Following methods are expected to be called in SerializedScriptValueFacto
ry{ForModules}. |
| 45 SerializedScriptValueFactory() { } | 44 SerializedScriptValueFactory() { } |
| 46 virtual ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, Seri
alizedScriptValueWriter&, Transferables*, WebBlobInfoArray*, BlobDataHandleMap&,
v8::TryCatch&, String& errorMessage, v8::Isolate*); | 45 virtual ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, Seri
alizedScriptValueWriter&, Transferables*, WebBlobInfoArray*, BlobDataHandleMap&,
v8::TryCatch&, String& errorMessage, v8::Isolate*); |
| 47 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl
obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate
*, MessagePortArray* messagePorts, const WebBlobInfoArray*); | 46 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl
obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate
*, MessagePortArray* messagePorts, const WebBlobInfoArray*); |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 static SerializedScriptValueFactory& instance() | 49 static SerializedScriptValueFactory& instance() |
| 51 { | 50 { |
| 52 if (!m_instance) { | 51 if (!m_instance) { |
| 53 NOTREACHED(); | 52 NOTREACHED(); |
| 54 m_instance = new SerializedScriptValueFactory; | 53 m_instance = new SerializedScriptValueFactory; |
| 55 } | 54 } |
| 56 return *m_instance; | 55 return *m_instance; |
| 57 } | 56 } |
| 58 | 57 |
| 59 void transferData(SerializedScriptValue*, SerializedScriptValueWriter&, Tran
sferables*, ExceptionState&, v8::Isolate*); | 58 void transferData(SerializedScriptValue*, SerializedScriptValueWriter&, Tran
sferables*, ExceptionState&, v8::Isolate*); |
| 60 | 59 |
| 61 static SerializedScriptValueFactory* m_instance; | 60 static SerializedScriptValueFactory* m_instance; |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 } // namespace blink | 63 } // namespace blink |
| 65 | 64 |
| 66 #endif // SerializedScriptValueFactory_h | 65 #endif // SerializedScriptValueFactory_h |
| OLD | NEW |