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

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

Issue 9289042: Minor changes to the dart:io library files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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
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(File file) { 6 _FileInputStream(File file) {
7 _file = file.openSync(); 7 _file = file.openSync();
8 _length = _file.lengthSync(); 8 _length = _file.lengthSync();
9 _streamMarkedClosed = true; 9 _streamMarkedClosed = true;
10 _checkScheduleCallbacks(); 10 _checkScheduleCallbacks();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 } 88 }
89 89
90 RandomAccessFile _file; 90 RandomAccessFile _file;
91 } 91 }
92 92
93 93
94 class _FileOperation { 94 class _FileOperation {
95 abstract void execute(ReceivePort port); 95 abstract void execute(ReceivePort port);
96 96
97 SendPort set replyPort(SendPort port) { 97 void set replyPort(SendPort port) {
98 _replyPort = port; 98 _replyPort = port;
99 } 99 }
100 100
101 bool isWrite() => false; 101 bool isWrite() => false;
102 102
103 SendPort _replyPort; 103 SendPort _replyPort;
104 } 104 }
105 105
106 106
107 class _ExistsOperation extends _FileOperation { 107 class _ExistsOperation extends _FileOperation {
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 handler = (file) => file.close(); 582 handler = (file) => file.close();
583 } 583 }
584 var handleOpenResult = (id, ignored) { 584 var handleOpenResult = (id, ignored) {
585 if (id != 0) { 585 if (id != 0) {
586 var randomAccessFile = new _RandomAccessFile(id, _name); 586 var randomAccessFile = new _RandomAccessFile(id, _name);
587 handler(randomAccessFile); 587 handler(randomAccessFile);
588 } else if (_errorHandler != null) { 588 } else if (_errorHandler != null) {
589 _errorHandler("Cannot open file: $_name"); 589 _errorHandler("Cannot open file: $_name");
590 } 590 }
591 }; 591 };
592 var operation = new _OpenOperation(_name, mode.mode); 592 var operation = new _OpenOperation(_name, mode._mode);
593 _scheduler.enqueue(operation, handleOpenResult); 593 _scheduler.enqueue(operation, handleOpenResult);
594 } 594 }
595 595
596 RandomAccessFile openSync([FileMode mode = FileMode.READ]) { 596 RandomAccessFile openSync([FileMode mode = FileMode.READ]) {
597 if (_asyncUsed) { 597 if (_asyncUsed) {
598 throw new FileIOException( 598 throw new FileIOException(
599 "Mixed use of synchronous and asynchronous API"); 599 "Mixed use of synchronous and asynchronous API");
600 } 600 }
601 if (mode != FileMode.READ && 601 if (mode != FileMode.READ &&
602 mode != FileMode.WRITE && 602 mode != FileMode.WRITE &&
603 mode != FileMode.APPEND) { 603 mode != FileMode.APPEND) {
604 throw new FileIOException("Unknown file mode. Use FileMode.READ, " + 604 throw new FileIOException("Unknown file mode. Use FileMode.READ, " +
605 "FileMode.WRITE or FileMode.APPEND."); 605 "FileMode.WRITE or FileMode.APPEND.");
606 } 606 }
607 var id = _FileUtils.checkedOpen(_name, mode.mode); 607 var id = _FileUtils.checkedOpen(_name, mode._mode);
608 if (id == 0) { 608 if (id == 0) {
609 throw new FileIOException("Cannot open file: $_name"); 609 throw new FileIOException("Cannot open file: $_name");
610 } 610 }
611 return new _RandomAccessFile(id, _name); 611 return new _RandomAccessFile(id, _name);
612 } 612 }
613 613
614 void fullPath() { 614 void fullPath() {
615 _asyncUsed = true; 615 _asyncUsed = true;
616 var handler = _fullPathHandler; 616 var handler = _fullPathHandler;
617 if (handler == null) handler = (path) => null; 617 if (handler == null) handler = (path) => null;
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 var _readByteHandler; 1082 var _readByteHandler;
1083 var _readListHandler; 1083 var _readListHandler;
1084 var _noPendingWriteHandler; 1084 var _noPendingWriteHandler;
1085 var _positionHandler; 1085 var _positionHandler;
1086 var _setPositionHandler; 1086 var _setPositionHandler;
1087 var _truncateHandler; 1087 var _truncateHandler;
1088 var _lengthHandler; 1088 var _lengthHandler;
1089 var _flushHandler; 1089 var _flushHandler;
1090 var _errorHandler; 1090 var _errorHandler;
1091 } 1091 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698