| Index: runtime/bin/dartutils.cc
|
| diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
|
| index 339b036869130f4aa9e1a7f286b43844905ddbc6..6257db653b094b879a50c19944d3bc52e1f99bdb 100644
|
| --- a/runtime/bin/dartutils.cc
|
| +++ b/runtime/bin/dartutils.cc
|
| @@ -7,6 +7,7 @@
|
| #include "bin/extensions.h"
|
| #include "bin/directory.h"
|
| #include "bin/file.h"
|
| +#include "bin/io_buffer.h"
|
| #include "include/dart_api.h"
|
| #include "platform/assert.h"
|
| #include "platform/globals.h"
|
| @@ -671,6 +672,20 @@ Dart_CObject* CObject::NewExternalUint8Array(int64_t length,
|
| }
|
|
|
|
|
| +Dart_CObject* CObject::NewIOBuffer(int64_t length) {
|
| + uint8_t* data = IOBuffer::Allocate(length);
|
| + return NewExternalUint8Array(length, data, data, IOBuffer::Free);
|
| +}
|
| +
|
| +
|
| +void CObject::FreeIOBufferData(Dart_CObject* cobject) {
|
| + ASSERT(cobject->type == Dart_CObject::kExternalUint8Array);
|
| + cobject->value.as_external_byte_array.callback(
|
| + cobject->value.as_external_byte_array.peer);
|
| + cobject->value.as_external_byte_array.data = NULL;
|
| +}
|
| +
|
| +
|
| static int kArgumentError = 1;
|
| static int kOSError = 2;
|
| static int kFileClosedError = 3;
|
|
|