| 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:math' show max; | 9 import 'dart:math' show max; |
| 10 | 10 |
| 11 import 'package:analysis_server/plugin/analyzed_files.dart'; | 11 import 'package:analysis_server/plugin/analyzed_files.dart'; |
| 12 import 'package:analysis_server/src/analysis_logger.dart'; | 12 import 'package:analysis_server/src/analysis_logger.dart'; |
| 13 import 'package:analysis_server/src/channel/channel.dart'; | 13 import 'package:analysis_server/src/channel/channel.dart'; |
| 14 import 'package:analysis_server/src/context_manager.dart'; | 14 import 'package:analysis_server/src/context_manager.dart'; |
| 15 import 'package:analysis_server/src/operation/operation.dart'; | 15 import 'package:analysis_server/src/operation/operation.dart'; |
| 16 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 16 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
| 17 import 'package:analysis_server/src/operation/operation_queue.dart'; | 17 import 'package:analysis_server/src/operation/operation_queue.dart'; |
| 18 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 18 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 19 import 'package:analysis_server/src/protocol.dart' hide Element; | 19 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 20 import 'package:analysis_server/src/services/correction/namespace.dart'; | 20 import 'package:analysis_server/src/services/correction/namespace.dart'; |
| 21 import 'package:analysis_server/src/services/index/index.dart'; | 21 import 'package:analysis_server/src/services/index/index.dart'; |
| 22 import 'package:analysis_server/src/services/search/search_engine.dart'; | 22 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 23 import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.d
art'; | 23 import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.d
art'; |
| 24 import 'package:analyzer/file_system/file_system.dart'; | 24 import 'package:analyzer/file_system/file_system.dart'; |
| 25 import 'package:analyzer/instrumentation/instrumentation.dart'; | 25 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 26 import 'package:analyzer/src/context/cache.dart'; | |
| 27 import 'package:analyzer/src/context/context.dart' as newContext; | |
| 28 import 'package:analyzer/src/generated/ast.dart'; | 26 import 'package:analyzer/src/generated/ast.dart'; |
| 29 import 'package:analyzer/src/generated/element.dart'; | 27 import 'package:analyzer/src/generated/element.dart'; |
| 30 import 'package:analyzer/src/generated/engine.dart'; | 28 import 'package:analyzer/src/generated/engine.dart'; |
| 31 import 'package:analyzer/src/generated/java_engine.dart'; | 29 import 'package:analyzer/src/generated/java_engine.dart'; |
| 32 import 'package:analyzer/src/generated/sdk.dart'; | 30 import 'package:analyzer/src/generated/sdk.dart'; |
| 33 import 'package:analyzer/src/generated/source.dart'; | 31 import 'package:analyzer/src/generated/source.dart'; |
| 34 import 'package:analyzer/src/generated/source_io.dart'; | 32 import 'package:analyzer/src/generated/source_io.dart'; |
| 35 import 'package:analyzer/src/generated/utilities_general.dart'; | 33 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 36 import 'package:analyzer/src/task/dart.dart'; | |
| 37 import 'package:analyzer/task/dart.dart'; | |
| 38 import 'package:plugin/plugin.dart'; | 34 import 'package:plugin/plugin.dart'; |
| 39 | 35 |
| 40 typedef void OptionUpdater(AnalysisOptionsImpl options); | 36 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| 41 | 37 |
| 42 /** | 38 /** |
| 43 * Enum representing reasons why analysis might be done for a given file. | 39 * Enum representing reasons why analysis might be done for a given file. |
| 44 */ | 40 */ |
| 45 class AnalysisDoneReason { | 41 class AnalysisDoneReason { |
| 46 /** | 42 /** |
| 47 * Analysis of the file completed successfully. | 43 * Analysis of the file completed successfully. |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 index.stop(); | 1015 index.stop(); |
| 1020 } | 1016 } |
| 1021 // Defer closing the channel and shutting down the instrumentation server so | 1017 // Defer closing the channel and shutting down the instrumentation server so |
| 1022 // that the shutdown response can be sent and logged. | 1018 // that the shutdown response can be sent and logged. |
| 1023 new Future(() { | 1019 new Future(() { |
| 1024 instrumentationService.shutdown(); | 1020 instrumentationService.shutdown(); |
| 1025 channel.close(); | 1021 channel.close(); |
| 1026 }); | 1022 }); |
| 1027 } | 1023 } |
| 1028 | 1024 |
| 1029 void test_flushResolvedUnit(String file) { | 1025 void test_flushAstStructures(String file) { |
| 1030 if (AnalysisEngine.isDartFileName(file)) { | 1026 if (AnalysisEngine.isDartFileName(file)) { |
| 1031 ContextSourcePair contextSource = getContextSourcePair(file); | 1027 ContextSourcePair contextSource = getContextSourcePair(file); |
| 1032 AnalysisContext context = contextSource.context; | 1028 InternalAnalysisContext context = contextSource.context; |
| 1033 Source source = contextSource.source; | 1029 Source source = contextSource.source; |
| 1034 if (context is AnalysisContextImpl) { | 1030 context.test_flushAstStructures(source); |
| 1035 DartEntry dartEntry = context.getReadableSourceEntryOrNull(source); | |
| 1036 dartEntry.flushAstStructures(); | |
| 1037 } else if (context is newContext.AnalysisContextImpl) { | |
| 1038 CacheEntry entry = context.getCacheEntry(source); | |
| 1039 entry.setState(RESOLVED_UNIT1, CacheState.FLUSHED); | |
| 1040 entry.setState(RESOLVED_UNIT2, CacheState.FLUSHED); | |
| 1041 entry.setState(RESOLVED_UNIT3, CacheState.FLUSHED); | |
| 1042 entry.setState(RESOLVED_UNIT4, CacheState.FLUSHED); | |
| 1043 entry.setState(RESOLVED_UNIT5, CacheState.FLUSHED); | |
| 1044 entry.setState(RESOLVED_UNIT6, CacheState.FLUSHED); | |
| 1045 entry.setState(RESOLVED_UNIT, CacheState.FLUSHED); | |
| 1046 } | |
| 1047 } | 1031 } |
| 1048 } | 1032 } |
| 1049 | 1033 |
| 1050 /** | 1034 /** |
| 1051 * Performs all scheduled analysis operations. | 1035 * Performs all scheduled analysis operations. |
| 1052 */ | 1036 */ |
| 1053 void test_performAllAnalysisOperations() { | 1037 void test_performAllAnalysisOperations() { |
| 1054 while (true) { | 1038 while (true) { |
| 1055 ServerOperation operation = operationQueue.takeIf((operation) { | 1039 ServerOperation operation = operationQueue.takeIf((operation) { |
| 1056 return operation is PerformAnalysisOperation; | 1040 return operation is PerformAnalysisOperation; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 /** | 1526 /** |
| 1543 * The [PerformanceTag] for time spent in server request handlers. | 1527 * The [PerformanceTag] for time spent in server request handlers. |
| 1544 */ | 1528 */ |
| 1545 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1529 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1546 | 1530 |
| 1547 /** | 1531 /** |
| 1548 * The [PerformanceTag] for time spent in split store microtasks. | 1532 * The [PerformanceTag] for time spent in split store microtasks. |
| 1549 */ | 1533 */ |
| 1550 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1534 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1551 } | 1535 } |
| OLD | NEW |