OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 V8_VALUE_SERIALIZER_H_ | 5 #ifndef V8_VALUE_SERIALIZER_H_ |
6 #define V8_VALUE_SERIALIZER_H_ | 6 #define V8_VALUE_SERIALIZER_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 public: | 109 public: |
110 ValueDeserializer(Isolate* isolate, Vector<const uint8_t> data); | 110 ValueDeserializer(Isolate* isolate, Vector<const uint8_t> data); |
111 ~ValueDeserializer(); | 111 ~ValueDeserializer(); |
112 | 112 |
113 /* | 113 /* |
114 * Runs version detection logic, which may fail if the format is invalid. | 114 * Runs version detection logic, which may fail if the format is invalid. |
115 */ | 115 */ |
116 Maybe<bool> ReadHeader() WARN_UNUSED_RESULT; | 116 Maybe<bool> ReadHeader() WARN_UNUSED_RESULT; |
117 | 117 |
118 /* | 118 /* |
| 119 * Reads the underlying wire format version. Likely mostly to be useful to |
| 120 * legacy code reading old wire format versions. Must be called after |
| 121 * ReadHeader. |
| 122 */ |
| 123 uint32_t GetWireFormatVersion() const { return version_; } |
| 124 |
| 125 /* |
119 * Deserializes a V8 object from the buffer. | 126 * Deserializes a V8 object from the buffer. |
120 */ | 127 */ |
121 MaybeHandle<Object> ReadObject() WARN_UNUSED_RESULT; | 128 MaybeHandle<Object> ReadObject() WARN_UNUSED_RESULT; |
122 | 129 |
123 /* | 130 /* |
124 * Reads an object, consuming the entire buffer. | 131 * Reads an object, consuming the entire buffer. |
125 * | 132 * |
126 * This is required for the legacy "version 0" format, which did not allow | 133 * This is required for the legacy "version 0" format, which did not allow |
127 * reference deduplication, and instead relied on a "stack" model for | 134 * reference deduplication, and instead relied on a "stack" model for |
128 * deserializing, with the contents of objects and arrays provided first. | 135 * deserializing, with the contents of objects and arrays provided first. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 Handle<SeededNumberDictionary> id_map_; // Always a global handle. | 179 Handle<SeededNumberDictionary> id_map_; // Always a global handle. |
173 uint32_t next_id_ = 0; | 180 uint32_t next_id_ = 0; |
174 | 181 |
175 DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); | 182 DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); |
176 }; | 183 }; |
177 | 184 |
178 } // namespace internal | 185 } // namespace internal |
179 } // namespace v8 | 186 } // namespace v8 |
180 | 187 |
181 #endif // V8_VALUE_SERIALIZER_H_ | 188 #endif // V8_VALUE_SERIALIZER_H_ |
OLD | NEW |