Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: runtime/vm/datastream.h

Issue 2650693004: VM: Fix memory leaks during isolate spawning (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 RUNTIME_VM_DATASTREAM_H_ 5 #ifndef RUNTIME_VM_DATASTREAM_H_
6 #define RUNTIME_VM_DATASTREAM_H_ 6 #define RUNTIME_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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 *buffer_ = reinterpret_cast<uint8_t*>(alloc_(NULL, 0, initial_size_)); 303 *buffer_ = reinterpret_cast<uint8_t*>(alloc_(NULL, 0, initial_size_));
304 if (*buffer_ == NULL) { 304 if (*buffer_ == NULL) {
305 Exceptions::ThrowOOM(); 305 Exceptions::ThrowOOM();
306 } 306 }
307 current_ = *buffer_; 307 current_ = *buffer_;
308 current_size_ = initial_size_; 308 current_size_ = initial_size_;
309 end_ = *buffer_ + initial_size_; 309 end_ = *buffer_ + initial_size_;
310 } 310 }
311 311
312 uint8_t* buffer() const { return *buffer_; } 312 uint8_t* buffer() const { return *buffer_; }
313 void set_buffer(uint8_t* value) { *buffer_ = value; }
313 intptr_t bytes_written() const { return current_ - *buffer_; } 314 intptr_t bytes_written() const { return current_ - *buffer_; }
314 315
315 void set_current(uint8_t* value) { current_ = value; } 316 void set_current(uint8_t* value) { current_ = value; }
316 317
317 void Align(intptr_t alignment) { 318 void Align(intptr_t alignment) {
318 intptr_t position = current_ - *buffer_; 319 intptr_t position = current_ - *buffer_;
319 position = Utils::RoundUp(position, alignment); 320 position = Utils::RoundUp(position, alignment);
320 current_ = *buffer_ + position; 321 current_ = *buffer_ + position;
321 } 322 }
322 323
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 intptr_t current_size_; 457 intptr_t current_size_;
457 ReAlloc alloc_; 458 ReAlloc alloc_;
458 intptr_t initial_size_; 459 intptr_t initial_size_;
459 460
460 DISALLOW_COPY_AND_ASSIGN(WriteStream); 461 DISALLOW_COPY_AND_ASSIGN(WriteStream);
461 }; 462 };
462 463
463 } // namespace dart 464 } // namespace dart
464 465
465 #endif // RUNTIME_VM_DATASTREAM_H_ 466 #endif // RUNTIME_VM_DATASTREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698