Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_SNAPSHOT_SOURCE_SINK_H_ | 5 #ifndef V8_SNAPSHOT_SOURCE_SINK_H_ |
| 6 #define V8_SNAPSHOT_SOURCE_SINK_H_ | 6 #define V8_SNAPSHOT_SOURCE_SINK_H_ |
| 7 | 7 |
| 8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
| 9 #include "src/utils.h" | 9 #include "src/utils.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Source to read snapshot and builtins files from. | 16 * Source to read snapshot and builtins files from. |
| 17 * | 17 * |
| 18 * Note: Memory ownership remains with callee. | 18 * Note: Memory ownership remains with callee. |
| 19 */ | 19 */ |
| 20 class SnapshotByteSource FINAL { | 20 class SnapshotByteSource FINAL { |
| 21 public: | 21 public: |
| 22 SnapshotByteSource(const byte* array, int length); | 22 SnapshotByteSource(const byte* array, int length); |
| 23 ~SnapshotByteSource(); | 23 ~SnapshotByteSource(); |
| 24 | 24 |
| 25 bool HasMore() { return position_ < length_; } | 25 bool HasMore() { return position_ < length_; } |
| 26 | 26 |
| 27 int Get() { | 27 uint8_t Get() { |
|
mvstanton
2014/12/03 08:22:41
For simplicity, can the List<byte> below be a List
Yang
2014/12/03 08:45:07
Done.
| |
| 28 DCHECK(position_ < length_); | 28 DCHECK(position_ < length_); |
| 29 return data_[position_++]; | 29 return data_[position_++]; |
| 30 } | 30 } |
| 31 | 31 |
| 32 int32_t GetUnalignedInt(); | 32 int32_t GetUnalignedInt(); |
| 33 | 33 |
| 34 void Advance(int by) { position_ += by; } | 34 void Advance(int by) { position_ += by; } |
| 35 | 35 |
| 36 void CopyRaw(byte* to, int number_of_bytes); | 36 void CopyRaw(byte* to, int number_of_bytes); |
| 37 | 37 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 const List<byte>& data() const { return data_; } | 90 const List<byte>& data() const { return data_; } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 List<byte> data_; | 93 List<byte> data_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace v8::internal | 96 } // namespace v8::internal |
| 97 } // namespace v8 | 97 } // namespace v8 |
| 98 | 98 |
| 99 #endif // V8_SNAPSHOT_SOURCE_SINK_H_ | 99 #endif // V8_SNAPSHOT_SOURCE_SINK_H_ |
| OLD | NEW |