| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 initial_size_)); | 151 initial_size_)); |
| 152 if (*buffer_ == NULL) { | 152 if (*buffer_ == NULL) { |
| 153 Exceptions::ThrowOOM(); | 153 Exceptions::ThrowOOM(); |
| 154 } | 154 } |
| 155 current_ = *buffer_; | 155 current_ = *buffer_; |
| 156 current_size_ = initial_size_; | 156 current_size_ = initial_size_; |
| 157 end_ = *buffer_ + initial_size_; | 157 end_ = *buffer_ + initial_size_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 uint8_t* buffer() const { return *buffer_; } | 160 uint8_t* buffer() const { return *buffer_; } |
| 161 int bytes_written() const { return current_ - *buffer_; } | 161 intptr_t bytes_written() const { return current_ - *buffer_; } |
| 162 | 162 |
| 163 void set_current(uint8_t* value) { current_ = value; } | 163 void set_current(uint8_t* value) { current_ = value; } |
| 164 | 164 |
| 165 template<int N, typename T> | 165 template<int N, typename T> |
| 166 class Raw { }; | 166 class Raw { }; |
| 167 | 167 |
| 168 template<typename T> | 168 template<typename T> |
| 169 class Raw<1, T> { | 169 class Raw<1, T> { |
| 170 public: | 170 public: |
| 171 static void Write(WriteStream* st, T value) { | 171 static void Write(WriteStream* st, T value) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 intptr_t current_size_; | 262 intptr_t current_size_; |
| 263 ReAlloc alloc_; | 263 ReAlloc alloc_; |
| 264 intptr_t initial_size_; | 264 intptr_t initial_size_; |
| 265 | 265 |
| 266 DISALLOW_COPY_AND_ASSIGN(WriteStream); | 266 DISALLOW_COPY_AND_ASSIGN(WriteStream); |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 } // namespace dart | 269 } // namespace dart |
| 270 | 270 |
| 271 #endif // VM_DATASTREAM_H_ | 271 #endif // VM_DATASTREAM_H_ |
| OLD | NEW |