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

Unified Diff: pkg/dart2js_incremental/lib/watcher.dart

Issue 2667793003: Remove dart2js_incremental. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « pkg/dart2js_incremental/lib/src/options.dart ('k') | tests/compiler/dart2js/incremental/compile_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dart2js_incremental/lib/watcher.dart
diff --git a/pkg/dart2js_incremental/lib/watcher.dart b/pkg/dart2js_incremental/lib/watcher.dart
deleted file mode 100644
index a212f6d47b7515bae86967043f17fc6ec5cb3beb..0000000000000000000000000000000000000000
--- a/pkg/dart2js_incremental/lib/watcher.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js_incremental.watcher;
-
-import 'dart:io';
-
-import 'dart:async';
-
-class Watcher {
- final Set<String> _watchedDirectories = new Set<String>();
-
- final Map<String, Set<Uri>> _watchedFiles = new Map<String, Set<Uri>>();
-
- final Set<Uri> _changes = new Set<Uri>();
-
- bool _hasEarlyChanges = false;
-
- Completer<bool> _changesCompleter;
-
- Future<bool> hasChanges() {
- if (_changesCompleter == null && _hasEarlyChanges) {
- return new Future.value(true);
- }
- _changesCompleter = new Completer<bool>();
- return _changesCompleter.future;
- }
-
- void _onFileSystemEvent(FileSystemEvent event) {
- Set<Uri> uris = _watchedFiles[event.path];
- if (uris == null) return;
- _changes.addAll(uris);
- if (_changesCompleter == null) {
- _hasEarlyChanges = true;
- } else if (!_changesCompleter.isCompleted) {
- _changesCompleter.complete(true);
- }
- }
-
- Map<Uri, Uri> readChanges() {
- if (_changes.isEmpty) {
- throw new StateError("No changes");
- }
- Map<Uri, Uri> result = new Map<Uri, Uri>();
- for (Uri uri in _changes) {
- result[uri] = uri;
- }
- _changes.clear();
- return result;
- }
-
- void watchFile(Uri uri) {
- String realpath = new File.fromUri(uri).resolveSymbolicLinksSync();
- _watchedFiles.putIfAbsent(realpath, () => new Set<Uri>()).add(uri);
- Directory directory = new File(realpath).parent;
- if (_watchedDirectories.add(directory.path)) {
- print("Watching ${directory.path}");
- directory.watch().listen(_onFileSystemEvent);
- }
- }
-}
« no previous file with comments | « pkg/dart2js_incremental/lib/src/options.dart ('k') | tests/compiler/dart2js/incremental/compile_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698