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

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

Issue 2654443003: Revert "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
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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; }
314 intptr_t bytes_written() const { return current_ - *buffer_; } 313 intptr_t bytes_written() const { return current_ - *buffer_; }
315 314
316 void set_current(uint8_t* value) { current_ = value; } 315 void set_current(uint8_t* value) { current_ = value; }
317 316
318 void Align(intptr_t alignment) { 317 void Align(intptr_t alignment) {
319 intptr_t position = current_ - *buffer_; 318 intptr_t position = current_ - *buffer_;
320 position = Utils::RoundUp(position, alignment); 319 position = Utils::RoundUp(position, alignment);
321 current_ = *buffer_ + position; 320 current_ = *buffer_ + position;
322 } 321 }
323 322
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 intptr_t current_size_; 456 intptr_t current_size_;
458 ReAlloc alloc_; 457 ReAlloc alloc_;
459 intptr_t initial_size_; 458 intptr_t initial_size_;
460 459
461 DISALLOW_COPY_AND_ASSIGN(WriteStream); 460 DISALLOW_COPY_AND_ASSIGN(WriteStream);
462 }; 461 };
463 462
464 } // namespace dart 463 } // namespace dart
465 464
466 #endif // RUNTIME_VM_DATASTREAM_H_ 465 #endif // RUNTIME_VM_DATASTREAM_H_
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698