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

Side by Side Diff: pkg/analysis_server/lib/src/context_directory_manager.dart

Issue 366463002: Change Maps to HashMaps to save in performance, index and generated directories not touched (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 context.directory.manager; 5 library context.directory.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/package_map_provider.dart'; 10 import 'package:analysis_server/src/package_map_provider.dart';
11 import 'package:analysis_server/src/resource.dart'; 11 import 'package:analysis_server/src/resource.dart';
12 import 'package:analyzer/src/generated/engine.dart'; 12 import 'package:analyzer/src/generated/engine.dart';
13 import 'package:analyzer/src/generated/source.dart'; 13 import 'package:analyzer/src/generated/source.dart';
14 import 'package:watcher/watcher.dart'; 14 import 'package:watcher/watcher.dart';
15 15
16 /** 16 /**
17 * Information tracked by the [ContextDirectoryManager] for each context. 17 * Information tracked by the [ContextDirectoryManager] for each context.
18 */ 18 */
19 class _ContextDirectoryInfo { 19 class _ContextDirectoryInfo {
20 /** 20 /**
21 * Stream subscription we are using to watch the context's directory for 21 * Stream subscription we are using to watch the context's directory for
22 * changes. 22 * changes.
23 */ 23 */
24 StreamSubscription<WatchEvent> changeSubscription; 24 StreamSubscription<WatchEvent> changeSubscription;
25 25
26 /** 26 /**
27 * Map from full path to the [Source] object, for each source that has been 27 * Map from full path to the [Source] object, for each source that has been
28 * added to the context. 28 * added to the context.
29 */ 29 */
30 Map<String, Source> sources = new HashMap<String, Source>(); 30 HashMap<String, Source> sources = new HashMap<String, Source>();
31 31
32 /** 32 /**
33 * Dependencies of the context's package map. If any of these files changes, 33 * Dependencies of the context's package map. If any of these files changes,
34 * the package map needs to be recomputed. 34 * the package map needs to be recomputed.
35 */ 35 */
36 Set<String> packageMapDependencies; 36 Set<String> packageMapDependencies;
37 } 37 }
38 38
39 /** 39 /**
40 * Class that maintains a mapping from included/excluded paths to a set of 40 * Class that maintains a mapping from included/excluded paths to a set of
41 * folders that should correspond to analysis contexts. 41 * folders that should correspond to analysis contexts.
42 */ 42 */
43 abstract class ContextDirectoryManager { 43 abstract class ContextDirectoryManager {
44 /** 44 /**
45 * File name of pubspec files. 45 * File name of pubspec files.
46 */ 46 */
47 static const String PUBSPEC_NAME = 'pubspec.yaml'; 47 static const String PUBSPEC_NAME = 'pubspec.yaml';
48 48
49 /** 49 /**
50 * [_ContextDirectoryInfo] object for each included directory in the most 50 * [_ContextDirectoryInfo] object for each included directory in the most
51 * recent successful call to [setRoots]. 51 * recent successful call to [setRoots].
52 */ 52 */
53 Map<Folder, _ContextDirectoryInfo> _currentDirectoryInfo = 53 HashMap<Folder, _ContextDirectoryInfo> _currentDirectoryInfo =
54 new HashMap<Folder, _ContextDirectoryInfo>(); 54 new HashMap<Folder, _ContextDirectoryInfo>();
55 55
56 /** 56 /**
57 * The [ResourceProvider] using which paths are converted into [Resource]s. 57 * The [ResourceProvider] using which paths are converted into [Resource]s.
58 */ 58 */
59 final ResourceProvider resourceProvider; 59 final ResourceProvider resourceProvider;
60 60
61 /** 61 /**
62 * Provider which is used to determine the mapping from package name to 62 * Provider which is used to determine the mapping from package name to
63 * package folder. 63 * package folder.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 static bool _shouldFileBeAnalyzed(String path) { 230 static bool _shouldFileBeAnalyzed(String path) {
231 return AnalysisEngine.isDartFileName(path) 231 return AnalysisEngine.isDartFileName(path)
232 || AnalysisEngine.isHtmlFileName(path); 232 || AnalysisEngine.isHtmlFileName(path);
233 } 233 }
234 234
235 /** 235 /**
236 * Called when a new context needs to be created. 236 * Called when a new context needs to be created.
237 */ 237 */
238 void addContext(Folder folder, Map<String, List<Folder>> packageMap); 238 void addContext(Folder folder, HashMap<String, List<Folder>> packageMap);
239 239
240 /** 240 /**
241 * Called when the set of files associated with a context have changed (or 241 * Called when the set of files associated with a context have changed (or
242 * some of those files have been modified). [changeSet] is the set of 242 * some of those files have been modified). [changeSet] is the set of
243 * changes that need to be applied to the context. 243 * changes that need to be applied to the context.
244 */ 244 */
245 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); 245 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet);
246 246
247 /** 247 /**
248 * Remove the context associated with the given [folder]. 248 * Remove the context associated with the given [folder].
249 */ 249 */
250 void removeContext(Folder folder); 250 void removeContext(Folder folder);
251 251
252 /** 252 /**
253 * Called when the package map for a context has changed. 253 * Called when the package map for a context has changed.
254 */ 254 */
255 void updateContextPackageMap(Folder contextFolder, 255 void updateContextPackageMap(Folder contextFolder,
256 Map<String, List<Folder>> packageMap); 256 Map<String, List<Folder>> packageMap);
257 } 257 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/element.dart ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698