| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 _pathToFiles[path] = files; | 818 _pathToFiles[path] = files; |
| 819 // Schedule the stream update. | 819 // Schedule the stream update. |
| 820 _addedKnownFiles.add(path); | 820 _addedKnownFiles.add(path); |
| 821 _scheduleKnownFilesSetChange(); | 821 _scheduleKnownFilesSetChange(); |
| 822 } | 822 } |
| 823 files.add(file); | 823 files.add(file); |
| 824 } | 824 } |
| 825 | 825 |
| 826 void _scheduleKnownFilesSetChange() { | 826 void _scheduleKnownFilesSetChange() { |
| 827 Duration delay = _knownFilesSetChangesDelay ?? new Duration(seconds: 1); | 827 Duration delay = _knownFilesSetChangesDelay ?? new Duration(seconds: 1); |
| 828 _knownFilesSetChangesTimer ??= new Timer(delay, () { | 828 // Note: we don't use ??= here due to issue #29393 |
| 829 Set<String> addedFiles = _addedKnownFiles.toSet(); | 829 if (_knownFilesSetChangesTimer == null) { |
| 830 Set<String> removedFiles = new Set<String>(); | 830 _knownFilesSetChangesTimer = new Timer(delay, () { |
| 831 _knownFilesSetChangesController | 831 Set<String> addedFiles = _addedKnownFiles.toSet(); |
| 832 .add(new KnownFilesSetChange(addedFiles, removedFiles)); | 832 Set<String> removedFiles = new Set<String>(); |
| 833 _addedKnownFiles.clear(); | 833 _knownFilesSetChangesController |
| 834 _knownFilesSetChangesTimer = null; | 834 .add(new KnownFilesSetChange(addedFiles, removedFiles)); |
| 835 }); | 835 _addedKnownFiles.clear(); |
| 836 _knownFilesSetChangesTimer = null; |
| 837 }); |
| 838 } |
| 836 } | 839 } |
| 837 } | 840 } |
| 838 | 841 |
| 839 @visibleForTesting | 842 @visibleForTesting |
| 840 class FileSystemStateTestView { | 843 class FileSystemStateTestView { |
| 841 final FileSystemState state; | 844 final FileSystemState state; |
| 842 | 845 |
| 843 FileSystemStateTestView(this.state); | 846 FileSystemStateTestView(this.state); |
| 844 | 847 |
| 845 Set<FileState> get filesWithoutTransitiveFiles { | 848 Set<FileState> get filesWithoutTransitiveFiles { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 _FastaElementProxy operator [](fasta.Builder builder) => | 886 _FastaElementProxy operator [](fasta.Builder builder) => |
| 884 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); | 887 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); |
| 885 | 888 |
| 886 @override | 889 @override |
| 887 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 890 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 888 } | 891 } |
| 889 | 892 |
| 890 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { | 893 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { |
| 891 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 894 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 892 } | 895 } |
| OLD | NEW |