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

Side by Side Diff: sdk/lib/io/file_impl.dart

Issue 13998008: Add support for even more typed data on native ports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « sdk/lib/io/common.dart ('k') | tests/standalone/io/file_typed_data_test.dart » ('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 part of dart.io; 5 part of dart.io;
6 6
7 // Read the file in blocks of size 64k. 7 // Read the file in blocks of size 64k.
8 const int _BLOCK_SIZE = 64 * 1024; 8 const int _BLOCK_SIZE = 64 * 1024;
9 9
10 10
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 if (result is OSError) { 806 if (result is OSError) {
807 throw new FileIOException("writeByte failed for file '$_path'", 807 throw new FileIOException("writeByte failed for file '$_path'",
808 result); 808 result);
809 } 809 }
810 return result; 810 return result;
811 } 811 }
812 812
813 Future<RandomAccessFile> writeList(List<int> buffer, int offset, int bytes) { 813 Future<RandomAccessFile> writeList(List<int> buffer, int offset, int bytes) {
814 _ensureFileService(); 814 _ensureFileService();
815 Completer<RandomAccessFile> completer = new Completer<RandomAccessFile>(); 815 Completer<RandomAccessFile> completer = new Completer<RandomAccessFile>();
816 if (buffer is !List || offset is !int || bytes is !int) { 816 if ((buffer is !List && buffer is !ByteData) ||
Anders Johnsen 2013/04/15 15:46:17 DBC: I believe this is wrong. We should not suppor
817 offset is !int ||
818 bytes is !int) {
817 // Complete asynchronously so the user has a chance to setup 819 // Complete asynchronously so the user has a chance to setup
818 // handlers without getting exceptions when registering the 820 // handlers without getting exceptions when registering the
819 // then handler. 821 // then handler.
820 Timer.run(() { 822 Timer.run(() {
821 completer.completeError(new FileIOException( 823 completer.completeError(new FileIOException(
822 "Invalid arguments to writeList for file '$_path'")); 824 "Invalid arguments to writeList for file '$_path'"));
823 }); 825 });
824 return completer.future; 826 return completer.future;
825 } 827 }
826 if (closed) return _completeWithClosedException(completer); 828 if (closed) return _completeWithClosedException(completer);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 new FileIOException("File closed '$_path'")); 1052 new FileIOException("File closed '$_path'"));
1051 }); 1053 });
1052 return completer.future; 1054 return completer.future;
1053 } 1055 }
1054 1056
1055 final String _path; 1057 final String _path;
1056 int _id; 1058 int _id;
1057 1059
1058 SendPort _fileService; 1060 SendPort _fileService;
1059 } 1061 }
OLDNEW
« no previous file with comments | « sdk/lib/io/common.dart ('k') | tests/standalone/io/file_typed_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698