Chromium Code Reviews| 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/context.dart' as newContext; | |
| 26 import 'package:analyzer/src/generated/ast.dart'; | 27 import 'package:analyzer/src/generated/ast.dart'; |
| 27 import 'package:analyzer/src/generated/element.dart'; | 28 import 'package:analyzer/src/generated/element.dart'; |
| 28 import 'package:analyzer/src/generated/engine.dart'; | 29 import 'package:analyzer/src/generated/engine.dart'; |
| 29 import 'package:analyzer/src/generated/java_engine.dart'; | 30 import 'package:analyzer/src/generated/java_engine.dart'; |
| 30 import 'package:analyzer/src/generated/sdk.dart'; | 31 import 'package:analyzer/src/generated/sdk.dart'; |
| 31 import 'package:analyzer/src/generated/source.dart'; | 32 import 'package:analyzer/src/generated/source.dart'; |
| 32 import 'package:analyzer/src/generated/source_io.dart'; | 33 import 'package:analyzer/src/generated/source_io.dart'; |
| 33 import 'package:analyzer/src/generated/utilities_general.dart'; | 34 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 34 import 'package:plugin/plugin.dart'; | 35 import 'package:plugin/plugin.dart'; |
| 36 import 'package:analyzer/src/context/cache.dart'; | |
|
scheglov
2015/06/01 22:19:06
Sort imports?
| |
| 37 import 'package:analyzer/task/dart.dart'; | |
| 38 import 'package:analyzer/src/task/dart.dart'; | |
| 35 | 39 |
| 36 typedef void OptionUpdater(AnalysisOptionsImpl options); | 40 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| 37 | 41 |
| 38 /** | 42 /** |
| 39 * Enum representing reasons why analysis might be done for a given file. | 43 * Enum representing reasons why analysis might be done for a given file. |
| 40 */ | 44 */ |
| 41 class AnalysisDoneReason { | 45 class AnalysisDoneReason { |
| 42 /** | 46 /** |
| 43 * Analysis of the file completed successfully. | 47 * Analysis of the file completed successfully. |
| 44 */ | 48 */ |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1018 // that the shutdown response can be sent and logged. | 1022 // that the shutdown response can be sent and logged. |
| 1019 new Future(() { | 1023 new Future(() { |
| 1020 instrumentationService.shutdown(); | 1024 instrumentationService.shutdown(); |
| 1021 channel.close(); | 1025 channel.close(); |
| 1022 }); | 1026 }); |
| 1023 } | 1027 } |
| 1024 | 1028 |
| 1025 void test_flushResolvedUnit(String file) { | 1029 void test_flushResolvedUnit(String file) { |
| 1026 if (AnalysisEngine.isDartFileName(file)) { | 1030 if (AnalysisEngine.isDartFileName(file)) { |
| 1027 ContextSourcePair contextSource = getContextSourcePair(file); | 1031 ContextSourcePair contextSource = getContextSourcePair(file); |
| 1028 AnalysisContextImpl context = contextSource.context; | 1032 AnalysisContext context = contextSource.context; |
| 1029 Source source = contextSource.source; | 1033 Source source = contextSource.source; |
| 1030 DartEntry dartEntry = context.getReadableSourceEntryOrNull(source); | 1034 if (context is AnalysisContextImpl) { |
| 1031 dartEntry.flushAstStructures(); | 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 } | |
| 1032 } | 1047 } |
| 1033 } | 1048 } |
| 1034 | 1049 |
| 1035 /** | 1050 /** |
| 1036 * Performs all scheduled analysis operations. | 1051 * Performs all scheduled analysis operations. |
| 1037 */ | 1052 */ |
| 1038 void test_performAllAnalysisOperations() { | 1053 void test_performAllAnalysisOperations() { |
| 1039 while (true) { | 1054 while (true) { |
| 1040 ServerOperation operation = operationQueue.takeIf((operation) { | 1055 ServerOperation operation = operationQueue.takeIf((operation) { |
| 1041 return operation is PerformAnalysisOperation; | 1056 return operation is PerformAnalysisOperation; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1527 /** | 1542 /** |
| 1528 * The [PerformanceTag] for time spent in server request handlers. | 1543 * The [PerformanceTag] for time spent in server request handlers. |
| 1529 */ | 1544 */ |
| 1530 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1545 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1531 | 1546 |
| 1532 /** | 1547 /** |
| 1533 * The [PerformanceTag] for time spent in split store microtasks. | 1548 * The [PerformanceTag] for time spent in split store microtasks. |
| 1534 */ | 1549 */ |
| 1535 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1550 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1536 } | 1551 } |
| OLD | NEW |