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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 void undoReadTag(); | 477 void undoReadTag(); |
475 bool readArrayBufferViewSubTag(ArrayBufferViewSubTag*); | 478 bool readArrayBufferViewSubTag(ArrayBufferViewSubTag*); |
476 bool readString(v8::Local<v8::Value>*); | 479 bool readString(v8::Local<v8::Value>*); |
477 bool readUCharString(v8::Local<v8::Value>*); | 480 bool readUCharString(v8::Local<v8::Value>*); |
478 bool readStringObject(v8::Local<v8::Value>*); | 481 bool readStringObject(v8::Local<v8::Value>*); |
479 bool readInt32(v8::Local<v8::Value>*); | 482 bool readInt32(v8::Local<v8::Value>*); |
480 bool readDate(v8::Local<v8::Value>*); | 483 bool readDate(v8::Local<v8::Value>*); |
481 bool readNumber(v8::Local<v8::Value>*); | 484 bool readNumber(v8::Local<v8::Value>*); |
482 bool readNumberObject(v8::Local<v8::Value>*); | 485 bool readNumberObject(v8::Local<v8::Value>*); |
483 bool readImageData(v8::Local<v8::Value>*); | 486 bool readImageData(v8::Local<v8::Value>*); |
| 487 bool readCompositorProxy(v8::Local<v8::Value>*); |
484 PassRefPtr<DOMArrayBuffer> doReadArrayBuffer(); | 488 PassRefPtr<DOMArrayBuffer> doReadArrayBuffer(); |
485 bool readArrayBuffer(v8::Local<v8::Value>*); | 489 bool readArrayBuffer(v8::Local<v8::Value>*); |
486 bool readArrayBufferView(v8::Local<v8::Value>*, ScriptValueCompositeCreator&
); | 490 bool readArrayBufferView(v8::Local<v8::Value>*, ScriptValueCompositeCreator&
); |
487 bool readRegExp(v8::Local<v8::Value>*); | 491 bool readRegExp(v8::Local<v8::Value>*); |
488 bool readBlob(v8::Local<v8::Value>*, bool isIndexed); | 492 bool readBlob(v8::Local<v8::Value>*, bool isIndexed); |
489 bool readFile(v8::Local<v8::Value>*, bool isIndexed); | 493 bool readFile(v8::Local<v8::Value>*, bool isIndexed); |
490 bool readFileList(v8::Local<v8::Value>*, bool isIndexed); | 494 bool readFileList(v8::Local<v8::Value>*, bool isIndexed); |
491 File* readFileHelper(); | 495 File* readFileHelper(); |
492 File* readFileIndexHelper(); | 496 File* readFileIndexHelper(); |
493 | 497 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 Vector<uint32_t> m_openCompositeReferenceStack; | 577 Vector<uint32_t> m_openCompositeReferenceStack; |
574 RawPtrWillBeMember<MessagePortArray> m_transferredMessagePorts; | 578 RawPtrWillBeMember<MessagePortArray> m_transferredMessagePorts; |
575 ArrayBufferContentsArray* m_arrayBufferContents; | 579 ArrayBufferContentsArray* m_arrayBufferContents; |
576 Vector<v8::Local<v8::Value>> m_arrayBuffers; | 580 Vector<v8::Local<v8::Value>> m_arrayBuffers; |
577 uint32_t m_version; | 581 uint32_t m_version; |
578 }; | 582 }; |
579 | 583 |
580 } // namespace blink | 584 } // namespace blink |
581 | 585 |
582 #endif // ScriptValueSerializer_h | 586 #endif // ScriptValueSerializer_h |
OLD | NEW |