| OLD | NEW |
| 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 @patch | 5 @patch |
| 6 class _File { | 6 class _File { |
| 7 @patch | 7 @patch |
| 8 static _exists(String path) native "File_Exists"; | 8 static _exists(_Namespace namespace, String path) native "File_Exists"; |
| 9 @patch | 9 @patch |
| 10 static _create(String path) native "File_Create"; | 10 static _create(_Namespace namespace, String path) native "File_Create"; |
| 11 @patch | 11 @patch |
| 12 static _createLink(String path, String target) native "File_CreateLink"; | 12 static _createLink(_Namespace namespace, String path, String target) |
| 13 native "File_CreateLink"; |
| 13 @patch | 14 @patch |
| 14 static _linkTarget(String path) native "File_LinkTarget"; | 15 static _linkTarget(_Namespace namespace, String path) |
| 16 native "File_LinkTarget"; |
| 15 @patch | 17 @patch |
| 16 static _deleteNative(String path) native "File_Delete"; | 18 static _deleteNative(_Namespace namespace, String path) native "File_Delete"; |
| 17 @patch | 19 @patch |
| 18 static _deleteLinkNative(String path) native "File_DeleteLink"; | 20 static _deleteLinkNative(_Namespace namespace, String path) |
| 21 native "File_DeleteLink"; |
| 19 @patch | 22 @patch |
| 20 static _rename(String oldPath, String newPath) native "File_Rename"; | 23 static _rename(_Namespace namespace, String oldPath, String newPath) |
| 24 native "File_Rename"; |
| 21 @patch | 25 @patch |
| 22 static _renameLink(String oldPath, String newPath) native "File_RenameLink"; | 26 static _renameLink(_Namespace namespace, String oldPath, String newPath) |
| 27 native "File_RenameLink"; |
| 23 @patch | 28 @patch |
| 24 static _copy(String oldPath, String newPath) native "File_Copy"; | 29 static _copy(_Namespace namespace, String oldPath, String newPath) |
| 30 native "File_Copy"; |
| 25 @patch | 31 @patch |
| 26 static _lengthFromPath(String path) native "File_LengthFromPath"; | 32 static _lengthFromPath(_Namespace namespace, String path) |
| 33 native "File_LengthFromPath"; |
| 27 @patch | 34 @patch |
| 28 static _lastModified(String path) native "File_LastModified"; | 35 static _lastModified(_Namespace namespace, String path) |
| 36 native "File_LastModified"; |
| 29 @patch | 37 @patch |
| 30 static _setLastModified(String path, int millis) | 38 static _setLastModified(_Namespace namespace, String path, int millis) |
| 31 native "File_SetLastModified"; | 39 native "File_SetLastModified"; |
| 32 @patch | 40 @patch |
| 33 static _lastAccessed(String path) native "File_LastAccessed"; | 41 static _lastAccessed(_Namespace namespace, String path) |
| 42 native "File_LastAccessed"; |
| 34 @patch | 43 @patch |
| 35 static _setLastAccessed(String path, int millis) | 44 static _setLastAccessed(_Namespace namespace, String path, int millis) |
| 36 native "File_SetLastAccessed"; | 45 native "File_SetLastAccessed"; |
| 37 @patch | 46 @patch |
| 38 static _open(String path, int mode) native "File_Open"; | 47 static _open(_Namespace namespace, String path, int mode) native "File_Open"; |
| 39 @patch | 48 @patch |
| 40 static int _openStdio(int fd) native "File_OpenStdio"; | 49 static int _openStdio(int fd) native "File_OpenStdio"; |
| 41 } | 50 } |
| 42 | 51 |
| 43 @patch | 52 @patch |
| 44 class _RandomAccessFileOps { | 53 class _RandomAccessFileOps { |
| 45 @patch | 54 @patch |
| 46 factory _RandomAccessFileOps(int pointer) => | 55 factory _RandomAccessFileOps(int pointer) => |
| 47 new _RandomAccessFileOpsImpl(pointer); | 56 new _RandomAccessFileOpsImpl(pointer); |
| 48 } | 57 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 _newWatcher(); | 136 _newWatcher(); |
| 128 } catch (e) { | 137 } catch (e) { |
| 129 _broadcastController.addError(new FileSystemException( | 138 _broadcastController.addError(new FileSystemException( |
| 130 "Failed to initialize file system entity watcher", null, e)); | 139 "Failed to initialize file system entity watcher", null, e)); |
| 131 _broadcastController.close(); | 140 _broadcastController.close(); |
| 132 return; | 141 return; |
| 133 } | 142 } |
| 134 } | 143 } |
| 135 var pathId; | 144 var pathId; |
| 136 try { | 145 try { |
| 137 pathId = _watchPath(_id, _path, _events, _recursive); | 146 pathId = |
| 147 _watchPath(_id, _Namespace._namespace, _path, _events, _recursive); |
| 138 } catch (e) { | 148 } catch (e) { |
| 139 _broadcastController | 149 _broadcastController |
| 140 .addError(new FileSystemException("Failed to watch path", _path, e)); | 150 .addError(new FileSystemException("Failed to watch path", _path, e)); |
| 141 _broadcastController.close(); | 151 _broadcastController.close(); |
| 142 return; | 152 return; |
| 143 } | 153 } |
| 144 if (!_idMap.containsKey(pathId)) { | 154 if (!_idMap.containsKey(pathId)) { |
| 145 _idMap[pathId] = new _WatcherPath(pathId, _path, _events); | 155 _idMap[pathId] = new _WatcherPath(pathId, _path, _events); |
| 146 } | 156 } |
| 147 _watcherPath = _idMap[pathId]; | 157 _watcherPath = _idMap[pathId]; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return events; | 293 return events; |
| 284 }); | 294 }); |
| 285 } | 295 } |
| 286 | 296 |
| 287 @patch | 297 @patch |
| 288 static bool get isSupported native "FileSystemWatcher_IsSupported"; | 298 static bool get isSupported native "FileSystemWatcher_IsSupported"; |
| 289 | 299 |
| 290 static int _initWatcher() native "FileSystemWatcher_InitWatcher"; | 300 static int _initWatcher() native "FileSystemWatcher_InitWatcher"; |
| 291 static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher"; | 301 static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher"; |
| 292 | 302 |
| 293 static int _watchPath(int id, String path, int events, bool recursive) | 303 static int _watchPath(int id, _Namespace namespace, String path, int events, |
| 294 native "FileSystemWatcher_WatchPath"; | 304 bool recursive) native "FileSystemWatcher_WatchPath"; |
| 295 static void _unwatchPath(int id, int path_id) | 305 static void _unwatchPath(int id, int path_id) |
| 296 native "FileSystemWatcher_UnwatchPath"; | 306 native "FileSystemWatcher_UnwatchPath"; |
| 297 static List _readEvents(int id, int path_id) | 307 static List _readEvents(int id, int path_id) |
| 298 native "FileSystemWatcher_ReadEvents"; | 308 native "FileSystemWatcher_ReadEvents"; |
| 299 static int _getSocketId(int id, int path_id) | 309 static int _getSocketId(int id, int path_id) |
| 300 native "FileSystemWatcher_GetSocketId"; | 310 native "FileSystemWatcher_GetSocketId"; |
| 301 } | 311 } |
| 302 | 312 |
| 303 class _InotifyFileSystemWatcher extends _FileSystemWatcher { | 313 class _InotifyFileSystemWatcher extends _FileSystemWatcher { |
| 304 static final Map<int, StreamController> _idMap = {}; | 314 static final Map<int, StreamController> _idMap = {}; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 403 |
| 394 void _pathWatchedEnd() { | 404 void _pathWatchedEnd() { |
| 395 _subscription.cancel(); | 405 _subscription.cancel(); |
| 396 _controller.close(); | 406 _controller.close(); |
| 397 } | 407 } |
| 398 } | 408 } |
| 399 | 409 |
| 400 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { | 410 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { |
| 401 return new Uint8List.view(source.buffer, offsetInBytes, length); | 411 return new Uint8List.view(source.buffer, offsetInBytes, length); |
| 402 } | 412 } |
| OLD | NEW |