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

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

Issue 1750683002: Move folderMap from AnalysisContext to ContextManager (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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 domain.analysis; 5 library domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 9
10 import 'package:analysis_server/plugin/analysis/analysis_domain.dart'; 10 import 'package:analysis_server/plugin/analysis/analysis_domain.dart';
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 } 104 }
105 // send response 105 // send response
106 return new AnalysisGetHoverResult(hovers).toResponse(request.id); 106 return new AnalysisGetHoverResult(hovers).toResponse(request.id);
107 } 107 }
108 108
109 /// Implement the `analysis.getLibraryDependencies` request. 109 /// Implement the `analysis.getLibraryDependencies` request.
110 Response getLibraryDependencies(Request request) { 110 Response getLibraryDependencies(Request request) {
111 server.onAnalysisComplete.then((_) { 111 server.onAnalysisComplete.then((_) {
112 LibraryDependencyCollector collector = 112 LibraryDependencyCollector collector =
113 new LibraryDependencyCollector(server.getAnalysisContexts()); 113 new LibraryDependencyCollector(server.analysisContexts);
114 Set<String> libraries = collector.collectLibraryDependencies(); 114 Set<String> libraries = collector.collectLibraryDependencies();
115 Map<String, Map<String, List<String>>> packageMap = 115 Map<String, Map<String, List<String>>> packageMap =
116 collector.calculatePackageMap(server.folderMap); 116 collector.calculatePackageMap(server.folderMap);
117 server.sendResponse(new AnalysisGetLibraryDependenciesResult( 117 server.sendResponse(new AnalysisGetLibraryDependenciesResult(
118 libraries.toList(growable: false), packageMap) 118 libraries.toList(growable: false), packageMap)
119 .toResponse(request.id)); 119 .toResponse(request.id));
120 }); 120 });
121 // delay response 121 // delay response
122 return Response.DELAYED_RESPONSE; 122 return Response.DELAYED_RESPONSE;
123 } 123 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 event.added.forEach(_subscribeForContext); 371 event.added.forEach(_subscribeForContext);
372 }); 372 });
373 } 373 }
374 374
375 @override 375 @override
376 Stream<engine.ComputedResult> onResultComputed(ResultDescriptor descriptor) { 376 Stream<engine.ComputedResult> onResultComputed(ResultDescriptor descriptor) {
377 Stream<engine.ComputedResult> stream = controllers 377 Stream<engine.ComputedResult> stream = controllers
378 .putIfAbsent(descriptor, 378 .putIfAbsent(descriptor,
379 () => new StreamController<engine.ComputedResult>.broadcast()) 379 () => new StreamController<engine.ComputedResult>.broadcast())
380 .stream; 380 .stream;
381 server.getAnalysisContexts().forEach(_subscribeForContext); 381 server.analysisContexts.forEach(_subscribeForContext);
382 return stream; 382 return stream;
383 } 383 }
384 384
385 @override 385 @override
386 void scheduleNotification( 386 void scheduleNotification(
387 engine.AnalysisContext context, Source source, AnalysisService service) { 387 engine.AnalysisContext context, Source source, AnalysisService service) {
388 String file = source.fullName; 388 String file = source.fullName;
389 if (server.hasAnalysisSubscription(service, file)) { 389 if (server.hasAnalysisSubscription(service, file)) {
390 if (service == AnalysisService.NAVIGATION) { 390 if (service == AnalysisService.NAVIGATION) {
391 server.scheduleOperation(new NavigationOperation(context, source)); 391 server.scheduleOperation(new NavigationOperation(context, source));
392 } 392 }
393 if (service == AnalysisService.OCCURRENCES) { 393 if (service == AnalysisService.OCCURRENCES) {
394 server.scheduleOperation(new OccurrencesOperation(context, source)); 394 server.scheduleOperation(new OccurrencesOperation(context, source));
395 } 395 }
396 } 396 }
397 } 397 }
398 398
399 void _subscribeForContext(engine.AnalysisContext context) { 399 void _subscribeForContext(engine.AnalysisContext context) {
400 for (ResultDescriptor descriptor in controllers.keys) { 400 for (ResultDescriptor descriptor in controllers.keys) {
401 context.onResultComputed(descriptor).listen((result) { 401 context.onResultComputed(descriptor).listen((result) {
402 StreamController<engine.ComputedResult> controller = 402 StreamController<engine.ComputedResult> controller =
403 controllers[result.descriptor]; 403 controllers[result.descriptor];
404 if (controller != null) { 404 if (controller != null) {
405 controller.add(result); 405 controller.add(result);
406 } 406 }
407 }); 407 });
408 } 408 }
409 } 409 }
410 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698