Index: mojo/public/dart/src/data_pipe.dart |
diff --git a/mojo/public/dart/src/data_pipe.dart b/mojo/public/dart/src/data_pipe.dart |
index 9739be58b21cb787a12afe69cd1dfc14a7241532..927b1af6c590771f66e5911f8ccef8297647b03c 100644 |
--- a/mojo/public/dart/src/data_pipe.dart |
+++ b/mojo/public/dart/src/data_pipe.dart |
@@ -6,27 +6,24 @@ part of core; |
class _MojoDataPipeNatives { |
- static List MojoCreateDataPipe( |
- int elementBytes, int capacityBytes, int flags) |
- native "MojoDataPipe_Create"; |
+ external static List MojoCreateDataPipe(int elementBytes, int capacityBytes, |
+ int flags); |
- static List MojoWriteData(int handle, ByteData data, int numBytes, int flags) |
- native "MojoDataPipe_WriteData"; |
+ external static List MojoWriteData(int handle, ByteData data, int numBytes, |
+ int flags); |
- static List MojoBeginWriteData(int handle, int bufferBytes, int flags) |
- native "MojoDataPipe_BeginWriteData"; |
+ external static List MojoBeginWriteData(int handle, int bufferBytes, |
+ int flags); |
- static int MojoEndWriteData(int handle, int bytesWritten) |
- native "MojoDataPipe_EndWriteData"; |
+ external static int MojoEndWriteData(int handle, int bytesWritten); |
- static List MojoReadData(int handle, ByteData data, int numBytes, int flags) |
- native "MojoDataPipe_ReadData"; |
+ external static List MojoReadData(int handle, ByteData data, int numBytes, |
+ int flags); |
- static List MojoBeginReadData(int handle, int bufferBytes, int flags) |
- native "MojoDataPipe_BeginReadData"; |
+ external static List MojoBeginReadData(int handle, int bufferBytes, |
+ int flags); |
- static int MojoEndReadData(int handle, int bytesRead) |
- native "MojoDataPipe_EndReadData"; |
+ external static int MojoEndReadData(int handle, int bytesRead); |
} |
@@ -38,8 +35,8 @@ class MojoDataPipeProducer { |
MojoResult status; |
final int elementBytes; |
- MojoDataPipeProducer( |
- this.handle, [this.status = MojoResult.OK, this.elementBytes = 1]); |
+ MojoDataPipeProducer(this.handle, [this.status = MojoResult.OK, |
+ this.elementBytes = 1]); |
int write(ByteData data, [int numBytes = -1, int flags = 0]) { |
if (handle == null) { |
@@ -48,8 +45,8 @@ class MojoDataPipeProducer { |
} |
int data_numBytes = (numBytes == -1) ? data.lengthInBytes : numBytes; |
- List result = _MojoDataPipeNatives.MojoWriteData( |
- handle.h, data, data_numBytes, flags); |
+ List result = |
+ _MojoDataPipeNatives.MojoWriteData(handle.h, data, data_numBytes, flags); |
if (result == null) { |
status = MojoResult.INVALID_ARGUMENT; |
return status; |
@@ -66,8 +63,8 @@ class MojoDataPipeProducer { |
return null; |
} |
- List result = _MojoDataPipeNatives.MojoBeginWriteData( |
- handle.h, bufferBytes, flags); |
+ List result = |
+ _MojoDataPipeNatives.MojoBeginWriteData(handle.h, bufferBytes, flags); |
if (result == null) { |
status = MojoResult.INVALID_ARGUMENT; |
return null; |
@@ -101,8 +98,8 @@ class MojoDataPipeConsumer { |
MojoResult status; |
final int elementBytes; |
- MojoDataPipeConsumer( |
- this.handle, [this.status = MojoResult.OK, this.elementBytes = 1]); |
+ MojoDataPipeConsumer(this.handle, [this.status = MojoResult.OK, |
+ this.elementBytes = 1]); |
int read(ByteData data, [int numBytes = -1, int flags = 0]) { |
if (handle == null) { |
@@ -111,8 +108,8 @@ class MojoDataPipeConsumer { |
} |
int data_numBytes = (numBytes == -1) ? data.lengthInBytes : numBytes; |
- List result = _MojoDataPipeNatives.MojoReadData( |
- handle.h, data, data_numBytes, flags); |
+ List result = |
+ _MojoDataPipeNatives.MojoReadData(handle.h, data, data_numBytes, flags); |
if (result == null) { |
status = MojoResult.INVALID_ARGUMENT; |
return 0; |
@@ -128,8 +125,8 @@ class MojoDataPipeConsumer { |
return null; |
} |
- List result = _MojoDataPipeNatives.MojoBeginReadData( |
- handle.h, bufferBytes, flags); |
+ List result = |
+ _MojoDataPipeNatives.MojoBeginReadData(handle.h, bufferBytes, flags); |
if (result == null) { |
status = MojoResult.INVALID_ARGUMENT; |
return null; |
@@ -170,10 +167,9 @@ class MojoDataPipe { |
} |
factory MojoDataPipe([int elementBytes = DEFAULT_ELEMENT_SIZE, |
- int capacityBytes = DEFAULT_CAPACITY, |
- int flags = FLAG_NONE]) { |
- List result = _MojoDataPipeNatives.MojoCreateDataPipe( |
- elementBytes, capacityBytes, flags); |
+ int capacityBytes = DEFAULT_CAPACITY, int flags = FLAG_NONE]) { |
+ List result = |
+ _MojoDataPipeNatives.MojoCreateDataPipe(elementBytes, capacityBytes, flags); |
if (result == null) { |
return null; |
} |
@@ -182,9 +178,13 @@ class MojoDataPipe { |
MojoHandle consumerHandle = new MojoHandle(result[2]); |
MojoDataPipe pipe = new MojoDataPipe._internal(); |
pipe.producer = new MojoDataPipeProducer( |
- producerHandle, new MojoResult(result[0]), elementBytes); |
+ producerHandle, |
+ new MojoResult(result[0]), |
+ elementBytes); |
pipe.consumer = new MojoDataPipeConsumer( |
- consumerHandle, new MojoResult(result[0]), elementBytes); |
+ consumerHandle, |
+ new MojoResult(result[0]), |
+ elementBytes); |
pipe.status = new MojoResult(result[0]); |
return pipe; |
} |