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

Side by Side Diff: pkg/watcher/lib/src/directory_watcher/mac_os.dart

Issue 146693014: Add some additional debugging prints to the mac os watcher. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 for (var file in _files.toSet()) { 102 for (var file in _files.toSet()) {
103 print("[$_id] ${p.relative(file, from: directory)}"); 103 print("[$_id] ${p.relative(file, from: directory)}");
104 } 104 }
105 } 105 }
106 _readyCompleter.complete(); 106 _readyCompleter.complete();
107 }); 107 });
108 } 108 }
109 109
110 void close() { 110 void close() {
111 if (MacOSDirectoryWatcher.logDebugInfo) { 111 if (MacOSDirectoryWatcher.logDebugInfo) {
112 print("[$_id] watcher is closed"); 112 print("[$_id] watcher is closed\n${new Chain.current().terse}");
113 } 113 }
114 if (_watchSubscription != null) _watchSubscription.cancel(); 114 if (_watchSubscription != null) _watchSubscription.cancel();
115 if (_initialListSubscription != null) _initialListSubscription.cancel(); 115 if (_initialListSubscription != null) _initialListSubscription.cancel();
116 if (_listSubscription != null) _listSubscription.cancel(); 116 if (_listSubscription != null) _listSubscription.cancel();
117 _watchSubscription = null; 117 _watchSubscription = null;
118 _initialListSubscription = null; 118 _initialListSubscription = null;
119 _listSubscription = null; 119 _listSubscription = null;
120 _eventsController.close(); 120 _eventsController.close();
121 } 121 }
122 122
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 if (MacOSDirectoryWatcher.logDebugInfo) { 462 if (MacOSDirectoryWatcher.logDebugInfo) {
463 print("[$_id] emitting $type ${p.relative(path, from: directory)}"); 463 print("[$_id] emitting $type ${p.relative(path, from: directory)}");
464 } 464 }
465 465
466 _eventsController.add(new WatchEvent(type, path)); 466 _eventsController.add(new WatchEvent(type, path));
467 } 467 }
468 468
469 /// Emit an error, then close the watcher. 469 /// Emit an error, then close the watcher.
470 void _emitError(error, StackTrace stackTrace) { 470 void _emitError(error, StackTrace stackTrace) {
471 if (MacOSDirectoryWatcher.logDebugInfo) {
472 print("[$_id] emitting error: $error\n" +
473 "${new Chain.forTrace(stackTrace).terse}");
474 }
471 _eventsController.addError(error, stackTrace); 475 _eventsController.addError(error, stackTrace);
472 close(); 476 close();
473 } 477 }
474 478
475 // TODO(nweiz): remove this when issue 15042 is fixed. 479 // TODO(nweiz): remove this when issue 15042 is fixed.
476 /// Return a human-friendly string representation of [event]. 480 /// Return a human-friendly string representation of [event].
477 String _formatEvent(FileSystemEvent event) { 481 String _formatEvent(FileSystemEvent event) {
478 if (event == null) return 'null'; 482 if (event == null) return 'null';
479 483
480 var path = p.relative(event.path, from: directory); 484 var path = p.relative(event.path, from: directory);
481 var type = event.isDirectory ? 'directory' : 'file'; 485 var type = event.isDirectory ? 'directory' : 'file';
482 if (event is FileSystemCreateEvent) { 486 if (event is FileSystemCreateEvent) {
483 return "create $type $path"; 487 return "create $type $path";
484 } else if (event is FileSystemDeleteEvent) { 488 } else if (event is FileSystemDeleteEvent) {
485 return "delete $type $path"; 489 return "delete $type $path";
486 } else if (event is FileSystemModifyEvent) { 490 } else if (event is FileSystemModifyEvent) {
487 return "modify $type $path"; 491 return "modify $type $path";
488 } else if (event is FileSystemMoveEvent) { 492 } else if (event is FileSystemMoveEvent) {
489 return "move $type $path to " 493 return "move $type $path to "
490 "${p.relative(event.destination, from: directory)}"; 494 "${p.relative(event.destination, from: directory)}";
491 } 495 }
492 } 496 }
493 } 497 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698