| 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 library watcher.directory_watcher.mac_os; | 5 library watcher.directory_watcher.mac_os; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:stack_trace/stack_trace.dart'; |
| 11 |
| 10 import '../constructable_file_system_event.dart'; | 12 import '../constructable_file_system_event.dart'; |
| 11 import '../path_set.dart'; | 13 import '../path_set.dart'; |
| 12 import '../utils.dart'; | 14 import '../utils.dart'; |
| 13 import '../watch_event.dart'; | 15 import '../watch_event.dart'; |
| 14 import 'resubscribable.dart'; | 16 import 'resubscribable.dart'; |
| 15 | 17 |
| 16 /// Uses the FSEvents subsystem to watch for filesystem events. | 18 /// Uses the FSEvents subsystem to watch for filesystem events. |
| 17 /// | 19 /// |
| 18 /// FSEvents has two main idiosyncrasies that this class works around. First, it | 20 /// FSEvents has two main idiosyncrasies that this class works around. First, it |
| 19 /// will occasionally report events that occurred before the filesystem watch | 21 /// will occasionally report events that occurred before the filesystem watch |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 void _listen(Stream stream, void onData(event), {Function onError, | 348 void _listen(Stream stream, void onData(event), {Function onError, |
| 347 void onDone(), bool cancelOnError}) { | 349 void onDone(), bool cancelOnError}) { |
| 348 var subscription; | 350 var subscription; |
| 349 subscription = stream.listen(onData, onError: onError, onDone: () { | 351 subscription = stream.listen(onData, onError: onError, onDone: () { |
| 350 _subscriptions.remove(subscription); | 352 _subscriptions.remove(subscription); |
| 351 if (onDone != null) onDone(); | 353 if (onDone != null) onDone(); |
| 352 }, cancelOnError: cancelOnError); | 354 }, cancelOnError: cancelOnError); |
| 353 _subscriptions.add(subscription); | 355 _subscriptions.add(subscription); |
| 354 } | 356 } |
| 355 } | 357 } |
| OLD | NEW |