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

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

Issue 312743002: Use 'Directory.watch' on Windows in pkg/watcher, instead of pooling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes Created 6 years, 6 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
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; 5 library watcher.directory_watcher;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'watch_event.dart'; 10 import 'watch_event.dart';
11 import 'directory_watcher/linux.dart'; 11 import 'directory_watcher/linux.dart';
12 import 'directory_watcher/mac_os.dart'; 12 import 'directory_watcher/mac_os.dart';
13 import 'directory_watcher/windows.dart';
13 import 'directory_watcher/polling.dart'; 14 import 'directory_watcher/polling.dart';
14 15
15 /// Watches the contents of a directory and emits [WatchEvent]s when something 16 /// Watches the contents of a directory and emits [WatchEvent]s when something
16 /// in the directory has changed. 17 /// in the directory has changed.
17 abstract class DirectoryWatcher { 18 abstract class DirectoryWatcher {
18 /// The directory whose contents are being monitored. 19 /// The directory whose contents are being monitored.
19 String get directory; 20 String get directory;
20 21
21 /// The broadcast [Stream] of events that have occurred to files in 22 /// The broadcast [Stream] of events that have occurred to files in
22 /// [directory]. 23 /// [directory].
(...skipping 26 matching lines...) Expand all
49 /// use it. Otherwise, it will fall back to a [PollingDirectoryWatcher]. 50 /// use it. Otherwise, it will fall back to a [PollingDirectoryWatcher].
50 /// 51 ///
51 /// If [_pollingDelay] is passed, it specifies the amount of time the watcher 52 /// If [_pollingDelay] is passed, it specifies the amount of time the watcher
52 /// will pause between successive polls of the directory contents. Making this 53 /// will pause between successive polls of the directory contents. Making this
53 /// shorter will give more immediate feedback at the expense of doing more IO 54 /// shorter will give more immediate feedback at the expense of doing more IO
54 /// and higher CPU usage. Defaults to one second. Ignored for non-polling 55 /// and higher CPU usage. Defaults to one second. Ignored for non-polling
55 /// watchers. 56 /// watchers.
56 factory DirectoryWatcher(String directory, {Duration pollingDelay}) { 57 factory DirectoryWatcher(String directory, {Duration pollingDelay}) {
57 if (Platform.isLinux) return new LinuxDirectoryWatcher(directory); 58 if (Platform.isLinux) return new LinuxDirectoryWatcher(directory);
58 if (Platform.isMacOS) return new MacOSDirectoryWatcher(directory); 59 if (Platform.isMacOS) return new MacOSDirectoryWatcher(directory);
60 if (Platform.isWindows) return new WindowsDirectoryWatcher(directory);
59 return new PollingDirectoryWatcher(directory, pollingDelay: pollingDelay); 61 return new PollingDirectoryWatcher(directory, pollingDelay: pollingDelay);
60 } 62 }
61 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698