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

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

Issue 313743004: Fall back to PollingDirectoryWatcher if FileSystemEntity:watch is not supported. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« 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; 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';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 /// 48 ///
49 /// If a native directory watcher is available for this platform, this will 49 /// If a native directory watcher is available for this platform, this will
50 /// use it. Otherwise, it will fall back to a [PollingDirectoryWatcher]. 50 /// use it. Otherwise, it will fall back to a [PollingDirectoryWatcher].
51 /// 51 ///
52 /// 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
53 /// will pause between successive polls of the directory contents. Making this 53 /// will pause between successive polls of the directory contents. Making this
54 /// 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
55 /// 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
56 /// watchers. 56 /// watchers.
57 factory DirectoryWatcher(String directory, {Duration pollingDelay}) { 57 factory DirectoryWatcher(String directory, {Duration pollingDelay}) {
58 if (Platform.isLinux) return new LinuxDirectoryWatcher(directory); 58 if (FileSystemEntity.isWatchSupported) {
59 if (Platform.isMacOS) return new MacOSDirectoryWatcher(directory); 59 if (Platform.isLinux) return new LinuxDirectoryWatcher(directory);
60 if (Platform.isWindows) return new WindowsDirectoryWatcher(directory); 60 if (Platform.isMacOS) return new MacOSDirectoryWatcher(directory);
61 if (Platform.isWindows) return new WindowsDirectoryWatcher(directory);
62 }
61 return new PollingDirectoryWatcher(directory, pollingDelay: pollingDelay); 63 return new PollingDirectoryWatcher(directory, pollingDelay: pollingDelay);
62 } 64 }
63 } 65 }
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