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

Side by Side Diff: mojo/public/dart/src/data_pipe.dart

Issue 953953003: Introduce dartanalyze into our build. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: mojob integration Created 5 years, 10 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 | « mojo/public/dart/src/codec.dart ('k') | mojo/public/tools/dart_analyze.py » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 part of core; 5 part of core;
6 6
7 7
8 class _MojoDataPipeNatives { 8 class _MojoDataPipeNatives {
9 static List MojoCreateDataPipe( 9 static List MojoCreateDataPipe(
10 int elementBytes, int capacityBytes, int flags) 10 int elementBytes, int capacityBytes, int flags)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 MojoHandle handle; 100 MojoHandle handle;
101 MojoResult status; 101 MojoResult status;
102 final int elementBytes; 102 final int elementBytes;
103 103
104 MojoDataPipeConsumer( 104 MojoDataPipeConsumer(
105 this.handle, [this.status = MojoResult.OK, this.elementBytes = 1]); 105 this.handle, [this.status = MojoResult.OK, this.elementBytes = 1]);
106 106
107 int read(ByteData data, [int numBytes = -1, int flags = 0]) { 107 int read(ByteData data, [int numBytes = -1, int flags = 0]) {
108 if (handle == null) { 108 if (handle == null) {
109 status = MojoResult.INVALID_ARGUMENT; 109 status = MojoResult.INVALID_ARGUMENT;
110 return status; 110 return 0;
111 } 111 }
112 112
113 int data_numBytes = (numBytes == -1) ? data.lengthInBytes : numBytes; 113 int data_numBytes = (numBytes == -1) ? data.lengthInBytes : numBytes;
114 List result = _MojoDataPipeNatives.MojoReadData( 114 List result = _MojoDataPipeNatives.MojoReadData(
115 handle.h, data, data_numBytes, flags); 115 handle.h, data, data_numBytes, flags);
116 if (result == null) { 116 if (result == null) {
117 status = MojoResult.INVALID_ARGUMENT; 117 status = MojoResult.INVALID_ARGUMENT;
118 return status; 118 return 0;
119 } 119 }
120 assert((result is List) && (result.length == 2)); 120 assert((result is List) && (result.length == 2));
121 status = new MojoResult(result[0]); 121 status = new MojoResult(result[0]);
122 return result[1]; 122 return result[1];
123 } 123 }
124 124
125 ByteData beginRead([int bufferBytes = 0, int flags = 0]) { 125 ByteData beginRead([int bufferBytes = 0, int flags = 0]) {
126 if (handle == null) { 126 if (handle == null) {
127 status = MojoResult.INVALID_ARGUMENT; 127 status = MojoResult.INVALID_ARGUMENT;
128 return null; 128 return null;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 MojoHandle consumerHandle = new MojoHandle(result[2]); 182 MojoHandle consumerHandle = new MojoHandle(result[2]);
183 MojoDataPipe pipe = new MojoDataPipe._internal(); 183 MojoDataPipe pipe = new MojoDataPipe._internal();
184 pipe.producer = new MojoDataPipeProducer( 184 pipe.producer = new MojoDataPipeProducer(
185 producerHandle, new MojoResult(result[0]), elementBytes); 185 producerHandle, new MojoResult(result[0]), elementBytes);
186 pipe.consumer = new MojoDataPipeConsumer( 186 pipe.consumer = new MojoDataPipeConsumer(
187 consumerHandle, new MojoResult(result[0]), elementBytes); 187 consumerHandle, new MojoResult(result[0]), elementBytes);
188 pipe.status = new MojoResult(result[0]); 188 pipe.status = new MojoResult(result[0]);
189 return pipe; 189 return pipe;
190 } 190 }
191 } 191 }
OLDNEW
« no previous file with comments | « mojo/public/dart/src/codec.dart ('k') | mojo/public/tools/dart_analyze.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698