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 ScriptValueSerializer_h | 5 #ifndef ScriptValueSerializer_h |
6 #define ScriptValueSerializer_h | 6 #define ScriptValueSerializer_h |
7 | 7 |
8 #include "bindings/core/v8/SerializationTag.h" | 8 #include "bindings/core/v8/SerializationTag.h" |
9 #include "bindings/core/v8/SerializedScriptValue.h" | 9 #include "bindings/core/v8/SerializedScriptValue.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 void writeFileListIndex(const Vector<int>& blobIndices); | 136 void writeFileListIndex(const Vector<int>& blobIndices); |
137 void writeArrayBuffer(const DOMArrayBuffer&); | 137 void writeArrayBuffer(const DOMArrayBuffer&); |
138 void writeArrayBufferView(const DOMArrayBufferView&); | 138 void writeArrayBufferView(const DOMArrayBufferView&); |
139 void doWriteImageData(uint32_t width, uint32_t height, const uint8_t* pixelD
ata, uint32_t pixelDataLength); | 139 void doWriteImageData(uint32_t width, uint32_t height, const uint8_t* pixelD
ata, uint32_t pixelDataLength); |
140 void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelDat
a, uint32_t pixelDataLength); | 140 void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelDat
a, uint32_t pixelDataLength); |
141 void writeImageBitmap(uint32_t width, uint32_t height, const uint8_t* pixelD
ata, uint32_t pixelDataLength); | 141 void writeImageBitmap(uint32_t width, uint32_t height, const uint8_t* pixelD
ata, uint32_t pixelDataLength); |
142 void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags); | 142 void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags); |
143 void writeTransferredMessagePort(uint32_t index); | 143 void writeTransferredMessagePort(uint32_t index); |
144 void writeTransferredArrayBuffer(uint32_t index); | 144 void writeTransferredArrayBuffer(uint32_t index); |
145 void writeTransferredImageBitmap(uint32_t index); | 145 void writeTransferredImageBitmap(uint32_t index); |
146 virtual void writeTransferredOffscreenCanvas(uint32_t index, uint32_t width,
uint32_t height, uint32_t id) { }; | |
147 void writeTransferredSharedArrayBuffer(uint32_t index); | 146 void writeTransferredSharedArrayBuffer(uint32_t index); |
148 void writeObjectReference(uint32_t reference); | 147 void writeObjectReference(uint32_t reference); |
149 void writeObject(uint32_t numProperties); | 148 void writeObject(uint32_t numProperties); |
150 void writeSparseArray(uint32_t numProperties, uint32_t length); | 149 void writeSparseArray(uint32_t numProperties, uint32_t length); |
151 void writeDenseArray(uint32_t numProperties, uint32_t length); | 150 void writeDenseArray(uint32_t numProperties, uint32_t length); |
152 String takeWireString(); | 151 String takeWireString(); |
153 void writeReferenceCount(uint32_t numberOfReferences); | 152 void writeReferenceCount(uint32_t numberOfReferences); |
154 void writeGenerateFreshObject(); | 153 void writeGenerateFreshObject(); |
155 void writeGenerateFreshSparseArray(uint32_t length); | 154 void writeGenerateFreshSparseArray(uint32_t length); |
156 void writeGenerateFreshDenseArray(uint32_t length); | 155 void writeGenerateFreshDenseArray(uint32_t length); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 protected: | 201 protected: |
203 class StateBase; | 202 class StateBase; |
204 public: | 203 public: |
205 enum Status { | 204 enum Status { |
206 Success, | 205 Success, |
207 InputError, | 206 InputError, |
208 DataCloneError, | 207 DataCloneError, |
209 JSException | 208 JSException |
210 }; | 209 }; |
211 | 210 |
212 ScriptValueSerializer(SerializedScriptValueWriter&, Transferables*, WebBlobI
nfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*); | 211 ScriptValueSerializer(SerializedScriptValueWriter&, const Transferables*, We
bBlobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*
); |
213 v8::Isolate* isolate() { return m_scriptState->isolate(); } | 212 v8::Isolate* isolate() { return m_scriptState->isolate(); } |
214 v8::Local<v8::Context> context() { return m_scriptState->context(); } | 213 v8::Local<v8::Context> context() { return m_scriptState->context(); } |
215 | 214 |
216 Status serialize(v8::Local<v8::Value>); | 215 Status serialize(v8::Local<v8::Value>); |
217 String errorMessage() { return m_errorMessage; } | 216 String errorMessage() { return m_errorMessage; } |
218 | 217 |
219 protected: | 218 protected: |
220 class StateBase { | 219 class StateBase { |
221 USING_FAST_MALLOC(StateBase); | 220 USING_FAST_MALLOC(StateBase); |
222 WTF_MAKE_NONCOPYABLE(StateBase); | 221 WTF_MAKE_NONCOPYABLE(StateBase); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 ScriptValueCompositeCreator() { } | 458 ScriptValueCompositeCreator() { } |
460 virtual ~ScriptValueCompositeCreator() { } | 459 virtual ~ScriptValueCompositeCreator() { } |
461 | 460 |
462 virtual bool consumeTopOfStack(v8::Local<v8::Value>*) = 0; | 461 virtual bool consumeTopOfStack(v8::Local<v8::Value>*) = 0; |
463 virtual uint32_t objectReferenceCount() = 0; | 462 virtual uint32_t objectReferenceCount() = 0; |
464 virtual void pushObjectReference(const v8::Local<v8::Value>&) = 0; | 463 virtual void pushObjectReference(const v8::Local<v8::Value>&) = 0; |
465 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Local<v
8::Value>*) = 0; | 464 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Local<v
8::Value>*) = 0; |
466 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Local<v8::Valu
e>*) = 0; | 465 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Local<v8::Valu
e>*) = 0; |
467 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Local<v8::Valu
e>*) = 0; | 466 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Local<v8::Valu
e>*) = 0; |
468 virtual bool tryGetTransferredImageBitmap(uint32_t index, v8::Local<v8::Valu
e>*) = 0; | 467 virtual bool tryGetTransferredImageBitmap(uint32_t index, v8::Local<v8::Valu
e>*) = 0; |
469 virtual bool tryGetTransferredOffscreenCanvas(uint32_t index, uint32_t width
, uint32_t height, uint32_t id, v8::Local<v8::Value>*) { return true; }; | |
470 virtual bool tryGetTransferredSharedArrayBuffer(uint32_t index, v8::Local<v8
::Value>*) = 0; | 468 virtual bool tryGetTransferredSharedArrayBuffer(uint32_t index, v8::Local<v8
::Value>*) = 0; |
471 virtual bool newSparseArray(uint32_t length) = 0; | 469 virtual bool newSparseArray(uint32_t length) = 0; |
472 virtual bool newDenseArray(uint32_t length) = 0; | 470 virtual bool newDenseArray(uint32_t length) = 0; |
473 virtual bool newMap() = 0; | 471 virtual bool newMap() = 0; |
474 virtual bool newSet() = 0; | 472 virtual bool newSet() = 0; |
475 virtual bool newObject() = 0; | 473 virtual bool newObject() = 0; |
476 virtual bool completeObject(uint32_t numProperties, v8::Local<v8::Value>*) =
0; | 474 virtual bool completeObject(uint32_t numProperties, v8::Local<v8::Value>*) =
0; |
477 virtual bool completeSparseArray(uint32_t numProperties, uint32_t length, v8
::Local<v8::Value>*) = 0; | 475 virtual bool completeSparseArray(uint32_t numProperties, uint32_t length, v8
::Local<v8::Value>*) = 0; |
478 virtual bool completeDenseArray(uint32_t numProperties, uint32_t length, v8:
:Local<v8::Value>*) = 0; | 476 virtual bool completeDenseArray(uint32_t numProperties, uint32_t length, v8:
:Local<v8::Value>*) = 0; |
479 virtual bool completeMap(uint32_t length, v8::Local<v8::Value>*) = 0; | 477 virtual bool completeMap(uint32_t length, v8::Local<v8::Value>*) = 0; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 ArrayBufferContentsArray* m_arrayBufferContents; | 644 ArrayBufferContentsArray* m_arrayBufferContents; |
647 ImageBitmapContentsArray* m_imageBitmapContents; | 645 ImageBitmapContentsArray* m_imageBitmapContents; |
648 Vector<v8::Local<v8::Value>> m_arrayBuffers; | 646 Vector<v8::Local<v8::Value>> m_arrayBuffers; |
649 Vector<v8::Local<v8::Value>> m_imageBitmaps; | 647 Vector<v8::Local<v8::Value>> m_imageBitmaps; |
650 uint32_t m_version; | 648 uint32_t m_version; |
651 }; | 649 }; |
652 | 650 |
653 } // namespace blink | 651 } // namespace blink |
654 | 652 |
655 #endif // ScriptValueSerializer_h | 653 #endif // ScriptValueSerializer_h |
OLD | NEW |