| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 _performance = performanceDuringStartup; | 359 _performance = performanceDuringStartup; |
| 360 defaultContextOptions.incremental = true; | 360 defaultContextOptions.incremental = true; |
| 361 defaultContextOptions.incrementalApi = | 361 defaultContextOptions.incrementalApi = |
| 362 options.enableIncrementalResolutionApi; | 362 options.enableIncrementalResolutionApi; |
| 363 defaultContextOptions.incrementalValidation = | 363 defaultContextOptions.incrementalValidation = |
| 364 options.enableIncrementalResolutionValidation; | 364 options.enableIncrementalResolutionValidation; |
| 365 defaultContextOptions.finerGrainedInvalidation = | 365 defaultContextOptions.finerGrainedInvalidation = |
| 366 options.finerGrainedInvalidation; | 366 options.finerGrainedInvalidation; |
| 367 defaultContextOptions.generateImplicitErrors = false; | 367 defaultContextOptions.generateImplicitErrors = false; |
| 368 operationQueue = new ServerOperationQueue(); | 368 operationQueue = new ServerOperationQueue(); |
| 369 _analysisPerformanceLogger = new nd.PerformanceLog(io.stdout); | 369 |
| 370 { |
| 371 String name = options.newAnalysisDriverLog; |
| 372 StringSink sink = new _NullStringSink(); |
| 373 if (name != null) { |
| 374 if (name == 'stdout') { |
| 375 sink = io.stdout; |
| 376 } else if (name.startsWith('file:')) { |
| 377 String path = name.substring('file:'.length); |
| 378 sink = new io.File(path).openWrite(mode: io.FileMode.APPEND); |
| 379 } |
| 380 } |
| 381 _analysisPerformanceLogger = new nd.PerformanceLog(sink); |
| 382 } |
| 370 if (resourceProvider is PhysicalResourceProvider) { | 383 if (resourceProvider is PhysicalResourceProvider) { |
| 371 byteStore = new MemoryCachingByteStore( | 384 byteStore = new MemoryCachingByteStore( |
| 372 new FileByteStore( | 385 new FileByteStore( |
| 373 resourceProvider.getStateLocation('.analysis-driver').path, | 386 resourceProvider.getStateLocation('.analysis-driver').path, |
| 374 1024 * 1024 * 1024 /*1 GiB*/), | 387 1024 * 1024 * 1024 /*1 GiB*/), |
| 375 64 * 1024 * 1024 /*64 MiB*/); | 388 64 * 1024 * 1024 /*64 MiB*/); |
| 376 } else { | 389 } else { |
| 377 byteStore = new MemoryByteStore(); | 390 byteStore = new MemoryByteStore(); |
| 378 } | 391 } |
| 379 analysisDriverScheduler = | 392 analysisDriverScheduler = |
| 380 new nd.AnalysisDriverScheduler(_analysisPerformanceLogger); | 393 new nd.AnalysisDriverScheduler(_analysisPerformanceLogger); |
| 381 analysisDriverScheduler.status.listen(sendStatusNotificationNew); | 394 analysisDriverScheduler.status.listen(sendStatusNotificationNew); |
| 382 analysisDriverScheduler.start(); | 395 analysisDriverScheduler.start(); |
| 396 |
| 383 if (useSingleContextManager) { | 397 if (useSingleContextManager) { |
| 384 contextManager = new SingleContextManager(resourceProvider, sdkManager, | 398 contextManager = new SingleContextManager(resourceProvider, sdkManager, |
| 385 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions); | 399 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions); |
| 386 } else { | 400 } else { |
| 387 contextManager = new ContextManagerImpl( | 401 contextManager = new ContextManagerImpl( |
| 388 resourceProvider, | 402 resourceProvider, |
| 389 sdkManager, | 403 sdkManager, |
| 390 packageResolverProvider, | 404 packageResolverProvider, |
| 391 packageMapProvider, | 405 packageMapProvider, |
| 392 analyzedFilesGlobs, | 406 analyzedFilesGlobs, |
| (...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 class AnalysisServerOptions { | 1739 class AnalysisServerOptions { |
| 1726 bool enableIncrementalResolutionApi = false; | 1740 bool enableIncrementalResolutionApi = false; |
| 1727 bool enableIncrementalResolutionValidation = false; | 1741 bool enableIncrementalResolutionValidation = false; |
| 1728 bool enableNewAnalysisDriver = false; | 1742 bool enableNewAnalysisDriver = false; |
| 1729 bool enablePubSummaryManager = false; | 1743 bool enablePubSummaryManager = false; |
| 1730 bool finerGrainedInvalidation = false; | 1744 bool finerGrainedInvalidation = false; |
| 1731 bool noErrorNotification = false; | 1745 bool noErrorNotification = false; |
| 1732 bool noIndex = false; | 1746 bool noIndex = false; |
| 1733 bool useAnalysisHighlight2 = false; | 1747 bool useAnalysisHighlight2 = false; |
| 1734 String fileReadMode = 'as-is'; | 1748 String fileReadMode = 'as-is'; |
| 1749 String newAnalysisDriverLog; |
| 1735 } | 1750 } |
| 1736 | 1751 |
| 1737 /** | 1752 /** |
| 1738 * Information about a file - an [AnalysisContext] that analyses the file, | 1753 * Information about a file - an [AnalysisContext] that analyses the file, |
| 1739 * and the [Source] representing the file in this context. | 1754 * and the [Source] representing the file in this context. |
| 1740 */ | 1755 */ |
| 1741 class ContextSourcePair { | 1756 class ContextSourcePair { |
| 1742 /** | 1757 /** |
| 1743 * A context that analysis the file. | 1758 * A context that analysis the file. |
| 1744 * May be `null` if the file is not analyzed by any context. | 1759 * May be `null` if the file is not analyzed by any context. |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 /** | 2076 /** |
| 2062 * The [PerformanceTag] for time spent in server request handlers. | 2077 * The [PerformanceTag] for time spent in server request handlers. |
| 2063 */ | 2078 */ |
| 2064 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2079 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2065 | 2080 |
| 2066 /** | 2081 /** |
| 2067 * The [PerformanceTag] for time spent in split store microtasks. | 2082 * The [PerformanceTag] for time spent in split store microtasks. |
| 2068 */ | 2083 */ |
| 2069 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2084 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2070 } | 2085 } |
| 2086 |
| 2087 class _NullStringSink implements StringSink { |
| 2088 void write(Object obj) {} |
| 2089 void writeAll(Iterable objects, [String separator = ""]) {} |
| 2090 void writeCharCode(int charCode) {} |
| 2091 void writeln([Object obj = ""]) {} |
| 2092 } |
| OLD | NEW |