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

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

Issue 3001963002: [dart:io] Namespaces for file IO (Closed)
Patch Set: Fuchsia fix Created 3 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
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/file_system_entity_patch.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 @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) native "File_LinkTarget" ;
15 @patch 16 @patch
16 static _deleteNative(String path) native "File_Delete"; 17 static _deleteNative(_Namespace namespace, String path) native "File_Delete";
17 @patch 18 @patch
18 static _deleteLinkNative(String path) native "File_DeleteLink"; 19 static _deleteLinkNative(_Namespace namespace, String path)
20 native "File_DeleteLink";
19 @patch 21 @patch
20 static _rename(String oldPath, String newPath) native "File_Rename"; 22 static _rename(_Namespace namespace, String oldPath, String newPath)
23 native "File_Rename";
21 @patch 24 @patch
22 static _renameLink(String oldPath, String newPath) native "File_RenameLink"; 25 static _renameLink(_Namespace namespace, String oldPath, String newPath)
26 native "File_RenameLink";
23 @patch 27 @patch
24 static _copy(String oldPath, String newPath) native "File_Copy"; 28 static _copy(_Namespace namespace, String oldPath, String newPath)
29 native "File_Copy";
25 @patch 30 @patch
26 static _lengthFromPath(String path) native "File_LengthFromPath"; 31 static _lengthFromPath(_Namespace namespace, String path)
32 native "File_LengthFromPath";
27 @patch 33 @patch
28 static _lastModified(String path) native "File_LastModified"; 34 static _lastModified(_Namespace namespace, String path)
35 native "File_LastModified";
29 @patch 36 @patch
30 static _setLastModified(String path, int millis) 37 static _setLastModified(_Namespace namespace, String path, int millis)
31 native "File_SetLastModified"; 38 native "File_SetLastModified";
32 @patch 39 @patch
33 static _lastAccessed(String path) native "File_LastAccessed"; 40 static _lastAccessed(_Namespace namespace, String path)
41 native "File_LastAccessed";
34 @patch 42 @patch
35 static _setLastAccessed(String path, int millis) 43 static _setLastAccessed(_Namespace namespace, String path, int millis)
36 native "File_SetLastAccessed"; 44 native "File_SetLastAccessed";
37 @patch 45 @patch
38 static _open(String path, int mode) native "File_Open"; 46 static _open(_Namespace namespace, String path, int mode) native "File_Open";
39 @patch 47 @patch
40 static int _openStdio(int fd) native "File_OpenStdio"; 48 static int _openStdio(int fd) native "File_OpenStdio";
41 } 49 }
42 50
43 @patch 51 @patch
44 class _RandomAccessFileOps { 52 class _RandomAccessFileOps {
45 @patch 53 @patch
46 factory _RandomAccessFileOps(int pointer) => 54 factory _RandomAccessFileOps(int pointer) =>
47 new _RandomAccessFileOpsImpl(pointer); 55 new _RandomAccessFileOpsImpl(pointer);
48 } 56 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 _newWatcher(); 135 _newWatcher();
128 } catch (e) { 136 } catch (e) {
129 _broadcastController.addError(new FileSystemException( 137 _broadcastController.addError(new FileSystemException(
130 "Failed to initialize file system entity watcher", null, e)); 138 "Failed to initialize file system entity watcher", null, e));
131 _broadcastController.close(); 139 _broadcastController.close();
132 return; 140 return;
133 } 141 }
134 } 142 }
135 var pathId; 143 var pathId;
136 try { 144 try {
137 pathId = _watchPath(_id, _path, _events, _recursive); 145 pathId = _watchPath(
146 _id, _Namespace._namespace, _path, _events, _recursive);
138 } catch (e) { 147 } catch (e) {
139 _broadcastController 148 _broadcastController
140 .addError(new FileSystemException("Failed to watch path", _path, e)); 149 .addError(new FileSystemException("Failed to watch path", _path, e));
141 _broadcastController.close(); 150 _broadcastController.close();
142 return; 151 return;
143 } 152 }
144 if (!_idMap.containsKey(pathId)) { 153 if (!_idMap.containsKey(pathId)) {
145 _idMap[pathId] = new _WatcherPath(pathId, _path, _events); 154 _idMap[pathId] = new _WatcherPath(pathId, _path, _events);
146 } 155 }
147 _watcherPath = _idMap[pathId]; 156 _watcherPath = _idMap[pathId];
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return events; 292 return events;
284 }); 293 });
285 } 294 }
286 295
287 @patch 296 @patch
288 static bool get isSupported native "FileSystemWatcher_IsSupported"; 297 static bool get isSupported native "FileSystemWatcher_IsSupported";
289 298
290 static int _initWatcher() native "FileSystemWatcher_InitWatcher"; 299 static int _initWatcher() native "FileSystemWatcher_InitWatcher";
291 static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher"; 300 static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher";
292 301
293 static int _watchPath(int id, String path, int events, bool recursive) 302 static int _watchPath(
303 int id, _Namespace namespace, String path, int events, bool recursive)
294 native "FileSystemWatcher_WatchPath"; 304 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 {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/file_system_entity_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698