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

Side by Side Diff: runtime/lib/typeddata.dart

Issue 12938010: Implement creation of ByteData objects using the Dart API. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 patch class Int8List { 7 patch class Int8List {
8 /* patch */ factory Int8List(int length) { 8 /* patch */ factory Int8List(int length) {
9 return new _Int8Array(length); 9 return new _Int8Array(length);
10 } 10 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 static _ExternalFloat64Array _newTransferable(int length) { 222 static _ExternalFloat64Array _newTransferable(int length) {
223 return new _ExternalFloat64Array(length); 223 return new _ExternalFloat64Array(length);
224 } 224 }
225 } 225 }
226 226
227 227
228 patch class ByteData { 228 patch class ByteData {
229 /* patch */ factory ByteData(int length) { 229 /* patch */ factory ByteData(int length) {
230 var list = new _Uint8Array(length); 230 var list = new _Uint8Array(length);
231 return new _ByteDataView(list.buffer); 231 return new _ByteDataView(list.buffer, 0, length);
232 } 232 }
233 233
234 /* patch */ factory ByteData.transferable(int length) { 234 /* patch */ factory ByteData.transferable(int length) {
235 var list = new _Uint8Array.transferable(length); 235 var list = new _Uint8Array.transferable(length);
236 return new _ByteDataView(list.buffer); 236 return new _ByteDataView(list.buffer, 0, length);
237 } 237 }
238 238
239 /* patch */ factory ByteData.view(ByteBuffer buffer, 239 /* patch */ factory ByteData.view(ByteBuffer buffer,
240 [int offsetInBytes = 0, int length]) { 240 [int offsetInBytes = 0, int length]) {
241 if (length == null) { 241 if (length == null) {
242 length = buffer.lengthInBytes; 242 length = buffer.lengthInBytes;
243 } 243 }
244 return new _ByteDataView(buffer, offsetInBytes, length); 244 return new _ByteDataView(buffer, offsetInBytes, length);
245 } 245 }
246 } 246 }
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 } 2628 }
2629 } 2629 }
2630 2630
2631 2631
2632 int _defaultIfNull(object, value) { 2632 int _defaultIfNull(object, value) {
2633 if (object == null) { 2633 if (object == null) {
2634 return value; 2634 return value;
2635 } 2635 }
2636 return object; 2636 return object;
2637 } 2637 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698