| 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 14 matching lines...) Expand all Loading... |
| 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>,
Transferables*, ExceptionState&); | 28 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>,
Transferables*, ExceptionState&); |
| 29 PassRefPtr<SerializedScriptValue> createFromWire(const String&); | 29 PassRefPtr<SerializedScriptValue> createFromWire(const String&); |
| 30 PassRefPtr<SerializedScriptValue> createFromWireBytes(const char* data, size
_t length); | 30 PassRefPtr<SerializedScriptValue> createFromWireBytes(const char* data, size
_t length); |
| 31 PassRefPtr<SerializedScriptValue> create(const String&); | 31 PassRefPtr<SerializedScriptValue> create(const String&); |
| 32 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const String&
); | 32 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const String&
); |
| 33 PassRefPtr<SerializedScriptValue> create(); | 33 PassRefPtr<SerializedScriptValue> create(); |
| 34 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const ScriptValue&, W
ebBlobInfoArray*, ExceptionState&); | 34 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const ScriptValue&, W
ebBlobInfoArray*, ExceptionState&); |
| 35 virtual bool extractTransferables(v8::Isolate*, Transferables&, ExceptionSta
te&, v8::Local<v8::Value>&, unsigned); | |
| 36 virtual Transferables* createTransferables() { return new Transferables; } | |
| 37 | 35 |
| 38 // Never throws exceptions. | 36 // Never throws exceptions. |
| 39 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v
8::Local<v8::Value>); | 37 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v
8::Local<v8::Value>); |
| 40 | 38 |
| 41 v8::Local<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, Messa
gePortArray*, const WebBlobInfoArray*); | 39 v8::Local<v8::Value> deserialize(SerializedScriptValue*, v8::Isolate*, Messa
gePortArray*, const WebBlobInfoArray*); |
| 42 | 40 |
| 43 static SerializedScriptValueFactory& instance() | 41 static SerializedScriptValueFactory& instance() |
| 44 { | 42 { |
| 45 if (!m_instance) { | 43 if (!m_instance) { |
| 46 ASSERT_NOT_REACHED(); | 44 ASSERT_NOT_REACHED(); |
| 47 m_instance = new SerializedScriptValueFactory(); | 45 m_instance = new SerializedScriptValueFactory(); |
| 48 } | 46 } |
| 49 return *m_instance; | 47 return *m_instance; |
| 50 } | 48 } |
| 51 | 49 |
| 52 // SerializedScriptValueFactory::initialize() should be invoked when Blink i
s initialized, | 50 // SerializedScriptValueFactory::initialize() should be invoked when Blink i
s initialized, |
| 53 // i.e. initialize() in WebKit.cpp. | 51 // i.e. initialize() in WebKit.cpp. |
| 54 static void initialize(SerializedScriptValueFactory* newFactory) | 52 static void initialize(SerializedScriptValueFactory* newFactory) |
| 55 { | 53 { |
| 56 ASSERT(!m_instance); | 54 ASSERT(!m_instance); |
| 57 m_instance = newFactory; | 55 m_instance = newFactory; |
| 58 } | 56 } |
| 59 | 57 |
| 60 protected: | 58 protected: |
| 61 ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, SerializedSc
riptValueWriter&, Transferables*, WebBlobInfoArray*, SerializedScriptValue*, v8:
:TryCatch&, String& errorMessage, v8::Isolate*); | 59 ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, SerializedSc
riptValueWriter&, Transferables*, WebBlobInfoArray*, SerializedScriptValue*, v8:
:TryCatch&, String& errorMessage, v8::Isolate*); |
| 62 virtual ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, Seri
alizedScriptValueWriter&, Transferables*, WebBlobInfoArray*, BlobDataHandleMap&,
v8::TryCatch&, String& errorMessage, v8::Isolate*); | 60 virtual ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, Seri
alizedScriptValueWriter&, Transferables*, WebBlobInfoArray*, BlobDataHandleMap&,
v8::TryCatch&, String& errorMessage, v8::Isolate*); |
| 63 virtual void transferData(v8::Isolate*, Transferables*, ExceptionState&, Ser
ializedScriptValue*, SerializedScriptValueWriter&); | 61 void transferData(SerializedScriptValue*, SerializedScriptValueWriter&, Tran
sferables*, ExceptionState&, v8::Isolate*); |
| 64 | 62 |
| 65 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl
obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate
*, MessagePortArray* messagePorts, const WebBlobInfoArray*); | 63 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl
obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate
*, MessagePortArray* messagePorts, const WebBlobInfoArray*); |
| 66 | 64 |
| 67 private: | 65 private: |
| 68 static SerializedScriptValueFactory* m_instance; | 66 static SerializedScriptValueFactory* m_instance; |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 } // namespace blink | 69 } // namespace blink |
| 72 | 70 |
| 73 #endif // SerializedScriptValueFactory_h | 71 #endif // SerializedScriptValueFactory_h |
| OLD | NEW |