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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 /* | 105 /* |
106 * Runs version detection logic, which may fail if the format is invalid. | 106 * Runs version detection logic, which may fail if the format is invalid. |
107 */ | 107 */ |
108 Maybe<bool> ReadHeader() WARN_UNUSED_RESULT; | 108 Maybe<bool> ReadHeader() WARN_UNUSED_RESULT; |
109 | 109 |
110 /* | 110 /* |
111 * Deserializes a V8 object from the buffer. | 111 * Deserializes a V8 object from the buffer. |
112 */ | 112 */ |
113 MaybeHandle<Object> ReadObject() WARN_UNUSED_RESULT; | 113 MaybeHandle<Object> ReadObject() WARN_UNUSED_RESULT; |
114 | 114 |
| 115 /* |
| 116 * Reads an object, consuming the entire buffer. |
| 117 * |
| 118 * This is required for the legacy "version 0" format, which did not allow |
| 119 * reference deduplication, and instead relied on a "stack" model for |
| 120 * deserializing, with the contents of objects and arrays provided first. |
| 121 */ |
| 122 MaybeHandle<Object> ReadObjectUsingEntireBufferForLegacyFormat() |
| 123 WARN_UNUSED_RESULT; |
| 124 |
115 private: | 125 private: |
116 // Reading the wire format. | 126 // Reading the wire format. |
117 Maybe<SerializationTag> PeekTag() const WARN_UNUSED_RESULT; | 127 Maybe<SerializationTag> PeekTag() const WARN_UNUSED_RESULT; |
| 128 void ConsumeTag(SerializationTag peeked_tag); |
118 Maybe<SerializationTag> ReadTag() WARN_UNUSED_RESULT; | 129 Maybe<SerializationTag> ReadTag() WARN_UNUSED_RESULT; |
119 template <typename T> | 130 template <typename T> |
120 Maybe<T> ReadVarint() WARN_UNUSED_RESULT; | 131 Maybe<T> ReadVarint() WARN_UNUSED_RESULT; |
121 template <typename T> | 132 template <typename T> |
122 Maybe<T> ReadZigZag() WARN_UNUSED_RESULT; | 133 Maybe<T> ReadZigZag() WARN_UNUSED_RESULT; |
123 Maybe<double> ReadDouble() WARN_UNUSED_RESULT; | 134 Maybe<double> ReadDouble() WARN_UNUSED_RESULT; |
124 Maybe<Vector<const uint8_t>> ReadRawBytes(int size) WARN_UNUSED_RESULT; | 135 Maybe<Vector<const uint8_t>> ReadRawBytes(int size) WARN_UNUSED_RESULT; |
125 | 136 |
126 // Reading V8 objects of specific kinds. | 137 // Reading V8 objects of specific kinds. |
127 // The tag is assumed to have already been read. | 138 // The tag is assumed to have already been read. |
(...skipping 29 matching lines...) Expand all Loading... |
157 Handle<SeededNumberDictionary> id_map_; // always a global handle | 168 Handle<SeededNumberDictionary> id_map_; // always a global handle |
158 uint32_t next_id_ = 0; | 169 uint32_t next_id_ = 0; |
159 | 170 |
160 DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); | 171 DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); |
161 }; | 172 }; |
162 | 173 |
163 } // namespace internal | 174 } // namespace internal |
164 } // namespace v8 | 175 } // namespace v8 |
165 | 176 |
166 #endif // V8_VALUE_SERIALIZER_H_ | 177 #endif // V8_VALUE_SERIALIZER_H_ |
OLD | NEW |