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

Unified Diff: runtime/bin/io_buffer.h

Issue 11438045: Make all allocation of external arrays used for IO use the IOBuffer class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/io_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/io_buffer.h
diff --git a/runtime/bin/io_buffer.h b/runtime/bin/io_buffer.h
index c9a72877e0c74b054e3a97db163555c589410cad..69a5c09b2b6240e5bd46953a66c9664a73e5fc68 100644
--- a/runtime/bin/io_buffer.h
+++ b/runtime/bin/io_buffer.h
@@ -11,8 +11,19 @@
class IOBuffer {
public:
+ // Allocate an IO buffer dart object (of type Uint8List) backed by
+ // an external byte array.
static Dart_Handle Allocate(intptr_t size, uint8_t **buffer);
+ // Allocate IO buffer storage.
+ static uint8_t* Allocate(intptr_t size);
+
+ // Function for disposing of IO buffer storage. All backing storage
+ // for IO buffers must be freed using this function.
+ static void Free(void* buffer) {
+ delete[] reinterpret_cast<uint8_t*>(buffer);
+ }
+
private:
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer);
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/io_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698