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 SerializationTag_h | 5 #ifndef SerializationTag_h |
6 #define SerializationTag_h | 6 #define SerializationTag_h |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 | 9 |
10 // Serialization format is a sequence of tags followed by zero or more data | 10 // Serialization format is a sequence of tags followed by zero or more data |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 FileIndexTag = 'e', // index:int32_t -> File (ref) | 56 FileIndexTag = 'e', // index:int32_t -> File (ref) |
57 DOMFileSystemTag = 'd', // type:int32_t, name:WebCoreString, | 57 DOMFileSystemTag = 'd', // type:int32_t, name:WebCoreString, |
58 // uuid:WebCoreString -> FileSystem (ref) | 58 // uuid:WebCoreString -> FileSystem (ref) |
59 FileListTag = | 59 FileListTag = |
60 'l', // length:uint32_t, files:RawFile[length] -> FileList (ref) | 60 'l', // length:uint32_t, files:RawFile[length] -> FileList (ref) |
61 FileListIndexTag = | 61 FileListIndexTag = |
62 'L', // length:uint32_t, files:int32_t[length] -> FileList (ref) | 62 'L', // length:uint32_t, files:int32_t[length] -> FileList (ref) |
63 ImageDataTag = '#', // width:uint32_t, height:uint32_t, | 63 ImageDataTag = '#', // width:uint32_t, height:uint32_t, |
64 // pixelDataLength:uint32_t, data:byte[pixelDataLength] | 64 // pixelDataLength:uint32_t, data:byte[pixelDataLength] |
65 // -> ImageData (ref) | 65 // -> ImageData (ref) |
66 // numProperties:uint32_t -> pops the last object from the open stack; fills | 66 // numProperties:uint32_t -> pops the last object from |
67 // it with the last numProperties name,value pairs pushed onto the | 67 // the open stack; fills it with the last numProperties |
68 // deserialization stack | 68 // name,value pairs pushed onto the deserialization stack |
69 ObjectTag = '{', | 69 ObjectTag = '{', |
70 // numProperties:uint32_t, length:uint32_t -> pops the last object from the | 70 // numProperties:uint32_t, length:uint32_t -> pops the last object from the |
71 // open stack; fills it with the last numProperties name,value pairs pushed | 71 // open stack; fills it with the last numProperties name,value pairs pushed |
72 // onto the deserialization stack | 72 // onto the deserialization stack |
73 SparseArrayTag = '@', | 73 SparseArrayTag = '@', |
74 // numProperties:uint32_t, length:uint32_t -> pops the last object from the | 74 // numProperties:uint32_t, length:uint32_t -> pops the last object from the |
75 // open stack; fills it with the last length elements and numProperties | 75 // open stack; fills it with the last length elements and numProperties |
76 // name,value pairs pushed onto deserialization stack | 76 // name,value pairs pushed onto deserialization stack |
77 DenseArrayTag = '$', | 77 DenseArrayTag = '$', |
78 RegExpTag = 'R', // pattern:RawString, flags:uint32_t -> RegExp (ref) | 78 RegExpTag = 'R', // pattern:RawString, flags:uint32_t -> RegExp (ref) |
79 ArrayBufferTag = | 79 ArrayBufferTag = |
80 'B', // byteLength:uint32_t, data:byte[byteLength] -> ArrayBuffer (ref) | 80 'B', // byteLength:uint32_t, data:byte[byteLength] -> ArrayBuffer (ref) |
81 ArrayBufferTransferTag = | 81 ArrayBufferTransferTag = |
82 't', // index:uint32_t -> ArrayBuffer. For ArrayBuffer transfer | 82 't', // index:uint32_t -> ArrayBuffer. For ArrayBuffer transfer |
83 ImageBitmapTag = 'g', // size:uint32_t, data:byte[size] -> ImageBitmap (ref) | 83 ImageBitmapTag = 'g', // size:uint32_t, data:byte[size] -> ImageBitmap (ref) |
84 ImageBitmapTransferTag = | 84 ImageBitmapTransferTag = |
85 'G', // index:uint32_t -> ImageBitmap. For ImageBitmap transfer | 85 'G', // index:uint32_t -> ImageBitmap. For ImageBitmap transfer |
86 OffscreenCanvasTransferTag = 'H', // index, width, height, id:uint32_t -> | 86 OffscreenCanvasTransferTag = 'H', // index, width, height, id:uint32_t -> |
87 // OffscreenCanvas. For OffscreenCanvas | 87 // OffscreenCanvas. For OffscreenCanvas |
88 // transfer | 88 // transfer |
89 // subtag:byte, byteOffset:uint32_t, byteLength:uint32_t -> ArrayBufferView | 89 // subtag:byte, byteOffset:uint32_t, |
90 // (ref). Consumes an ArrayBuffer from the top of the deserialization stack. | 90 // byteLength:uint32_t -> ArrayBufferView |
| 91 // (ref). Consumes an ArrayBuffer from the |
| 92 // top of the deserialization stack. |
91 ArrayBufferViewTag = 'V', | 93 ArrayBufferViewTag = 'V', |
92 SharedArrayBufferTransferTag = 'u', // index:uint32_t -> SharedArrayBuffer. | 94 SharedArrayBufferTransferTag = 'u', // index:uint32_t -> SharedArrayBuffer. |
93 // For SharedArrayBuffer transfer | 95 // For SharedArrayBuffer transfer |
94 WasmModuleTag = 'W', | 96 WasmModuleTag = 'W', |
95 RawBytesTag = 'y', | 97 RawBytesTag = 'y', |
96 CryptoKeyTag = 'K', // subtag:byte, props, usages:uint32_t, | 98 CryptoKeyTag = |
97 // keyDataLength:uint32_t, keyData:byte[keyDataLength] | 99 'K', // subtag:byte, props, usages:uint32_t, |
98 // If subtag=AesKeyTag: | 100 // keyDataLength:uint32_t, keyData:byte[keyDataLength] |
99 // props = keyLengthBytes:uint32_t, algorithmId:uint32_t | 101 // If subtag=AesKeyTag: |
100 // If subtag=HmacKeyTag: | 102 // props = keyLengthBytes:uint32_t, |
101 // props = keyLengthBytes:uint32_t, hashId:uint32_t | 103 // algorithmId:uint32_t |
102 // If subtag=RsaHashedKeyTag: | 104 // If subtag=HmacKeyTag: |
103 // props = algorithmId:uint32_t, type:uint32_t, | 105 // props = keyLengthBytes:uint32_t, |
104 // modulusLengthBits:uint32_t, | 106 // hashId:uint32_t |
105 // publicExponentLength:uint32_t, | 107 // If subtag=RsaHashedKeyTag: |
106 // publicExponent:byte[publicExponentLength], | 108 // props = algorithmId:uint32_t, type:uint32_t, |
107 // hashId:uint32_t | 109 // modulusLengthBits:uint32_t, |
108 // If subtag=EcKeyTag: | 110 // publicExponentLength:uint32_t, |
109 // props = algorithmId:uint32_t, type:uint32_t, | 111 // publicExponent:byte[publicExponentLength], |
110 // namedCurve:uint32_t | 112 // hashId:uint32_t |
| 113 // If subtag=EcKeyTag: |
| 114 // props = algorithmId:uint32_t, type:uint32_t, |
| 115 // namedCurve:uint32_t |
111 RTCCertificateTag = 'k', // length:uint32_t, pemPrivateKey:WebCoreString, | 116 RTCCertificateTag = 'k', // length:uint32_t, pemPrivateKey:WebCoreString, |
112 // pemCertificate:WebCoreString | 117 // pemCertificate:WebCoreString |
113 ObjectReferenceTag = '^', // ref:uint32_t -> reference table[ref] | 118 ObjectReferenceTag = '^', // ref:uint32_t -> reference table[ref] |
114 GenerateFreshObjectTag = 'o', // -> empty object allocated an object ID and | 119 GenerateFreshObjectTag = 'o', // -> empty object allocated an object ID and |
115 // pushed onto the open stack (ref) | 120 // pushed onto the open stack (ref) |
116 GenerateFreshSparseArrayTag = 'a', // length:uint32_t -> empty array[length] | 121 GenerateFreshSparseArrayTag = 'a', // length:uint32_t -> empty array[length] |
117 // allocated an object ID and pushed onto | 122 // allocated an object ID and pushed onto |
118 // the open stack (ref) | 123 // the open stack (ref) |
119 GenerateFreshDenseArrayTag = 'A', // length:uint32_t -> empty array[length] | 124 GenerateFreshDenseArrayTag = 'A', // length:uint32_t -> empty array[length] |
120 // allocated an object ID and pushed onto | 125 // allocated an object ID and pushed onto |
121 // the open stack (ref) | 126 // the open stack (ref) |
122 ReferenceCountTag = '?', // refTableSize:uint32_t -> If the reference table | 127 ReferenceCountTag = '?', // refTableSize:uint32_t -> If the reference table |
123 // is not refTableSize big, fails. | 128 // is not refTableSize big, fails. |
124 StringObjectTag = 's', // string:RawString -> new String(string) (ref) | 129 StringObjectTag = 's', // string:RawString -> new String(string) (ref) |
125 NumberObjectTag = 'n', // value:double -> new Number(value) (ref) | 130 NumberObjectTag = 'n', // value:double -> new Number(value) (ref) |
126 TrueObjectTag = 'y', // new Boolean(true) (ref) | 131 TrueObjectTag = 'y', // new Boolean(true) (ref) |
127 FalseObjectTag = 'x', // new Boolean(false) (ref) | 132 FalseObjectTag = 'x', // new Boolean(false) (ref) |
128 CompositorProxyTag = | 133 CompositorProxyTag = |
129 'C', // elementId:uint64_t, bitfields:uint32_t -> CompositorProxy (ref) | 134 'C', // elementId:uint64_t, bitfields:uint32_t -> CompositorProxy (ref) |
130 MapTag = ':', // length:uint32_t -> pops the last object from the open stack | 135 MapTag = ':', // length:uint32_t -> pops the last object from the open stack |
131 // (it will be a Map); | 136 // (it will be a Map); |
132 // fills it with the last length elements pushed | 137 // fills it with the last length |
133 // onto the deserialization stack, treating them | 138 // elements pushed onto the |
134 // as key/value pairs and passing them to | 139 // deserialization stack, treating |
135 // Map::Set; | 140 // them as key/value pairs and |
136 // length must be an even number. | 141 // passing them to Map::Set; |
| 142 // length must be an even number. |
137 SetTag = ',', // length:uint32_t -> pops the last object from the open stack | 143 SetTag = ',', // length:uint32_t -> pops the last object from the open stack |
138 // (it will be a Set); | 144 // (it will be a Set); |
139 // fills it with the last length elements pushed | 145 // fills it with the last length |
140 // onto the deserialization stack, using Set::Add | 146 // elements pushed onto the |
| 147 // deserialization stack, using |
| 148 // Set::Add |
141 GenerateFreshMapTag = ';', // -> empty Map allocated an object ID and pushed | 149 GenerateFreshMapTag = ';', // -> empty Map allocated an object ID and pushed |
142 // onto the open stack (ref) | 150 // onto the open stack (ref) |
143 GenerateFreshSetTag = '\'', // -> empty Set allocated an object ID and pushed | 151 GenerateFreshSetTag = '\'', // -> empty Set allocated an object ID and pushed |
144 // onto the open stack (ref) | 152 // onto the open stack (ref) |
145 VersionTag = 0xFF // version:uint32_t -> Uses this as the file version. | 153 VersionTag = 0xFF // version:uint32_t -> Uses this as the file version. |
146 }; | 154 }; |
147 | 155 |
148 enum ArrayBufferViewSubTag { | 156 enum ArrayBufferViewSubTag { |
149 ByteArrayTag = 'b', | 157 ByteArrayTag = 'b', |
150 UnsignedByteArrayTag = 'B', | 158 UnsignedByteArrayTag = 'B', |
151 UnsignedByteClampedArrayTag = 'C', | 159 UnsignedByteClampedArrayTag = 'C', |
152 ShortArrayTag = 'w', | 160 ShortArrayTag = 'w', |
153 UnsignedShortArrayTag = 'W', | 161 UnsignedShortArrayTag = 'W', |
154 IntArrayTag = 'd', | 162 IntArrayTag = 'd', |
155 UnsignedIntArrayTag = 'D', | 163 UnsignedIntArrayTag = 'D', |
156 FloatArrayTag = 'f', | 164 FloatArrayTag = 'f', |
157 DoubleArrayTag = 'F', | 165 DoubleArrayTag = 'F', |
158 DataViewTag = '?' | 166 DataViewTag = '?' |
159 }; | 167 }; |
160 | 168 |
161 } // namespace blink | 169 } // namespace blink |
162 | 170 |
163 #endif | 171 #endif |
OLD | NEW |