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) { }; |
146 void writeTransferredSharedArrayBuffer(uint32_t index); | 147 void writeTransferredSharedArrayBuffer(uint32_t index); |
147 void writeObjectReference(uint32_t reference); | 148 void writeObjectReference(uint32_t reference); |
148 void writeObject(uint32_t numProperties); | 149 void writeObject(uint32_t numProperties); |
149 void writeSparseArray(uint32_t numProperties, uint32_t length); | 150 void writeSparseArray(uint32_t numProperties, uint32_t length); |
150 void writeDenseArray(uint32_t numProperties, uint32_t length); | 151 void writeDenseArray(uint32_t numProperties, uint32_t length); |
151 String takeWireString(); | 152 String takeWireString(); |
152 void writeReferenceCount(uint32_t numberOfReferences); | 153 void writeReferenceCount(uint32_t numberOfReferences); |
153 void writeGenerateFreshObject(); | 154 void writeGenerateFreshObject(); |
154 void writeGenerateFreshSparseArray(uint32_t length); | 155 void writeGenerateFreshSparseArray(uint32_t length); |
155 void writeGenerateFreshDenseArray(uint32_t length); | 156 void writeGenerateFreshDenseArray(uint32_t length); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 public: | 204 public: |
204 enum Status { | 205 enum Status { |
205 Success, | 206 Success, |
206 InputError, | 207 InputError, |
207 DataCloneError, | 208 DataCloneError, |
208 JSException | 209 JSException |
209 }; | 210 }; |
210 | 211 |
211 enum TransferableType { | 212 enum TransferableType { |
212 TransferableArrayBufferType, | 213 TransferableArrayBufferType, |
213 TransferableImageBitmapType | 214 TransferableImageBitmapType, |
| 215 TransferableOffscreenCanvasType |
214 }; | 216 }; |
215 | 217 |
216 ScriptValueSerializer(SerializedScriptValueWriter&, MessagePortArray* messag
ePorts, TransferableArray*, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandle
s, v8::TryCatch&, ScriptState*); | 218 ScriptValueSerializer(SerializedScriptValueWriter&, MessagePortArray* messag
ePorts, TransferableArray*, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandle
s, v8::TryCatch&, ScriptState*); |
217 v8::Isolate* isolate() { return m_scriptState->isolate(); } | 219 v8::Isolate* isolate() { return m_scriptState->isolate(); } |
218 v8::Local<v8::Context> context() { return m_scriptState->context(); } | 220 v8::Local<v8::Context> context() { return m_scriptState->context(); } |
219 | 221 |
220 Status serialize(v8::Local<v8::Value>); | 222 Status serialize(v8::Local<v8::Value>); |
221 String errorMessage() { return m_errorMessage; } | 223 String errorMessage() { return m_errorMessage; } |
222 | 224 |
223 protected: | 225 protected: |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 ScriptValueCompositeCreator() { } | 462 ScriptValueCompositeCreator() { } |
461 virtual ~ScriptValueCompositeCreator() { } | 463 virtual ~ScriptValueCompositeCreator() { } |
462 | 464 |
463 virtual bool consumeTopOfStack(v8::Local<v8::Value>*) = 0; | 465 virtual bool consumeTopOfStack(v8::Local<v8::Value>*) = 0; |
464 virtual uint32_t objectReferenceCount() = 0; | 466 virtual uint32_t objectReferenceCount() = 0; |
465 virtual void pushObjectReference(const v8::Local<v8::Value>&) = 0; | 467 virtual void pushObjectReference(const v8::Local<v8::Value>&) = 0; |
466 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Local<v
8::Value>*) = 0; | 468 virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Local<v
8::Value>*) = 0; |
467 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Local<v8::Valu
e>*) = 0; | 469 virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Local<v8::Valu
e>*) = 0; |
468 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Local<v8::Valu
e>*) = 0; | 470 virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Local<v8::Valu
e>*) = 0; |
469 virtual bool tryGetTransferredImageBitmap(uint32_t index, v8::Local<v8::Valu
e>*) = 0; | 471 virtual bool tryGetTransferredImageBitmap(uint32_t index, v8::Local<v8::Valu
e>*) = 0; |
| 472 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; | 473 virtual bool tryGetTransferredSharedArrayBuffer(uint32_t index, v8::Local<v8
::Value>*) = 0; |
471 virtual bool newSparseArray(uint32_t length) = 0; | 474 virtual bool newSparseArray(uint32_t length) = 0; |
472 virtual bool newDenseArray(uint32_t length) = 0; | 475 virtual bool newDenseArray(uint32_t length) = 0; |
473 virtual bool newMap() = 0; | 476 virtual bool newMap() = 0; |
474 virtual bool newSet() = 0; | 477 virtual bool newSet() = 0; |
475 virtual bool newObject() = 0; | 478 virtual bool newObject() = 0; |
476 virtual bool completeObject(uint32_t numProperties, v8::Local<v8::Value>*) =
0; | 479 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; | 480 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; | 481 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; | 482 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; | 649 ArrayBufferContentsArray* m_arrayBufferContents; |
647 ImageBitmapContentsArray* m_imageBitmapContents; | 650 ImageBitmapContentsArray* m_imageBitmapContents; |
648 Vector<v8::Local<v8::Value>> m_arrayBuffers; | 651 Vector<v8::Local<v8::Value>> m_arrayBuffers; |
649 Vector<v8::Local<v8::Value>> m_imageBitmaps; | 652 Vector<v8::Local<v8::Value>> m_imageBitmaps; |
650 uint32_t m_version; | 653 uint32_t m_version; |
651 }; | 654 }; |
652 | 655 |
653 } // namespace blink | 656 } // namespace blink |
654 | 657 |
655 #endif // ScriptValueSerializer_h | 658 #endif // ScriptValueSerializer_h |
OLD | NEW |