OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_DATASTREAM_H_ | 5 #ifndef VM_DATASTREAM_H_ |
6 #define VM_DATASTREAM_H_ | 6 #define VM_DATASTREAM_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 const uint8_t* AddressOfCurrentPosition() const { | 92 const uint8_t* AddressOfCurrentPosition() const { |
93 return current_; | 93 return current_; |
94 } | 94 } |
95 | 95 |
96 void Advance(intptr_t value) { | 96 void Advance(intptr_t value) { |
97 ASSERT((end_ - current_) > value); | 97 ASSERT((end_ - current_) > value); |
98 current_ = current_ + value; | 98 current_ = current_ + value; |
99 } | 99 } |
100 | 100 |
| 101 intptr_t PendingBytes() const { |
| 102 ASSERT(end_ >= current_); |
| 103 return (end_ - current_); |
| 104 } |
| 105 |
101 private: | 106 private: |
102 template<typename T> | 107 template<typename T> |
103 T Read() { | 108 T Read() { |
104 return Read<T>(kEndByteMarker); | 109 return Read<T>(kEndByteMarker); |
105 } | 110 } |
106 | 111 |
107 int16_t Read16() { | 112 int16_t Read16() { |
108 return Read16(kEndByteMarker); | 113 return Read16(kEndByteMarker); |
109 } | 114 } |
110 | 115 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 intptr_t current_size_; | 433 intptr_t current_size_; |
429 ReAlloc alloc_; | 434 ReAlloc alloc_; |
430 intptr_t initial_size_; | 435 intptr_t initial_size_; |
431 | 436 |
432 DISALLOW_COPY_AND_ASSIGN(WriteStream); | 437 DISALLOW_COPY_AND_ASSIGN(WriteStream); |
433 }; | 438 }; |
434 | 439 |
435 } // namespace dart | 440 } // namespace dart |
436 | 441 |
437 #endif // VM_DATASTREAM_H_ | 442 #endif // VM_DATASTREAM_H_ |
OLD | NEW |