| OLD | NEW |
| 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' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 import 'dart:math' show max; | 10 import 'dart:math' show max; |
| 11 | 11 |
| 12 import 'package:analysis_server/plugin/protocol/protocol.dart' | 12 import 'package:analysis_server/plugin/protocol/protocol.dart' |
| 13 hide AnalysisOptions, Element; | 13 hide AnalysisOptions, Element; |
| 14 import 'package:analysis_server/src/analysis_logger.dart'; | 14 import 'package:analysis_server/src/analysis_logger.dart'; |
| 15 import 'package:analysis_server/src/channel/channel.dart'; | 15 import 'package:analysis_server/src/channel/channel.dart'; |
| 16 import 'package:analysis_server/src/context_manager.dart'; | 16 import 'package:analysis_server/src/context_manager.dart'; |
| 17 import 'package:analysis_server/src/operation/operation.dart'; | 17 import 'package:analysis_server/src/operation/operation.dart'; |
| 18 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 18 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
| 19 import 'package:analysis_server/src/operation/operation_queue.dart'; | 19 import 'package:analysis_server/src/operation/operation_queue.dart'; |
| 20 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 20 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 21 import 'package:analysis_server/src/services/correction/namespace.dart'; | 21 import 'package:analysis_server/src/services/correction/namespace.dart'; |
| 22 import 'package:analysis_server/src/services/index/index.dart'; | 22 import 'package:analysis_server/src/services/index/index.dart'; |
| 23 import 'package:analysis_server/src/services/search/search_engine.dart'; | 23 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 24 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 24 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
| 25 import 'package:analysis_server/src/single_context_manager.dart'; |
| 25 import 'package:analyzer/dart/ast/ast.dart'; | 26 import 'package:analyzer/dart/ast/ast.dart'; |
| 26 import 'package:analyzer/dart/element/element.dart'; | 27 import 'package:analyzer/dart/element/element.dart'; |
| 27 import 'package:analyzer/file_system/file_system.dart'; | 28 import 'package:analyzer/file_system/file_system.dart'; |
| 28 import 'package:analyzer/instrumentation/instrumentation.dart'; | 29 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 29 import 'package:analyzer/plugin/embedded_resolver_provider.dart'; | 30 import 'package:analyzer/plugin/embedded_resolver_provider.dart'; |
| 30 import 'package:analyzer/plugin/resolver_provider.dart'; | 31 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 31 import 'package:analyzer/source/embedder.dart'; | 32 import 'package:analyzer/source/embedder.dart'; |
| 32 import 'package:analyzer/source/pub_package_map_provider.dart'; | 33 import 'package:analyzer/source/pub_package_map_provider.dart'; |
| 33 import 'package:analyzer/src/dart/ast/utilities.dart'; | 34 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 34 import 'package:analyzer/src/generated/engine.dart'; | 35 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 */ | 306 */ |
| 306 AnalysisServer( | 307 AnalysisServer( |
| 307 this.channel, | 308 this.channel, |
| 308 this.resourceProvider, | 309 this.resourceProvider, |
| 309 PubPackageMapProvider packageMapProvider, | 310 PubPackageMapProvider packageMapProvider, |
| 310 Index _index, | 311 Index _index, |
| 311 this.serverPlugin, | 312 this.serverPlugin, |
| 312 this.options, | 313 this.options, |
| 313 this.defaultSdkCreator, | 314 this.defaultSdkCreator, |
| 314 this.instrumentationService, | 315 this.instrumentationService, |
| 315 {ResolverProvider packageResolverProvider: null, | 316 {EmbeddedResolverProvider embeddedResolverProvider: null, |
| 316 EmbeddedResolverProvider embeddedResolverProvider: null, | 317 ResolverProvider packageResolverProvider: null, |
| 318 bool useSingleContextManager: false, |
| 317 this.rethrowExceptions: true}) | 319 this.rethrowExceptions: true}) |
| 318 : index = _index, | 320 : index = _index, |
| 319 searchEngine = _index != null ? new SearchEngineImpl(_index) : null { | 321 searchEngine = _index != null ? new SearchEngineImpl(_index) : null { |
| 320 _performance = performanceDuringStartup; | 322 _performance = performanceDuringStartup; |
| 321 defaultContextOptions.incremental = true; | 323 defaultContextOptions.incremental = true; |
| 322 defaultContextOptions.incrementalApi = | 324 defaultContextOptions.incrementalApi = |
| 323 options.enableIncrementalResolutionApi; | 325 options.enableIncrementalResolutionApi; |
| 324 defaultContextOptions.incrementalValidation = | 326 defaultContextOptions.incrementalValidation = |
| 325 options.enableIncrementalResolutionValidation; | 327 options.enableIncrementalResolutionValidation; |
| 326 defaultContextOptions.generateImplicitErrors = false; | 328 defaultContextOptions.generateImplicitErrors = false; |
| 327 operationQueue = new ServerOperationQueue(); | 329 operationQueue = new ServerOperationQueue(); |
| 328 sdkManager = new DartSdkManager(defaultSdkCreator); | 330 sdkManager = new DartSdkManager(defaultSdkCreator); |
| 329 contextManager = new ContextManagerImpl( | 331 if (useSingleContextManager) { |
| 330 resourceProvider, | 332 contextManager = new SingleContextManager(resourceProvider, sdkManager, |
| 331 sdkManager, | 333 () => packageResolverProvider(null), analyzedFilesGlobs); |
| 332 packageResolverProvider, | 334 } else { |
| 333 embeddedResolverProvider, | 335 contextManager = new ContextManagerImpl( |
| 334 packageMapProvider, | 336 resourceProvider, |
| 335 analyzedFilesGlobs, | 337 sdkManager, |
| 336 instrumentationService, | 338 packageResolverProvider, |
| 337 defaultContextOptions); | 339 embeddedResolverProvider, |
| 340 packageMapProvider, |
| 341 analyzedFilesGlobs, |
| 342 instrumentationService, |
| 343 defaultContextOptions); |
| 344 } |
| 338 ServerContextManagerCallbacks contextManagerCallbacks = | 345 ServerContextManagerCallbacks contextManagerCallbacks = |
| 339 new ServerContextManagerCallbacks(this, resourceProvider); | 346 new ServerContextManagerCallbacks(this, resourceProvider); |
| 340 contextManager.callbacks = contextManagerCallbacks; | 347 contextManager.callbacks = contextManagerCallbacks; |
| 341 _noErrorNotification = options.noErrorNotification; | 348 _noErrorNotification = options.noErrorNotification; |
| 342 AnalysisEngine.instance.logger = new AnalysisLogger(this); | 349 AnalysisEngine.instance.logger = new AnalysisLogger(this); |
| 343 _onAnalysisStartedController = new StreamController.broadcast(); | 350 _onAnalysisStartedController = new StreamController.broadcast(); |
| 344 _onFileAnalyzedController = new StreamController.broadcast(); | 351 _onFileAnalyzedController = new StreamController.broadcast(); |
| 345 _onPriorityChangeController = | 352 _onPriorityChangeController = |
| 346 new StreamController<PriorityChangeEvent>.broadcast(); | 353 new StreamController<PriorityChangeEvent>.broadcast(); |
| 347 running = true; | 354 running = true; |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 /** | 1765 /** |
| 1759 * The [PerformanceTag] for time spent in server request handlers. | 1766 * The [PerformanceTag] for time spent in server request handlers. |
| 1760 */ | 1767 */ |
| 1761 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1768 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1762 | 1769 |
| 1763 /** | 1770 /** |
| 1764 * The [PerformanceTag] for time spent in split store microtasks. | 1771 * The [PerformanceTag] for time spent in split store microtasks. |
| 1765 */ | 1772 */ |
| 1766 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1773 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1767 } | 1774 } |
| OLD | NEW |