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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:core'; | 7 import 'dart:core'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 import 'dart:math' show max; | 9 import 'dart:math' show max; |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 import 'package:analyzer/src/generated/sdk.dart'; | 54 import 'package:analyzer/src/generated/sdk.dart'; |
| 55 import 'package:analyzer/src/generated/source.dart'; | 55 import 'package:analyzer/src/generated/source.dart'; |
| 56 import 'package:analyzer/src/generated/source_io.dart'; | 56 import 'package:analyzer/src/generated/source_io.dart'; |
| 57 import 'package:analyzer/src/generated/utilities_general.dart'; | 57 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 58 import 'package:analyzer/src/util/glob.dart'; | 58 import 'package:analyzer/src/util/glob.dart'; |
| 59 import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element; | 59 import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element; |
| 60 import 'package:front_end/src/base/performace_logger.dart'; | 60 import 'package:front_end/src/base/performace_logger.dart'; |
| 61 import 'package:front_end/src/incremental/byte_store.dart'; | 61 import 'package:front_end/src/incremental/byte_store.dart'; |
| 62 import 'package:front_end/src/incremental/file_byte_store.dart'; | 62 import 'package:front_end/src/incremental/file_byte_store.dart'; |
| 63 import 'package:plugin/plugin.dart'; | 63 import 'package:plugin/plugin.dart'; |
| 64 import 'package:telemetry/crash_reporting.dart'; | |
| 65 import 'package:telemetry/telemetry.dart' as telemetry; | |
| 64 import 'package:watcher/watcher.dart'; | 66 import 'package:watcher/watcher.dart'; |
| 65 | 67 |
| 66 typedef void OptionUpdater(AnalysisOptionsImpl options); | 68 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| 67 | 69 |
| 68 /** | 70 /** |
| 69 * Enum representing reasons why analysis might be done for a given file. | 71 * Enum representing reasons why analysis might be done for a given file. |
| 70 */ | 72 */ |
| 71 class AnalysisDoneReason { | 73 class AnalysisDoneReason { |
| 72 /** | 74 /** |
| 73 * Analysis of the file completed successfully. | 75 * Analysis of the file completed successfully. |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 stackTrace = StackTrace.current; | 773 stackTrace = StackTrace.current; |
| 772 buffer.writeln(); | 774 buffer.writeln(); |
| 773 buffer.write(stackTrace); | 775 buffer.write(stackTrace); |
| 774 } | 776 } |
| 775 | 777 |
| 776 // send the notification | 778 // send the notification |
| 777 channel.sendNotification( | 779 channel.sendNotification( |
| 778 new ServerErrorParams(fatal, message, buffer.toString()) | 780 new ServerErrorParams(fatal, message, buffer.toString()) |
| 779 .toNotification()); | 781 .toNotification()); |
| 780 | 782 |
| 783 // send to crash reporting | |
| 784 options.crashReportSender?.sendReport(exception, stackTrace: stackTrace); | |
| 785 | |
| 781 // remember the last few exceptions | 786 // remember the last few exceptions |
| 782 if (exception is CaughtException) { | 787 if (exception is CaughtException) { |
| 783 stackTrace ??= exception.stackTrace; | 788 stackTrace ??= exception.stackTrace; |
| 784 } | 789 } |
| 785 exceptions.add(new ServerException(message, exception, stackTrace, fatal)); | 790 exceptions.add(new ServerException(message, exception, stackTrace, fatal)); |
| 786 } | 791 } |
| 787 | 792 |
| 788 /** | 793 /** |
| 789 * Send status notification to the client. The state of analysis is given by | 794 * Send status notification to the client. The state of analysis is given by |
| 790 * the [status] information. | 795 * the [status] information. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 } | 902 } |
| 898 | 903 |
| 899 /** | 904 /** |
| 900 * Returns `true` if errors should be reported for [file] with the given | 905 * Returns `true` if errors should be reported for [file] with the given |
| 901 * absolute path. | 906 * absolute path. |
| 902 */ | 907 */ |
| 903 bool shouldSendErrorsNotificationFor(String file) { | 908 bool shouldSendErrorsNotificationFor(String file) { |
| 904 return contextManager.isInAnalysisRoot(file); | 909 return contextManager.isInAnalysisRoot(file); |
| 905 } | 910 } |
| 906 | 911 |
| 907 void shutdown() { | 912 Future<Null> shutdown() async { |
| 908 running = false; | 913 running = false; |
| 914 | |
| 915 await options.analytics | |
| 916 ?.waitForLastPing(timeout: new Duration(milliseconds: 200)); | |
| 917 options.analytics?.close(); | |
| 918 | |
| 909 // Defer closing the channel and shutting down the instrumentation server so | 919 // Defer closing the channel and shutting down the instrumentation server so |
| 910 // that the shutdown response can be sent and logged. | 920 // that the shutdown response can be sent and logged. |
| 911 new Future(() { | 921 new Future(() { |
| 912 instrumentationService.shutdown(); | 922 instrumentationService.shutdown(); |
| 913 channel.close(); | 923 channel.close(); |
| 914 }); | 924 }); |
| 915 } | 925 } |
| 916 | 926 |
| 917 /** | 927 /** |
| 918 * Implementation for `analysis.updateContent`. | 928 * Implementation for `analysis.updateContent`. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 } | 1054 } |
| 1045 | 1055 |
| 1046 class AnalysisServerOptions { | 1056 class AnalysisServerOptions { |
| 1047 bool useAnalysisHighlight2 = false; | 1057 bool useAnalysisHighlight2 = false; |
| 1048 String fileReadMode = 'as-is'; | 1058 String fileReadMode = 'as-is'; |
| 1049 String newAnalysisDriverLog; | 1059 String newAnalysisDriverLog; |
| 1050 | 1060 |
| 1051 String clientId; | 1061 String clientId; |
| 1052 String clientVersion; | 1062 String clientVersion; |
| 1053 | 1063 |
| 1064 /// The analytics instance; note, this object can be `null`, and should be | |
|
Brian Wilkerson
2017/07/02 15:54:26
Perhaps use a doc comment style consistent with ex
devoncarew
2017/07/04 02:35:48
Done.
| |
| 1065 /// accessed via a null-aware operator. | |
| 1066 telemetry.Analytics analytics; | |
| 1067 | |
| 1068 /// The crash report sender instance; note, this object can be `null`, and | |
| 1069 /// should be accessed via a null-aware operator. | |
| 1070 CrashReportSender crashReportSender; | |
| 1071 | |
| 1054 // IDE options | 1072 // IDE options |
|
Brian Wilkerson
2017/07/02 15:54:26
This should have been a doc comment (one disadvant
devoncarew
2017/07/04 02:35:48
Sure - moved to the AnalysisServerOptions class.
| |
| 1055 bool enableVerboseFlutterCompletions = false; | 1073 bool enableVerboseFlutterCompletions = false; |
| 1056 } | 1074 } |
| 1057 | 1075 |
| 1058 /** | 1076 /** |
| 1059 * A [PriorityChangeEvent] indicates the set the priority files has changed. | 1077 * A [PriorityChangeEvent] indicates the set the priority files has changed. |
| 1060 */ | 1078 */ |
| 1061 class PriorityChangeEvent { | 1079 class PriorityChangeEvent { |
| 1062 final Source firstSource; | 1080 final Source firstSource; |
| 1063 | 1081 |
| 1064 PriorityChangeEvent(this.firstSource); | 1082 PriorityChangeEvent(this.firstSource); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1465 /** | 1483 /** |
| 1466 * The [PerformanceTag] for time spent in server request handlers. | 1484 * The [PerformanceTag] for time spent in server request handlers. |
| 1467 */ | 1485 */ |
| 1468 static PerformanceTag serverRequests = server.createChild('requests'); | 1486 static PerformanceTag serverRequests = server.createChild('requests'); |
| 1469 | 1487 |
| 1470 /** | 1488 /** |
| 1471 * The [PerformanceTag] for time spent in split store microtasks. | 1489 * The [PerformanceTag] for time spent in split store microtasks. |
| 1472 */ | 1490 */ |
| 1473 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1491 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1474 } | 1492 } |
| OLD | NEW |