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

Side by Side Diff: runtime/bin/file_impl.dart

Issue 10887023: Use new try-catch syntax in runtime/, tools/, and utils/. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/bin/http_impl.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class _FileInputStream extends _BaseDataInputStream implements InputStream { 5 class _FileInputStream extends _BaseDataInputStream implements InputStream {
6 _FileInputStream(String name) 6 _FileInputStream(String name)
7 : _data = const [], 7 : _data = const [],
8 _position = 0, 8 _position = 0,
9 _filePosition = 0 { 9 _filePosition = 0 {
10 var file = new File(name); 10 var file = new File(name);
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 "Invalid arguments to writeList for file '$_name'")); 937 "Invalid arguments to writeList for file '$_name'"));
938 }); 938 });
939 return completer.future; 939 return completer.future;
940 } 940 }
941 if (closed) return _completeWithClosedException(completer); 941 if (closed) return _completeWithClosedException(completer);
942 942
943 List result; 943 List result;
944 try { 944 try {
945 result = 945 result =
946 _FileUtils.ensureFastAndSerializableBuffer(buffer, offset, bytes); 946 _FileUtils.ensureFastAndSerializableBuffer(buffer, offset, bytes);
947 } catch (var e) { 947 } catch (e) {
948 // Complete asynchronously so the user has a chance to setup 948 // Complete asynchronously so the user has a chance to setup
949 // handlers without getting exceptions when registering the 949 // handlers without getting exceptions when registering the
950 // then handler. 950 // then handler.
951 new Timer(0, (t) => completer.completeException(e)); 951 new Timer(0, (t) => completer.completeException(e));
952 return completer.future; 952 return completer.future;
953 } 953 }
954 List outBuffer = result[0]; 954 List outBuffer = result[0];
955 int outOffset = result[1]; 955 int outOffset = result[1];
956 956
957 List request = new List(5); 957 List request = new List(5);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 new FileIOException("File closed '$_name'")); 1161 new FileIOException("File closed '$_name'"));
1162 }); 1162 });
1163 return completer.future; 1163 return completer.future;
1164 } 1164 }
1165 1165
1166 final String _name; 1166 final String _name;
1167 int _id; 1167 int _id;
1168 1168
1169 SendPort _fileService; 1169 SendPort _fileService;
1170 } 1170 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698