| 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; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 /** | 277 /** |
| 278 * The controller for sending [ContextsChangedEvent]s. | 278 * The controller for sending [ContextsChangedEvent]s. |
| 279 */ | 279 */ |
| 280 StreamController<ContextsChangedEvent> _onContextsChangedController = | 280 StreamController<ContextsChangedEvent> _onContextsChangedController = |
| 281 new StreamController<ContextsChangedEvent>.broadcast(); | 281 new StreamController<ContextsChangedEvent>.broadcast(); |
| 282 | 282 |
| 283 /** | 283 /** |
| 284 * Initialize a newly created server to receive requests from and send | 284 * Initialize a newly created server to receive requests from and send |
| 285 * responses to the given [channel]. | 285 * responses to the given [channel]. |
| 286 * | 286 * |
| 287 * If a [contextManager] is provided, then the [packageResolverProvider] will | |
| 288 * be ignored. | |
| 289 * | |
| 290 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are | 287 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are |
| 291 * propagated up the call stack. The default is true to allow analysis | 288 * propagated up the call stack. The default is true to allow analysis |
| 292 * exceptions to show up in unit tests, but it should be set to false when | 289 * exceptions to show up in unit tests, but it should be set to false when |
| 293 * running a full analysis server. | 290 * running a full analysis server. |
| 294 */ | 291 */ |
| 295 AnalysisServer( | 292 AnalysisServer( |
| 296 this.channel, | 293 this.channel, |
| 297 this.resourceProvider, | 294 this.resourceProvider, |
| 298 PubPackageMapProvider packageMapProvider, | 295 PubPackageMapProvider packageMapProvider, |
| 299 Index _index, | 296 Index _index, |
| 300 this.serverPlugin, | 297 this.serverPlugin, |
| 301 this.options, | 298 this.options, |
| 302 this.defaultSdk, | 299 this.defaultSdk, |
| 303 this.instrumentationService, | 300 this.instrumentationService, |
| 304 {ContextManager contextManager: null, | 301 {ResolverProvider packageResolverProvider: null, |
| 305 ResolverProvider packageResolverProvider: null, | |
| 306 this.rethrowExceptions: true}) | 302 this.rethrowExceptions: true}) |
| 307 : index = _index, | 303 : index = _index, |
| 308 searchEngine = _index != null ? createSearchEngine(_index) : null { | 304 searchEngine = _index != null ? createSearchEngine(_index) : null { |
| 309 _performance = performanceDuringStartup; | 305 _performance = performanceDuringStartup; |
| 310 operationQueue = new ServerOperationQueue(); | 306 operationQueue = new ServerOperationQueue(); |
| 311 if (contextManager == null) { | 307 contextManager = new ContextManagerImpl(resourceProvider, |
| 312 contextManager = new ContextManagerImpl(resourceProvider, | 308 packageResolverProvider, packageMapProvider, instrumentationService); |
| 313 packageResolverProvider, packageMapProvider, instrumentationService); | |
| 314 } | |
| 315 ServerContextManagerCallbacks contextManagerCallbacks = | 309 ServerContextManagerCallbacks contextManagerCallbacks = |
| 316 new ServerContextManagerCallbacks(this, resourceProvider); | 310 new ServerContextManagerCallbacks(this, resourceProvider); |
| 317 contextManager.callbacks = contextManagerCallbacks; | 311 contextManager.callbacks = contextManagerCallbacks; |
| 318 defaultContextOptions.incremental = true; | 312 defaultContextOptions.incremental = true; |
| 319 defaultContextOptions.incrementalApi = | 313 defaultContextOptions.incrementalApi = |
| 320 options.enableIncrementalResolutionApi; | 314 options.enableIncrementalResolutionApi; |
| 321 defaultContextOptions.incrementalValidation = | 315 defaultContextOptions.incrementalValidation = |
| 322 options.enableIncrementalResolutionValidation; | 316 options.enableIncrementalResolutionValidation; |
| 323 defaultContextOptions.generateImplicitErrors = false; | 317 defaultContextOptions.generateImplicitErrors = false; |
| 324 this.contextManager = contextManager; | |
| 325 _noErrorNotification = options.noErrorNotification; | 318 _noErrorNotification = options.noErrorNotification; |
| 326 AnalysisEngine.instance.logger = new AnalysisLogger(); | 319 AnalysisEngine.instance.logger = new AnalysisLogger(); |
| 327 _onAnalysisStartedController = new StreamController.broadcast(); | 320 _onAnalysisStartedController = new StreamController.broadcast(); |
| 328 _onFileAnalyzedController = new StreamController.broadcast(); | 321 _onFileAnalyzedController = new StreamController.broadcast(); |
| 329 _onPriorityChangeController = | 322 _onPriorityChangeController = |
| 330 new StreamController<PriorityChangeEvent>.broadcast(); | 323 new StreamController<PriorityChangeEvent>.broadcast(); |
| 331 running = true; | 324 running = true; |
| 332 onAnalysisStarted.first.then((_) { | 325 onAnalysisStarted.first.then((_) { |
| 333 onAnalysisComplete.then((_) { | 326 onAnalysisComplete.then((_) { |
| 334 performanceAfterStartup = new ServerPerformance(); | 327 performanceAfterStartup = new ServerPerformance(); |
| (...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 /** | 1552 /** |
| 1560 * The [PerformanceTag] for time spent in server request handlers. | 1553 * The [PerformanceTag] for time spent in server request handlers. |
| 1561 */ | 1554 */ |
| 1562 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1555 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1563 | 1556 |
| 1564 /** | 1557 /** |
| 1565 * The [PerformanceTag] for time spent in split store microtasks. | 1558 * The [PerformanceTag] for time spent in split store microtasks. |
| 1566 */ | 1559 */ |
| 1567 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1560 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1568 } | 1561 } |
| OLD | NEW |