OLD | NEW |
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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 } | 588 } |
589 | 589 |
590 external static int _getFD(int id); | 590 external static int _getFD(int id); |
591 | 591 |
592 _maybeConnectHandler() { | 592 _maybeConnectHandler() { |
593 if (!_connectedResourceHandler) { | 593 if (!_connectedResourceHandler) { |
594 // TODO(ricow): we probably need set these in some initialization code. | 594 // TODO(ricow): we probably need set these in some initialization code. |
595 // We need to make sure that these are always awailable from the | 595 // We need to make sure that these are always awailable from the |
596 // observatory even if no files (or sockets for the socket ones) are | 596 // observatory even if no files (or sockets for the socket ones) are |
597 // open. | 597 // open. |
598 registerExtension('__getOpenFiles', | 598 registerExtension('ext.dart.io.getOpenFiles', |
599 _FileResourceInfo.getOpenFiles); | 599 _FileResourceInfo.getOpenFiles); |
600 registerExtension('__getFileByID', | 600 registerExtension('ext.dart.io.getFileByID', |
601 _FileResourceInfo.getFileInfoMapByID); | 601 _FileResourceInfo.getFileInfoMapByID); |
602 _connectedResourceHandler = true; | 602 _connectedResourceHandler = true; |
603 } | 603 } |
604 } | 604 } |
605 | 605 |
606 Future<RandomAccessFile> close() { | 606 Future<RandomAccessFile> close() { |
607 return _dispatch(_FILE_CLOSE, [_id], markClosed: true).then((result) { | 607 return _dispatch(_FILE_CLOSE, [_id], markClosed: true).then((result) { |
608 if (result != -1) { | 608 if (result != -1) { |
609 _id = result; | 609 _id = result; |
610 _maybePerformCleanup(); | 610 _maybePerformCleanup(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 void _checkAvailable() { | 1019 void _checkAvailable() { |
1020 if (_asyncDispatched) { | 1020 if (_asyncDispatched) { |
1021 throw new FileSystemException("An async operation is currently pending", | 1021 throw new FileSystemException("An async operation is currently pending", |
1022 path); | 1022 path); |
1023 } | 1023 } |
1024 if (closed) { | 1024 if (closed) { |
1025 throw new FileSystemException("File closed", path); | 1025 throw new FileSystemException("File closed", path); |
1026 } | 1026 } |
1027 } | 1027 } |
1028 } | 1028 } |
OLD | NEW |