| 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'; | 9 import 'dart:core'; |
| 10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 ServerPerformance performanceAfterStartup; | 237 ServerPerformance performanceAfterStartup; |
| 238 | 238 |
| 239 /** | 239 /** |
| 240 * The class into which performance information is currently being recorded. | 240 * The class into which performance information is currently being recorded. |
| 241 * During startup, this will be the same as [performanceDuringStartup] | 241 * During startup, this will be the same as [performanceDuringStartup] |
| 242 * and after startup is complete, this switches to [performanceAfterStartup]. | 242 * and after startup is complete, this switches to [performanceAfterStartup]. |
| 243 */ | 243 */ |
| 244 ServerPerformance _performance; | 244 ServerPerformance _performance; |
| 245 | 245 |
| 246 /** | 246 /** |
| 247 * The option possibly set from the server initialization which disables error
notifications. | |
| 248 */ | |
| 249 bool _noErrorNotification; | |
| 250 | |
| 251 /** | |
| 252 * The [Completer] that completes when analysis is complete. | 247 * The [Completer] that completes when analysis is complete. |
| 253 */ | 248 */ |
| 254 Completer _onAnalysisCompleteCompleter; | 249 Completer _onAnalysisCompleteCompleter; |
| 255 | 250 |
| 256 /** | 251 /** |
| 257 * The [Completer] that completes when the next operation is performed. | 252 * The [Completer] that completes when the next operation is performed. |
| 258 */ | 253 */ |
| 259 Completer _test_onOperationPerformedCompleter; | 254 Completer _test_onOperationPerformedCompleter; |
| 260 | 255 |
| 261 /** | 256 /** |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 analyzedFilesGlobs, | 415 analyzedFilesGlobs, |
| 421 instrumentationService, | 416 instrumentationService, |
| 422 defaultContextOptions, | 417 defaultContextOptions, |
| 423 options.enableNewAnalysisDriver); | 418 options.enableNewAnalysisDriver); |
| 424 } | 419 } |
| 425 this.fileResolverProvider = fileResolverProvider; | 420 this.fileResolverProvider = fileResolverProvider; |
| 426 this.packageResolverProvider = packageResolverProvider; | 421 this.packageResolverProvider = packageResolverProvider; |
| 427 ServerContextManagerCallbacks contextManagerCallbacks = | 422 ServerContextManagerCallbacks contextManagerCallbacks = |
| 428 new ServerContextManagerCallbacks(this, resourceProvider); | 423 new ServerContextManagerCallbacks(this, resourceProvider); |
| 429 contextManager.callbacks = contextManagerCallbacks; | 424 contextManager.callbacks = contextManagerCallbacks; |
| 430 _noErrorNotification = options.noErrorNotification; | |
| 431 AnalysisEngine.instance.logger = new AnalysisLogger(this); | 425 AnalysisEngine.instance.logger = new AnalysisLogger(this); |
| 432 _onAnalysisStartedController = new StreamController.broadcast(); | 426 _onAnalysisStartedController = new StreamController.broadcast(); |
| 433 _onFileAnalyzedController = new StreamController.broadcast(); | 427 _onFileAnalyzedController = new StreamController.broadcast(); |
| 434 _onPriorityChangeController = | 428 _onPriorityChangeController = |
| 435 new StreamController<PriorityChangeEvent>.broadcast(); | 429 new StreamController<PriorityChangeEvent>.broadcast(); |
| 436 running = true; | 430 running = true; |
| 437 onAnalysisStarted.first.then((_) { | 431 onAnalysisStarted.first.then((_) { |
| 438 onAnalysisComplete.then((_) { | 432 onAnalysisComplete.then((_) { |
| 439 performanceAfterStartup = new ServerPerformance(); | 433 performanceAfterStartup = new ServerPerformance(); |
| 440 _performance = performanceAfterStartup; | 434 _performance = performanceAfterStartup; |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 }); | 1437 }); |
| 1444 operationQueue.reschedule(); | 1438 operationQueue.reschedule(); |
| 1445 _onPriorityChangeController.add(new PriorityChangeEvent(firstSource)); | 1439 _onPriorityChangeController.add(new PriorityChangeEvent(firstSource)); |
| 1446 } | 1440 } |
| 1447 | 1441 |
| 1448 /** | 1442 /** |
| 1449 * Returns `true` if errors should be reported for [file] with the given | 1443 * Returns `true` if errors should be reported for [file] with the given |
| 1450 * absolute path. | 1444 * absolute path. |
| 1451 */ | 1445 */ |
| 1452 bool shouldSendErrorsNotificationFor(String file) { | 1446 bool shouldSendErrorsNotificationFor(String file) { |
| 1453 return !_noErrorNotification && contextManager.isInAnalysisRoot(file); | 1447 return contextManager.isInAnalysisRoot(file); |
| 1454 } | 1448 } |
| 1455 | 1449 |
| 1456 void shutdown() { | 1450 void shutdown() { |
| 1457 running = false; | 1451 running = false; |
| 1458 if (index != null) { | 1452 if (index != null) { |
| 1459 index.stop(); | 1453 index.stop(); |
| 1460 } | 1454 } |
| 1461 // Defer closing the channel and shutting down the instrumentation server so | 1455 // Defer closing the channel and shutting down the instrumentation server so |
| 1462 // that the shutdown response can be sent and logged. | 1456 // that the shutdown response can be sent and logged. |
| 1463 new Future(() { | 1457 new Future(() { |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 } | 1807 } |
| 1814 }); | 1808 }); |
| 1815 } | 1809 } |
| 1816 } | 1810 } |
| 1817 | 1811 |
| 1818 class AnalysisServerOptions { | 1812 class AnalysisServerOptions { |
| 1819 bool enableIncrementalResolutionApi = false; | 1813 bool enableIncrementalResolutionApi = false; |
| 1820 bool enableIncrementalResolutionValidation = false; | 1814 bool enableIncrementalResolutionValidation = false; |
| 1821 bool enableNewAnalysisDriver = false; | 1815 bool enableNewAnalysisDriver = false; |
| 1822 bool finerGrainedInvalidation = false; | 1816 bool finerGrainedInvalidation = false; |
| 1823 bool noErrorNotification = false; | |
| 1824 bool noIndex = false; | 1817 bool noIndex = false; |
| 1825 bool useAnalysisHighlight2 = false; | 1818 bool useAnalysisHighlight2 = false; |
| 1826 String fileReadMode = 'as-is'; | 1819 String fileReadMode = 'as-is'; |
| 1827 String newAnalysisDriverLog; | 1820 String newAnalysisDriverLog; |
| 1828 } | 1821 } |
| 1829 | 1822 |
| 1830 /** | 1823 /** |
| 1831 * Information about a file - an [AnalysisContext] that analyses the file, | 1824 * Information about a file - an [AnalysisContext] that analyses the file, |
| 1832 * and the [Source] representing the file in this context. | 1825 * and the [Source] representing the file in this context. |
| 1833 */ | 1826 */ |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 /** | 2259 /** |
| 2267 * The [PerformanceTag] for time spent in server request handlers. | 2260 * The [PerformanceTag] for time spent in server request handlers. |
| 2268 */ | 2261 */ |
| 2269 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2262 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2270 | 2263 |
| 2271 /** | 2264 /** |
| 2272 * The [PerformanceTag] for time spent in split store microtasks. | 2265 * The [PerformanceTag] for time spent in split store microtasks. |
| 2273 */ | 2266 */ |
| 2274 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2267 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2275 } | 2268 } |
| OLD | NEW |