| 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/SerializedScriptValue.h" | 8 #include "bindings/core/v8/SerializedScriptValue.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 protected: | 27 protected: |
| 28 friend class SerializedScriptValue; | 28 friend class SerializedScriptValue; |
| 29 | 29 |
| 30 // Following 2 methods are expected to be called by SerializedScriptValue. | 30 // Following 2 methods are expected to be called by SerializedScriptValue. |
| 31 | 31 |
| 32 // If a serialization error occurs (e.g., cyclic input value) this | 32 // If a serialization error occurs (e.g., cyclic input value) this |
| 33 // function returns an empty representation, schedules a V8 exception to | 33 // function returns an empty representation, schedules a V8 exception to |
| 34 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case | 34 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case |
| 35 // the caller must not invoke any V8 operations until control returns to | 35 // the caller must not invoke any V8 operations until control returns to |
| 36 // V8. When serialization is successful, |didThrow| is false. | 36 // V8. When serialization is successful, |didThrow| is false. |
| 37 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, | 37 virtual PassRefPtr<SerializedScriptValue> create( |
| 38 v8::Local<v8::Value>, | 38 v8::Isolate*, |
| 39 Transferables*, | 39 v8::Local<v8::Value>, |
| 40 WebBlobInfoArray*, | 40 const SerializedScriptValue::SerializeOptions&, |
| 41 ExceptionState&); | 41 ExceptionState&); |
| 42 | 42 |
| 43 virtual v8::Local<v8::Value> deserialize(SerializedScriptValue*, | 43 virtual v8::Local<v8::Value> deserialize( |
| 44 v8::Isolate*, | 44 SerializedScriptValue*, |
| 45 MessagePortArray*, | 45 v8::Isolate*, |
| 46 const WebBlobInfoArray*); | 46 const SerializedScriptValue::DeserializeOptions&); |
| 47 | 47 |
| 48 // Following methods are expected to be called in | 48 // Following methods are expected to be called in |
| 49 // SerializedScriptValueFactory{ForModules}. | 49 // SerializedScriptValueFactory{ForModules}. |
| 50 SerializedScriptValueFactory() {} | 50 SerializedScriptValueFactory() {} |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 static SerializedScriptValueFactory& instance() { | 53 static SerializedScriptValueFactory& instance() { |
| 54 if (!m_instance) { | 54 if (!m_instance) { |
| 55 NOTREACHED(); | 55 NOTREACHED(); |
| 56 m_instance = new SerializedScriptValueFactory; | 56 m_instance = new SerializedScriptValueFactory; |
| 57 } | 57 } |
| 58 return *m_instance; | 58 return *m_instance; |
| 59 } | 59 } |
| 60 | 60 |
| 61 static SerializedScriptValueFactory* m_instance; | 61 static SerializedScriptValueFactory* m_instance; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace blink | 64 } // namespace blink |
| 65 | 65 |
| 66 #endif // SerializedScriptValueFactory_h | 66 #endif // SerializedScriptValueFactory_h |
| OLD | NEW |