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

Unified Diff: pkg/analyzer/lib/file_system/memory_file_system.dart

Issue 1191933004: add file watching support (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/file_system/memory_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 8d1f1144b732ccb8774f601036047fd91fd8e3ba..d85a224da8aad03c23f9965f05269e79ad956e9f 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -183,6 +183,11 @@ class _MemoryDummyLink extends _MemoryResource implements File {
: super(provider, path);
@override
+ Stream<WatchEvent> get changes {
+ throw new FileSystemException(path, "File does not exist");
+ }
+
+ @override
bool get exists => false;
int get modificationStamp {
@@ -358,23 +363,6 @@ class _MemoryFolder extends _MemoryResource implements Folder {
: super(provider, path);
@override
- Stream<WatchEvent> get changes {
- StreamController<WatchEvent> streamController =
- new StreamController<WatchEvent>();
- if (!_provider._pathToWatchers.containsKey(path)) {
- _provider._pathToWatchers[path] = <StreamController<WatchEvent>>[];
- }
- _provider._pathToWatchers[path].add(streamController);
- streamController.done.then((_) {
- _provider._pathToWatchers[path].remove(streamController);
- if (_provider._pathToWatchers[path].isEmpty) {
- _provider._pathToWatchers.remove(path);
- }
- });
- return streamController.stream;
- }
-
- @override
bool get exists => _provider._pathToResource[path] is _MemoryFolder;
@override
@@ -442,6 +430,22 @@ abstract class _MemoryResource implements Resource {
_MemoryResource(this._provider, this.path);
+ Stream<WatchEvent> get changes {
+ StreamController<WatchEvent> streamController =
+ new StreamController<WatchEvent>();
+ if (!_provider._pathToWatchers.containsKey(path)) {
+ _provider._pathToWatchers[path] = <StreamController<WatchEvent>>[];
+ }
+ _provider._pathToWatchers[path].add(streamController);
+ streamController.done.then((_) {
+ _provider._pathToWatchers[path].remove(streamController);
+ if (_provider._pathToWatchers[path].isEmpty) {
+ _provider._pathToWatchers.remove(path);
+ }
+ });
+ return streamController.stream;
+ }
+
@override
get hashCode => path.hashCode;
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/file_system/physical_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698