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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2833153002: Restore ??= for the timer in file state. (Closed)
Patch Set: Created 3 years, 8 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
« 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) 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 _pathToFiles[path] = files; 858 _pathToFiles[path] = files;
859 // Schedule the stream update. 859 // Schedule the stream update.
860 _addedKnownFiles.add(path); 860 _addedKnownFiles.add(path);
861 _scheduleKnownFilesSetChange(); 861 _scheduleKnownFilesSetChange();
862 } 862 }
863 files.add(file); 863 files.add(file);
864 } 864 }
865 865
866 void _scheduleKnownFilesSetChange() { 866 void _scheduleKnownFilesSetChange() {
867 Duration delay = _knownFilesSetChangesDelay ?? new Duration(seconds: 1); 867 Duration delay = _knownFilesSetChangesDelay ?? new Duration(seconds: 1);
868 // Note: we don't use ??= here due to issue #29393 868 _knownFilesSetChangesTimer ??= new Timer(delay, () {
869 if (_knownFilesSetChangesTimer == null) { 869 Set<String> addedFiles = _addedKnownFiles.toSet();
870 _knownFilesSetChangesTimer = new Timer(delay, () { 870 Set<String> removedFiles = new Set<String>();
871 Set<String> addedFiles = _addedKnownFiles.toSet(); 871 _knownFilesSetChangesController
872 Set<String> removedFiles = new Set<String>(); 872 .add(new KnownFilesSetChange(addedFiles, removedFiles));
873 _knownFilesSetChangesController 873 _addedKnownFiles.clear();
874 .add(new KnownFilesSetChange(addedFiles, removedFiles)); 874 _knownFilesSetChangesTimer = null;
875 _addedKnownFiles.clear(); 875 });
876 _knownFilesSetChangesTimer = null;
877 });
878 }
879 } 876 }
880 } 877 }
881 878
882 @visibleForTesting 879 @visibleForTesting
883 class FileSystemStateTestView { 880 class FileSystemStateTestView {
884 final FileSystemState state; 881 final FileSystemState state;
885 882
886 FileSystemStateTestView(this.state); 883 FileSystemStateTestView(this.state);
887 884
888 Set<FileState> get filesWithoutTransitiveFiles { 885 Set<FileState> get filesWithoutTransitiveFiles {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 _FastaElementProxy operator [](fasta.Builder builder) => 923 _FastaElementProxy operator [](fasta.Builder builder) =>
927 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); 924 _elements.putIfAbsent(builder, () => new _FastaElementProxy());
928 925
929 @override 926 @override
930 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 927 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
931 } 928 }
932 929
933 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { 930 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType {
934 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 931 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
935 } 932 }
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