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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 * The package resolver provider used to override the way package URI's are | 310 * The package resolver provider used to override the way package URI's are |
311 * resolved in some contexts. | 311 * resolved in some contexts. |
312 */ | 312 */ |
313 ResolverProvider packageResolverProvider; | 313 ResolverProvider packageResolverProvider; |
314 | 314 |
315 /** | 315 /** |
316 * The manager of pub package summaries. | 316 * The manager of pub package summaries. |
317 */ | 317 */ |
318 PubSummaryManager pubSummaryManager; | 318 PubSummaryManager pubSummaryManager; |
319 | 319 |
| 320 nd.PerformanceLog _analysisPerformanceLogger; |
320 ByteStore byteStore; | 321 ByteStore byteStore; |
| 322 nd.AnalysisDriverScheduler analysisDriverScheduler; |
321 | 323 |
322 /** | 324 /** |
323 * The set of the files that are currently priority. | 325 * The set of the files that are currently priority. |
324 */ | 326 */ |
325 final Set<String> priorityFiles = new Set<String>(); | 327 final Set<String> priorityFiles = new Set<String>(); |
326 | 328 |
327 /** | 329 /** |
328 * The cached results units for [priorityFiles]. | 330 * The cached results units for [priorityFiles]. |
329 */ | 331 */ |
330 final Map<String, nd.AnalysisResult> priorityFileResults = {}; | 332 final Map<String, nd.AnalysisResult> priorityFileResults = {}; |
(...skipping 25 matching lines...) Expand all Loading... |
356 _performance = performanceDuringStartup; | 358 _performance = performanceDuringStartup; |
357 defaultContextOptions.incremental = true; | 359 defaultContextOptions.incremental = true; |
358 defaultContextOptions.incrementalApi = | 360 defaultContextOptions.incrementalApi = |
359 options.enableIncrementalResolutionApi; | 361 options.enableIncrementalResolutionApi; |
360 defaultContextOptions.incrementalValidation = | 362 defaultContextOptions.incrementalValidation = |
361 options.enableIncrementalResolutionValidation; | 363 options.enableIncrementalResolutionValidation; |
362 defaultContextOptions.finerGrainedInvalidation = | 364 defaultContextOptions.finerGrainedInvalidation = |
363 options.finerGrainedInvalidation; | 365 options.finerGrainedInvalidation; |
364 defaultContextOptions.generateImplicitErrors = false; | 366 defaultContextOptions.generateImplicitErrors = false; |
365 operationQueue = new ServerOperationQueue(); | 367 operationQueue = new ServerOperationQueue(); |
| 368 _analysisPerformanceLogger = new nd.PerformanceLog(io.stdout); |
366 byteStore = new MemoryCachingByteStore( | 369 byteStore = new MemoryCachingByteStore( |
367 new FileByteStore( | 370 new FileByteStore( |
368 resourceProvider.getStateLocation('.analysis-driver')), | 371 resourceProvider.getStateLocation('.analysis-driver')), |
369 1024); | 372 1024 * 32); |
| 373 analysisDriverScheduler = new nd.AnalysisDriverScheduler(_analysisPerformanc
eLogger); |
| 374 analysisDriverScheduler.start(); |
370 if (useSingleContextManager) { | 375 if (useSingleContextManager) { |
371 contextManager = new SingleContextManager(resourceProvider, sdkManager, | 376 contextManager = new SingleContextManager(resourceProvider, sdkManager, |
372 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions); | 377 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions); |
373 } else { | 378 } else { |
374 contextManager = new ContextManagerImpl( | 379 contextManager = new ContextManagerImpl( |
375 resourceProvider, | 380 resourceProvider, |
376 sdkManager, | 381 sdkManager, |
377 packageResolverProvider, | 382 packageResolverProvider, |
378 packageMapProvider, | 383 packageMapProvider, |
379 analyzedFilesGlobs, | 384 analyzedFilesGlobs, |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 SourceFactory sourceFactory; | 1746 SourceFactory sourceFactory; |
1742 AnalysisOptions analysisOptions; | 1747 AnalysisOptions analysisOptions; |
1743 { | 1748 { |
1744 ContextBuilder builder = createContextBuilder(folder, options); | 1749 ContextBuilder builder = createContextBuilder(folder, options); |
1745 AnalysisContext context = builder.buildContext(folder.path); | 1750 AnalysisContext context = builder.buildContext(folder.path); |
1746 sourceFactory = context.sourceFactory; | 1751 sourceFactory = context.sourceFactory; |
1747 analysisOptions = context.analysisOptions; | 1752 analysisOptions = context.analysisOptions; |
1748 context.dispose(); | 1753 context.dispose(); |
1749 } | 1754 } |
1750 nd.AnalysisDriver analysisDriver = new nd.AnalysisDriver( | 1755 nd.AnalysisDriver analysisDriver = new nd.AnalysisDriver( |
1751 new nd.PerformanceLog(io.stdout), | 1756 analysisServer.analysisDriverScheduler, |
| 1757 analysisServer._analysisPerformanceLogger, |
1752 resourceProvider, | 1758 resourceProvider, |
1753 analysisServer.byteStore, | 1759 analysisServer.byteStore, |
1754 analysisServer.fileContentOverlay, | 1760 analysisServer.fileContentOverlay, |
1755 sourceFactory, | 1761 sourceFactory, |
1756 analysisOptions); | 1762 analysisOptions); |
1757 analysisDriver.name = folder.shortName; | 1763 analysisDriver.name = folder.shortName; |
1758 analysisDriver.status.listen((status) { | 1764 analysisDriver.status.listen((status) { |
1759 // TODO(scheglov) send server status | 1765 // TODO(scheglov) send server status |
1760 }); | 1766 }); |
1761 analysisDriver.results.listen((result) { | 1767 analysisDriver.results.listen((result) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 /** | 2017 /** |
2012 * The [PerformanceTag] for time spent in server request handlers. | 2018 * The [PerformanceTag] for time spent in server request handlers. |
2013 */ | 2019 */ |
2014 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2020 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
2015 | 2021 |
2016 /** | 2022 /** |
2017 * The [PerformanceTag] for time spent in split store microtasks. | 2023 * The [PerformanceTag] for time spent in split store microtasks. |
2018 */ | 2024 */ |
2019 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2025 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2020 } | 2026 } |
OLD | NEW |