| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 69   void TransferArrayBuffer(uint32_t transfer_id, | 69   void TransferArrayBuffer(uint32_t transfer_id, | 
| 70                            Handle<JSArrayBuffer> array_buffer); | 70                            Handle<JSArrayBuffer> array_buffer); | 
| 71 | 71 | 
| 72   /* | 72   /* | 
| 73    * Publicly exposed wire format writing methods. | 73    * Publicly exposed wire format writing methods. | 
| 74    * These are intended for use within the delegate's WriteHostObject method. | 74    * These are intended for use within the delegate's WriteHostObject method. | 
| 75    */ | 75    */ | 
| 76   void WriteUint32(uint32_t value); | 76   void WriteUint32(uint32_t value); | 
| 77   void WriteUint64(uint64_t value); | 77   void WriteUint64(uint64_t value); | 
| 78   void WriteRawBytes(const void* source, size_t length); | 78   void WriteRawBytes(const void* source, size_t length); | 
|  | 79   void WriteDouble(double value); | 
| 79 | 80 | 
| 80  private: | 81  private: | 
| 81   // Writing the wire format. | 82   // Writing the wire format. | 
| 82   void WriteTag(SerializationTag tag); | 83   void WriteTag(SerializationTag tag); | 
| 83   template <typename T> | 84   template <typename T> | 
| 84   void WriteVarint(T value); | 85   void WriteVarint(T value); | 
| 85   template <typename T> | 86   template <typename T> | 
| 86   void WriteZigZag(T value); | 87   void WriteZigZag(T value); | 
| 87   void WriteDouble(double value); |  | 
| 88   void WriteOneByteString(Vector<const uint8_t> chars); | 88   void WriteOneByteString(Vector<const uint8_t> chars); | 
| 89   void WriteTwoByteString(Vector<const uc16> chars); | 89   void WriteTwoByteString(Vector<const uc16> chars); | 
| 90   uint8_t* ReserveRawBytes(size_t bytes); | 90   uint8_t* ReserveRawBytes(size_t bytes); | 
| 91 | 91 | 
| 92   // Writing V8 objects of various kinds. | 92   // Writing V8 objects of various kinds. | 
| 93   void WriteOddball(Oddball* oddball); | 93   void WriteOddball(Oddball* oddball); | 
| 94   void WriteSmi(Smi* smi); | 94   void WriteSmi(Smi* smi); | 
| 95   void WriteHeapNumber(HeapNumber* number); | 95   void WriteHeapNumber(HeapNumber* number); | 
| 96   void WriteString(Handle<String> string); | 96   void WriteString(Handle<String> string); | 
| 97   Maybe<bool> WriteJSReceiver(Handle<JSReceiver> receiver) WARN_UNUSED_RESULT; | 97   Maybe<bool> WriteJSReceiver(Handle<JSReceiver> receiver) WARN_UNUSED_RESULT; | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 183    */ | 183    */ | 
| 184   void TransferArrayBuffer(uint32_t transfer_id, | 184   void TransferArrayBuffer(uint32_t transfer_id, | 
| 185                            Handle<JSArrayBuffer> array_buffer); | 185                            Handle<JSArrayBuffer> array_buffer); | 
| 186 | 186 | 
| 187   /* | 187   /* | 
| 188    * Publicly exposed wire format writing methods. | 188    * Publicly exposed wire format writing methods. | 
| 189    * These are intended for use within the delegate's WriteHostObject method. | 189    * These are intended for use within the delegate's WriteHostObject method. | 
| 190    */ | 190    */ | 
| 191   bool ReadUint32(uint32_t* value) WARN_UNUSED_RESULT; | 191   bool ReadUint32(uint32_t* value) WARN_UNUSED_RESULT; | 
| 192   bool ReadUint64(uint64_t* value) WARN_UNUSED_RESULT; | 192   bool ReadUint64(uint64_t* value) WARN_UNUSED_RESULT; | 
|  | 193   bool ReadDouble(double* value) WARN_UNUSED_RESULT; | 
| 193   bool ReadRawBytes(size_t length, const void** data) WARN_UNUSED_RESULT; | 194   bool ReadRawBytes(size_t length, const void** data) WARN_UNUSED_RESULT; | 
| 194 | 195 | 
| 195  private: | 196  private: | 
| 196   // Reading the wire format. | 197   // Reading the wire format. | 
| 197   Maybe<SerializationTag> PeekTag() const WARN_UNUSED_RESULT; | 198   Maybe<SerializationTag> PeekTag() const WARN_UNUSED_RESULT; | 
| 198   void ConsumeTag(SerializationTag peeked_tag); | 199   void ConsumeTag(SerializationTag peeked_tag); | 
| 199   Maybe<SerializationTag> ReadTag() WARN_UNUSED_RESULT; | 200   Maybe<SerializationTag> ReadTag() WARN_UNUSED_RESULT; | 
| 200   template <typename T> | 201   template <typename T> | 
| 201   Maybe<T> ReadVarint() WARN_UNUSED_RESULT; | 202   Maybe<T> ReadVarint() WARN_UNUSED_RESULT; | 
| 202   template <typename T> | 203   template <typename T> | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 256   Handle<FixedArray> id_map_; | 257   Handle<FixedArray> id_map_; | 
| 257   MaybeHandle<SeededNumberDictionary> array_buffer_transfer_map_; | 258   MaybeHandle<SeededNumberDictionary> array_buffer_transfer_map_; | 
| 258 | 259 | 
| 259   DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); | 260   DISALLOW_COPY_AND_ASSIGN(ValueDeserializer); | 
| 260 }; | 261 }; | 
| 261 | 262 | 
| 262 }  // namespace internal | 263 }  // namespace internal | 
| 263 }  // namespace v8 | 264 }  // namespace v8 | 
| 264 | 265 | 
| 265 #endif  // V8_VALUE_SERIALIZER_H_ | 266 #endif  // V8_VALUE_SERIALIZER_H_ | 
| OLD | NEW | 
|---|