| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:_mojo_services/mojo/files/types.mojom.dart' as types; | 5 import 'dart:_mojo_services/mojo/files/types.mojom.dart' as types; |
| 6 | 6 |
| 7 // | 7 // |
| 8 // Implementation of Directory, File, and RandomAccessFile for Mojo. | 8 // Implementation of Directory, File, and RandomAccessFile for Mojo. |
| 9 // | 9 // |
| 10 | 10 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 throw new UnimplementedError(); | 597 throw new UnimplementedError(); |
| 598 } | 598 } |
| 599 /* patch */ static _resolveSymbolicLinks(String path) { | 599 /* patch */ static _resolveSymbolicLinks(String path) { |
| 600 throw new UnimplementedError(); | 600 throw new UnimplementedError(); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 patch class _Link { | 604 patch class _Link { |
| 605 } | 605 } |
| 606 | 606 |
| 607 patch class _RandomAccessFileOps { |
| 608 /* patch */ factory _RandomAccessFileOps(int pointer) |
| 609 => new _RandomAccessFileOpsImpl(pointer); |
| 610 } |
| 611 |
| 612 class _RandomAccessFileOpsImpl implements _RandomAccessFileOps { |
| 613 int _pointer; |
| 614 |
| 615 _RandomAccessFileOpsImpl(this._pointer); |
| 616 |
| 617 int getPointer() => _pointer; |
| 618 int close() => throw new UnimplementedError(); |
| 619 readByte() => throw new UnimplementedError(); |
| 620 read(int bytes) => throw new UnimplementedError(); |
| 621 readInto(List<int> buffer, int start, int end) |
| 622 => throw new UnimplementedError(); |
| 623 writeByte(int value) => throw new UnimplementedError(); |
| 624 writeFrom(List<int> buffer, int start, int end) |
| 625 => throw new UnimplementedError(); |
| 626 position() => throw new UnimplementedError(); |
| 627 setPosition(int position) => throw new UnimplementedError(); |
| 628 truncate(int length) => throw new UnimplementedError(); |
| 629 length() => throw new UnimplementedError(); |
| 630 flush() => throw new UnimplementedError(); |
| 631 lock(int lock, int start, int end) => throw new UnimplementedError(); |
| 632 } |
| 607 | 633 |
| 608 patch class _RandomAccessFile { | 634 patch class _RandomAccessFile { |
| 609 FileProxy _proxy; | 635 FileProxy _proxy; |
| 610 | 636 |
| 611 void _ensureProxy() { | 637 void _ensureProxy() { |
| 612 if (_proxy == null) { | 638 if (_proxy == null) { |
| 613 throw new StateError("_RandomAccessFile has a null proxy."); | 639 throw new StateError("_RandomAccessFile has a null proxy."); |
| 614 } | 640 } |
| 615 } | 641 } |
| 616 | 642 |
| 617 void _handleError(dynamic response) { | 643 void _handleError(dynamic response) { |
| 618 if (response.error != types.Error.ok) { | 644 if (response.error != types.Error.ok) { |
| 619 throw _OSErrorFromError(response.error); | 645 throw _OSErrorFromError(response.error); |
| 620 } | 646 } |
| 621 } | 647 } |
| 622 | 648 |
| 623 /* patch */ Future<RandomAccessFile> close() async { | 649 /* patch */ Future<RandomAccessFile> close() async { |
| 624 _ensureProxy(); | 650 _ensureProxy(); |
| 625 await _proxy.responseOrError(_proxy.ptr.close()); | 651 await _proxy.responseOrError(_proxy.ptr.close()); |
| 626 await _proxy.close(immediate: true); | 652 await _proxy.close(immediate: true); |
| 627 _proxy = null; | 653 _proxy = null; |
| 628 _id = 0; | 654 closed = true; |
| 629 _maybePerformCleanup(); | 655 _maybePerformCleanup(); |
| 630 return this; | 656 return this; |
| 631 } | 657 } |
| 632 | 658 |
| 633 /* patch */ void closeSync() { | 659 /* patch */ void closeSync() { |
| 634 _onSyncOperation(); | 660 _onSyncOperation(); |
| 635 } | 661 } |
| 636 | 662 |
| 637 /* patch */ Future<int> readByte() async { | 663 /* patch */ Future<int> readByte() async { |
| 638 _ensureProxy(); | 664 _ensureProxy(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 828 |
| 803 /* patch */ Future<RandomAccessFile> flush() { | 829 /* patch */ Future<RandomAccessFile> flush() { |
| 804 return this; | 830 return this; |
| 805 } | 831 } |
| 806 | 832 |
| 807 /* patch */ void flushSync() { | 833 /* patch */ void flushSync() { |
| 808 _onSyncOperation(); | 834 _onSyncOperation(); |
| 809 } | 835 } |
| 810 | 836 |
| 811 /* patch */ Future<RandomAccessFile> lock( | 837 /* patch */ Future<RandomAccessFile> lock( |
| 812 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end]) { | 838 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]) { |
| 813 throw new UnsupportedError( | 839 throw new UnsupportedError( |
| 814 "File locking is not supported by this embedder"); | 840 "File locking is not supported by this embedder"); |
| 815 } | 841 } |
| 816 | 842 |
| 817 /* patch */ Future<RandomAccessFile> unlock([int start = 0, int end]) { | 843 /* patch */ Future<RandomAccessFile> unlock([int start = 0, int end = -1]) { |
| 818 throw new UnsupportedError( | 844 throw new UnsupportedError( |
| 819 "File locking is not supported by this embedder"); | 845 "File locking is not supported by this embedder"); |
| 820 } | 846 } |
| 821 | 847 |
| 822 /* patch */ void lockSync( | 848 /* patch */ void lockSync( |
| 823 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end]) { | 849 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end]) { |
| 824 _onSyncOperation(); | 850 _onSyncOperation(); |
| 825 } | 851 } |
| 826 | 852 |
| 827 /* patch */ void unlockSync([int start = 0, int end]) { | 853 /* patch */ void unlockSync([int start = 0, int end]) { |
| 828 _onSyncOperation(); | 854 _onSyncOperation(); |
| 829 } | 855 } |
| 830 | |
| 831 /* patch */ bool get closed => _id == 0; | |
| 832 | |
| 833 /* patch */ static int _close(int id) { | |
| 834 throw new UnimplementedError(); | |
| 835 } | |
| 836 | |
| 837 /* patch */ static int _getFD(int id) { | |
| 838 throw new UnimplementedError(); | |
| 839 } | |
| 840 | |
| 841 /* patch */ static _readByte(int id) { | |
| 842 throw new UnimplementedError(); | |
| 843 } | |
| 844 | |
| 845 /* patch */ static _read(int id, int bytes) { | |
| 846 throw new UnimplementedError(); | |
| 847 } | |
| 848 | |
| 849 /* patch */ static _readInto(int id, List<int> buffer, int start, int end) { | |
| 850 throw new UnimplementedError(); | |
| 851 } | |
| 852 | |
| 853 /* patch */ static _writeByte(int id, int value) { | |
| 854 throw new UnimplementedError(); | |
| 855 } | |
| 856 | |
| 857 /* patch */ static _writeFrom(int id, List<int> buffer, int start, int end) { | |
| 858 throw new UnimplementedError(); | |
| 859 } | |
| 860 | |
| 861 /* patch */ static _position(int id) { | |
| 862 throw new UnimplementedError(); | |
| 863 } | |
| 864 | |
| 865 /* patch */ static _setPosition(int id, int position) { | |
| 866 throw new UnimplementedError(); | |
| 867 } | |
| 868 | |
| 869 /* patch */ static _truncate(int id, int length) { | |
| 870 throw new UnimplementedError(); | |
| 871 } | |
| 872 | |
| 873 /* patch */ static _length(int id) { | |
| 874 throw new UnimplementedError(); | |
| 875 } | |
| 876 | |
| 877 /* patch */ static _flush(int id) { | |
| 878 throw new UnimplementedError(); | |
| 879 } | |
| 880 | |
| 881 /* patch */ static _lock(int id, int lock, int start, int end) { | |
| 882 throw new UnimplementedError(); | |
| 883 } | |
| 884 } | 856 } |
| OLD | NEW |