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" |
11 #include "core/CoreExport.h" | 11 #include "core/CoreExport.h" |
12 #include "wtf/ArrayBufferContents.h" | 12 #include "wtf/ArrayBufferContents.h" |
13 #include "wtf/HashMap.h" | 13 #include "wtf/HashMap.h" |
14 #include "wtf/Noncopyable.h" | 14 #include "wtf/Noncopyable.h" |
15 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
16 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
17 #include <v8.h> | 17 #include <v8.h> |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
| 21 class CompositorProxy; |
21 class DOMArrayBuffer; | 22 class DOMArrayBuffer; |
22 class DOMArrayBufferView; | 23 class DOMArrayBufferView; |
23 class File; | 24 class File; |
24 class FileList; | 25 class FileList; |
25 | 26 |
26 typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray; | 27 typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray; |
27 | 28 |
28 // V8ObjectMap is a map from V8 objects to arbitrary values of type T. | 29 // V8ObjectMap is a map from V8 objects to arbitrary values of type T. |
29 // V8 objects (or handles to V8 objects) cannot be used as keys in ordinary wtf:
:HashMaps; | 30 // V8 objects (or handles to V8 objects) cannot be used as keys in ordinary wtf:
:HashMaps; |
30 // this class should be used instead. GCObject must be a subtype of v8::Object. | 31 // this class should be used instead. GCObject must be a subtype of v8::Object. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void writeStringObject(const char* data, int length); | 116 void writeStringObject(const char* data, int length); |
116 void writeWebCoreString(const String&); | 117 void writeWebCoreString(const String&); |
117 void writeVersion(); | 118 void writeVersion(); |
118 void writeInt32(int32_t value); | 119 void writeInt32(int32_t value); |
119 void writeUint32(uint32_t value); | 120 void writeUint32(uint32_t value); |
120 void writeDate(double numberValue); | 121 void writeDate(double numberValue); |
121 void writeNumber(double number); | 122 void writeNumber(double number); |
122 void writeNumberObject(double number); | 123 void writeNumberObject(double number); |
123 void writeBlob(const String& uuid, const String& type, unsigned long long si
ze); | 124 void writeBlob(const String& uuid, const String& type, unsigned long long si
ze); |
124 void writeBlobIndex(int blobIndex); | 125 void writeBlobIndex(int blobIndex); |
| 126 void writeCompositorProxy(const CompositorProxy&); |
125 void writeFile(const File&); | 127 void writeFile(const File&); |
126 void writeFileIndex(int blobIndex); | 128 void writeFileIndex(int blobIndex); |
127 void writeFileList(const FileList&); | 129 void writeFileList(const FileList&); |
128 void writeFileListIndex(const Vector<int>& blobIndices); | 130 void writeFileListIndex(const Vector<int>& blobIndices); |
129 void writeArrayBuffer(const DOMArrayBuffer&); | 131 void writeArrayBuffer(const DOMArrayBuffer&); |
130 void writeArrayBufferView(const DOMArrayBufferView&); | 132 void writeArrayBufferView(const DOMArrayBufferView&); |
131 void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelDat
a, uint32_t pixelDataLength); | 133 void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelDat
a, uint32_t pixelDataLength); |
132 void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags); | 134 void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags); |
133 void writeTransferredMessagePort(uint32_t index); | 135 void writeTransferredMessagePort(uint32_t index); |
134 void writeTransferredArrayBuffer(uint32_t index); | 136 void writeTransferredArrayBuffer(uint32_t index); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 delete state; | 353 delete state; |
352 return next; | 354 return next; |
353 } | 355 } |
354 | 356 |
355 bool checkComposite(StateBase* top); | 357 bool checkComposite(StateBase* top); |
356 void writeString(v8::Local<v8::Value>); | 358 void writeString(v8::Local<v8::Value>); |
357 void writeStringObject(v8::Local<v8::Value>); | 359 void writeStringObject(v8::Local<v8::Value>); |
358 void writeNumberObject(v8::Local<v8::Value>); | 360 void writeNumberObject(v8::Local<v8::Value>); |
359 void writeBooleanObject(v8::Local<v8::Value>); | 361 void writeBooleanObject(v8::Local<v8::Value>); |
360 StateBase* writeBlob(v8::Local<v8::Value>, StateBase* next); | 362 StateBase* writeBlob(v8::Local<v8::Value>, StateBase* next); |
| 363 StateBase* writeCompositorProxy(v8::Local<v8::Value>, StateBase* next); |
361 StateBase* writeFile(v8::Local<v8::Value>, StateBase* next); | 364 StateBase* writeFile(v8::Local<v8::Value>, StateBase* next); |
362 StateBase* writeFileList(v8::Local<v8::Value>, StateBase* next); | 365 StateBase* writeFileList(v8::Local<v8::Value>, StateBase* next); |
363 void writeImageData(v8::Local<v8::Value>); | 366 void writeImageData(v8::Local<v8::Value>); |
364 void writeRegExp(v8::Local<v8::Value>); | 367 void writeRegExp(v8::Local<v8::Value>); |
365 StateBase* writeAndGreyArrayBufferView(v8::Local<v8::Object>, StateBase* nex
t); | 368 StateBase* writeAndGreyArrayBufferView(v8::Local<v8::Object>, StateBase* nex
t); |
366 StateBase* writeArrayBuffer(v8::Local<v8::Value>, StateBase* next); | 369 StateBase* writeArrayBuffer(v8::Local<v8::Value>, StateBase* next); |
367 StateBase* writeTransferredArrayBuffer(v8::Local<v8::Value>, uint32_t index,
StateBase* next); | 370 StateBase* writeTransferredArrayBuffer(v8::Local<v8::Value>, uint32_t index,
StateBase* next); |
368 static bool shouldSerializeDensely(uint32_t length, uint32_t propertyCount); | 371 static bool shouldSerializeDensely(uint32_t length, uint32_t propertyCount); |
369 | 372 |
370 StateBase* startArrayState(v8::Local<v8::Array>, StateBase* next); | 373 StateBase* startArrayState(v8::Local<v8::Array>, StateBase* next); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 void undoReadTag(); | 478 void undoReadTag(); |
476 bool readArrayBufferViewSubTag(ArrayBufferViewSubTag*); | 479 bool readArrayBufferViewSubTag(ArrayBufferViewSubTag*); |
477 bool readString(v8::Local<v8::Value>*); | 480 bool readString(v8::Local<v8::Value>*); |
478 bool readUCharString(v8::Local<v8::Value>*); | 481 bool readUCharString(v8::Local<v8::Value>*); |
479 bool readStringObject(v8::Local<v8::Value>*); | 482 bool readStringObject(v8::Local<v8::Value>*); |
480 bool readInt32(v8::Local<v8::Value>*); | 483 bool readInt32(v8::Local<v8::Value>*); |
481 bool readDate(v8::Local<v8::Value>*); | 484 bool readDate(v8::Local<v8::Value>*); |
482 bool readNumber(v8::Local<v8::Value>*); | 485 bool readNumber(v8::Local<v8::Value>*); |
483 bool readNumberObject(v8::Local<v8::Value>*); | 486 bool readNumberObject(v8::Local<v8::Value>*); |
484 bool readImageData(v8::Local<v8::Value>*); | 487 bool readImageData(v8::Local<v8::Value>*); |
| 488 bool readCompositorProxy(v8::Local<v8::Value>*); |
485 PassRefPtr<DOMArrayBuffer> doReadArrayBuffer(); | 489 PassRefPtr<DOMArrayBuffer> doReadArrayBuffer(); |
486 bool readArrayBuffer(v8::Local<v8::Value>*); | 490 bool readArrayBuffer(v8::Local<v8::Value>*); |
487 bool readArrayBufferView(v8::Local<v8::Value>*, ScriptValueCompositeCreator&
); | 491 bool readArrayBufferView(v8::Local<v8::Value>*, ScriptValueCompositeCreator&
); |
488 bool readRegExp(v8::Local<v8::Value>*); | 492 bool readRegExp(v8::Local<v8::Value>*); |
489 bool readBlob(v8::Local<v8::Value>*, bool isIndexed); | 493 bool readBlob(v8::Local<v8::Value>*, bool isIndexed); |
490 bool readFile(v8::Local<v8::Value>*, bool isIndexed); | 494 bool readFile(v8::Local<v8::Value>*, bool isIndexed); |
491 bool readFileList(v8::Local<v8::Value>*, bool isIndexed); | 495 bool readFileList(v8::Local<v8::Value>*, bool isIndexed); |
492 File* readFileHelper(); | 496 File* readFileHelper(); |
493 File* readFileIndexHelper(); | 497 File* readFileIndexHelper(); |
494 | 498 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 Vector<uint32_t> m_openCompositeReferenceStack; | 578 Vector<uint32_t> m_openCompositeReferenceStack; |
575 RawPtrWillBeMember<MessagePortArray> m_transferredMessagePorts; | 579 RawPtrWillBeMember<MessagePortArray> m_transferredMessagePorts; |
576 ArrayBufferContentsArray* m_arrayBufferContents; | 580 ArrayBufferContentsArray* m_arrayBufferContents; |
577 Vector<v8::Local<v8::Value>> m_arrayBuffers; | 581 Vector<v8::Local<v8::Value>> m_arrayBuffers; |
578 uint32_t m_version; | 582 uint32_t m_version; |
579 }; | 583 }; |
580 | 584 |
581 } // namespace blink | 585 } // namespace blink |
582 | 586 |
583 #endif // ScriptValueSerializer_h | 587 #endif // ScriptValueSerializer_h |
OLD | NEW |