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 class _File { | 5 patch class _File { |
6 /* patch */ static _exists(String path) native "File_Exists"; | 6 /* patch */ static _exists(String path) native "File_Exists"; |
7 /* patch */ static _create(String path) native "File_Create"; | 7 /* patch */ static _create(String path) native "File_Create"; |
8 /* patch */ static _createLink(String path, String target) | 8 /* patch */ static _createLink(String path, String target) |
9 native "File_CreateLink"; | 9 native "File_CreateLink"; |
10 /* patch */ static _linkTarget(String path) native "File_LinkTarget"; | 10 /* patch */ static _linkTarget(String path) native "File_LinkTarget"; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 _watcherPath = _idMap[pathId]; | 117 _watcherPath = _idMap[pathId]; |
118 _watcherPath.count++; | 118 _watcherPath.count++; |
119 _pathWatched().pipe(_broadcastController); | 119 _pathWatched().pipe(_broadcastController); |
120 } | 120 } |
121 | 121 |
122 void _cancel() { | 122 void _cancel() { |
123 if (_watcherPath != null) { | 123 if (_watcherPath != null) { |
124 assert(_watcherPath.count > 0); | 124 assert(_watcherPath.count > 0); |
125 _watcherPath.count--; | 125 _watcherPath.count--; |
126 if (_watcherPath.count == 0) { | 126 if (_watcherPath.count == 0) { |
| 127 _unwatchPath(_id, _watcherPath.pathId); |
127 _pathWatchedEnd(); | 128 _pathWatchedEnd(); |
128 _unwatchPath(_id, _watcherPath.pathId); | |
129 _idMap.remove(_watcherPath.pathId); | 129 _idMap.remove(_watcherPath.pathId); |
130 } | 130 } |
131 _watcherPath = null; | 131 _watcherPath = null; |
132 } | 132 } |
133 if (_idMap.isEmpty && _id != null) { | 133 if (_idMap.isEmpty && _id != null) { |
134 _closeWatcher(_id); | 134 _closeWatcher(_id); |
135 _doneWatcher(); | 135 _doneWatcher(); |
136 _id = null; | 136 _id = null; |
137 } | 137 } |
138 } | 138 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 void _pathWatchedEnd() { | 359 void _pathWatchedEnd() { |
360 _subscription.cancel(); | 360 _subscription.cancel(); |
361 _controller.close(); | 361 _controller.close(); |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { | 366 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { |
367 return new Uint8List.view(source.buffer, offsetInBytes, length); | 367 return new Uint8List.view(source.buffer, offsetInBytes, length); |
368 } | 368 } |
OLD | NEW |