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

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

Issue 2382033003: Revert "Remove unused option in server API" (Closed)
Patch Set: Created 4 years, 2 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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core'; 9 import 'dart:core';
10 import 'dart:io' as io; 10 import 'dart:io' as io;
(...skipping 12 matching lines...) Expand all
23 import 'package:analysis_server/src/services/index/index.dart'; 23 import 'package:analysis_server/src/services/index/index.dart';
24 import 'package:analysis_server/src/services/search/search_engine.dart'; 24 import 'package:analysis_server/src/services/search/search_engine.dart';
25 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 25 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
26 import 'package:analysis_server/src/single_context_manager.dart'; 26 import 'package:analysis_server/src/single_context_manager.dart';
27 import 'package:analyzer/dart/ast/ast.dart'; 27 import 'package:analyzer/dart/ast/ast.dart';
28 import 'package:analyzer/dart/element/element.dart'; 28 import 'package:analyzer/dart/element/element.dart';
29 import 'package:analyzer/exception/exception.dart'; 29 import 'package:analyzer/exception/exception.dart';
30 import 'package:analyzer/file_system/file_system.dart'; 30 import 'package:analyzer/file_system/file_system.dart';
31 import 'package:analyzer/instrumentation/instrumentation.dart'; 31 import 'package:analyzer/instrumentation/instrumentation.dart';
32 import 'package:analyzer/plugin/resolver_provider.dart'; 32 import 'package:analyzer/plugin/resolver_provider.dart';
33 import 'package:analyzer/source/pub_package_map_provider.dart';
33 import 'package:analyzer/src/context/builder.dart'; 34 import 'package:analyzer/src/context/builder.dart';
34 import 'package:analyzer/src/dart/ast/utilities.dart'; 35 import 'package:analyzer/src/dart/ast/utilities.dart';
35 import 'package:analyzer/src/generated/engine.dart'; 36 import 'package:analyzer/src/generated/engine.dart';
36 import 'package:analyzer/src/generated/sdk.dart'; 37 import 'package:analyzer/src/generated/sdk.dart';
37 import 'package:analyzer/src/generated/source.dart'; 38 import 'package:analyzer/src/generated/source.dart';
38 import 'package:analyzer/src/generated/source_io.dart'; 39 import 'package:analyzer/src/generated/source_io.dart';
39 import 'package:analyzer/src/generated/utilities_general.dart'; 40 import 'package:analyzer/src/generated/utilities_general.dart';
41 import 'package:analyzer/src/summary/package_bundle_reader.dart';
40 import 'package:analyzer/src/summary/pub_summary.dart'; 42 import 'package:analyzer/src/summary/pub_summary.dart';
41 import 'package:analyzer/src/task/dart.dart'; 43 import 'package:analyzer/src/task/dart.dart';
42 import 'package:analyzer/src/util/glob.dart'; 44 import 'package:analyzer/src/util/glob.dart';
43 import 'package:analyzer/task/dart.dart'; 45 import 'package:analyzer/task/dart.dart';
44 import 'package:plugin/plugin.dart'; 46 import 'package:plugin/plugin.dart';
45 47
46 typedef void OptionUpdater(AnalysisOptionsImpl options); 48 typedef void OptionUpdater(AnalysisOptionsImpl options);
47 49
48 /** 50 /**
49 * Enum representing reasons why analysis might be done for a given file. 51 * Enum representing reasons why analysis might be done for a given file.
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 * responses to the given [channel]. 313 * responses to the given [channel].
312 * 314 *
313 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are 315 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are
314 * propagated up the call stack. The default is true to allow analysis 316 * propagated up the call stack. The default is true to allow analysis
315 * exceptions to show up in unit tests, but it should be set to false when 317 * exceptions to show up in unit tests, but it should be set to false when
316 * running a full analysis server. 318 * running a full analysis server.
317 */ 319 */
318 AnalysisServer( 320 AnalysisServer(
319 this.channel, 321 this.channel,
320 this.resourceProvider, 322 this.resourceProvider,
323 PubPackageMapProvider packageMapProvider,
321 Index _index, 324 Index _index,
322 this.serverPlugin, 325 this.serverPlugin,
323 this.options, 326 this.options,
324 this.sdkManager, 327 this.sdkManager,
325 this.instrumentationService, 328 this.instrumentationService,
326 {ResolverProvider fileResolverProvider: null, 329 {ResolverProvider fileResolverProvider: null,
327 ResolverProvider packageResolverProvider: null, 330 ResolverProvider packageResolverProvider: null,
328 bool useSingleContextManager: false, 331 bool useSingleContextManager: false,
329 this.rethrowExceptions: true}) 332 this.rethrowExceptions: true})
330 : index = _index, 333 : index = _index,
331 searchEngine = _index != null ? new SearchEngineImpl(_index) : null { 334 searchEngine = _index != null ? new SearchEngineImpl(_index) : null {
332 _performance = performanceDuringStartup; 335 _performance = performanceDuringStartup;
333 defaultContextOptions.incremental = true; 336 defaultContextOptions.incremental = true;
334 defaultContextOptions.incrementalApi = 337 defaultContextOptions.incrementalApi =
335 options.enableIncrementalResolutionApi; 338 options.enableIncrementalResolutionApi;
336 defaultContextOptions.incrementalValidation = 339 defaultContextOptions.incrementalValidation =
337 options.enableIncrementalResolutionValidation; 340 options.enableIncrementalResolutionValidation;
338 defaultContextOptions.finerGrainedInvalidation = 341 defaultContextOptions.finerGrainedInvalidation =
339 options.finerGrainedInvalidation; 342 options.finerGrainedInvalidation;
340 defaultContextOptions.generateImplicitErrors = false; 343 defaultContextOptions.generateImplicitErrors = false;
341 operationQueue = new ServerOperationQueue(); 344 operationQueue = new ServerOperationQueue();
342 if (useSingleContextManager) { 345 if (useSingleContextManager) {
343 contextManager = new SingleContextManager(resourceProvider, sdkManager, 346 contextManager = new SingleContextManager(resourceProvider, sdkManager,
344 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions); 347 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions);
345 } else { 348 } else {
346 contextManager = new ContextManagerImpl( 349 contextManager = new ContextManagerImpl(
347 resourceProvider, 350 resourceProvider,
348 sdkManager, 351 sdkManager,
349 packageResolverProvider, 352 packageResolverProvider,
353 packageMapProvider,
350 analyzedFilesGlobs, 354 analyzedFilesGlobs,
351 instrumentationService, 355 instrumentationService,
352 defaultContextOptions); 356 defaultContextOptions);
353 } 357 }
354 this.fileResolverProvider = fileResolverProvider; 358 this.fileResolverProvider = fileResolverProvider;
355 this.packageResolverProvider = packageResolverProvider; 359 this.packageResolverProvider = packageResolverProvider;
356 ServerContextManagerCallbacks contextManagerCallbacks = 360 ServerContextManagerCallbacks contextManagerCallbacks =
357 new ServerContextManagerCallbacks(this, resourceProvider); 361 new ServerContextManagerCallbacks(this, resourceProvider);
358 contextManager.callbacks = contextManagerCallbacks; 362 contextManager.callbacks = contextManagerCallbacks;
359 _noErrorNotification = options.noErrorNotification; 363 _noErrorNotification = options.noErrorNotification;
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 // to be scheduled for this context. 1421 // to be scheduled for this context.
1418 } 1422 }
1419 // 1423 //
1420 // Update the defaults used to create new contexts. 1424 // Update the defaults used to create new contexts.
1421 // 1425 //
1422 optionUpdaters.forEach((OptionUpdater optionUpdater) { 1426 optionUpdaters.forEach((OptionUpdater optionUpdater) {
1423 optionUpdater(defaultContextOptions); 1427 optionUpdater(defaultContextOptions);
1424 }); 1428 });
1425 } 1429 }
1426 1430
1431 void _computingPackageMap(bool computing) {
1432 if (serverServices.contains(ServerService.STATUS)) {
1433 PubStatus pubStatus = new PubStatus(computing);
1434 ServerStatusParams params = new ServerStatusParams(pub: pubStatus);
1435 sendNotification(params.toNotification());
1436 }
1437 }
1438
1427 /** 1439 /**
1428 * Return a set of all contexts whose associated folder is contained within, 1440 * Return a set of all contexts whose associated folder is contained within,
1429 * or equal to, one of the resources in the given list of [resources]. 1441 * or equal to, one of the resources in the given list of [resources].
1430 */ 1442 */
1431 Set<AnalysisContext> _getContexts(List<Resource> resources) { 1443 Set<AnalysisContext> _getContexts(List<Resource> resources) {
1432 Set<AnalysisContext> contexts = new HashSet<AnalysisContext>(); 1444 Set<AnalysisContext> contexts = new HashSet<AnalysisContext>();
1433 resources.forEach((Resource resource) { 1445 resources.forEach((Resource resource) {
1434 if (resource is Folder) { 1446 if (resource is Folder) {
1435 contexts.addAll(contextManager.contextsInAnalysisRoot(resource)); 1447 contexts.addAll(contextManager.contextsInAnalysisRoot(resource));
1436 } 1448 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 analysisServer.schedulePerformAnalysisOperation(context); 1619 analysisServer.schedulePerformAnalysisOperation(context);
1608 List<String> flushedFiles = new List<String>(); 1620 List<String> flushedFiles = new List<String>();
1609 for (Source source in changeSet.removedSources) { 1621 for (Source source in changeSet.removedSources) {
1610 flushedFiles.add(source.fullName); 1622 flushedFiles.add(source.fullName);
1611 } 1623 }
1612 sendAnalysisNotificationFlushResults(analysisServer, flushedFiles); 1624 sendAnalysisNotificationFlushResults(analysisServer, flushedFiles);
1613 } 1625 }
1614 } 1626 }
1615 1627
1616 @override 1628 @override
1629 void computingPackageMap(bool computing) =>
1630 analysisServer._computingPackageMap(computing);
1631
1632 @override
1617 ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) { 1633 ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
1618 String defaultPackageFilePath = null; 1634 String defaultPackageFilePath = null;
1619 String defaultPackagesDirectoryPath = null; 1635 String defaultPackagesDirectoryPath = null;
1620 String path = (analysisServer.contextManager as ContextManagerImpl) 1636 String path = (analysisServer.contextManager as ContextManagerImpl)
1621 .normalizedPackageRoots[folder.path]; 1637 .normalizedPackageRoots[folder.path];
1622 if (path != null) { 1638 if (path != null) {
1623 Resource resource = resourceProvider.getResource(path); 1639 Resource resource = resourceProvider.getResource(path);
1624 if (resource.exists) { 1640 if (resource.exists) {
1625 if (resource is File) { 1641 if (resource is File) {
1626 defaultPackageFilePath = path; 1642 defaultPackageFilePath = path;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 /** 1781 /**
1766 * The [PerformanceTag] for time spent in server request handlers. 1782 * The [PerformanceTag] for time spent in server request handlers.
1767 */ 1783 */
1768 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1784 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1769 1785
1770 /** 1786 /**
1771 * The [PerformanceTag] for time spent in split store microtasks. 1787 * The [PerformanceTag] for time spent in split store microtasks.
1772 */ 1788 */
1773 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1789 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1774 } 1790 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart ('k') | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698