| 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 | 8 |
| 9 import 'package:analysis_server/src/analysis_logger.dart'; | 9 import 'package:analysis_server/src/analysis_logger.dart'; |
| 10 import 'package:analysis_server/src/channel.dart'; | 10 import 'package:analysis_server/src/channel.dart'; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 sendNotices(notices); | 130 sendNotices(notices); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 // | 133 // |
| 134 // Schedule this method to be run again if there is any more work to be done
. | 134 // Schedule this method to be run again if there is any more work to be done
. |
| 135 // | 135 // |
| 136 if (contextWorkQueue.isEmpty) { | 136 if (contextWorkQueue.isEmpty) { |
| 137 running = false; | 137 running = false; |
| 138 } else { | 138 } else { |
| 139 new Future(performTask).catchError((exception, stackTrace) { | 139 new Future(performTask).catchError((exception, stackTrace) { |
| 140 AnalysisEngine.instance.logger.logError3(exception); | 140 AnalysisEngine.instance.logger.logError(exception); |
| 141 }); | 141 }); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 /** | 145 /** |
| 146 * Send the information in the given list of notices back to the client. | 146 * Send the information in the given list of notices back to the client. |
| 147 */ | 147 */ |
| 148 void sendNotices(List<ChangeNotice> notices) { | 148 void sendNotices(List<ChangeNotice> notices) { |
| 149 for (int i = 0; i < notices.length; i++) { | 149 for (int i = 0; i < notices.length; i++) { |
| 150 ChangeNotice notice = notices[i]; | 150 ChangeNotice notice = notices[i]; |
| 151 Notification notification = new Notification(ERROR_NOTIFICATION_NAME); | 151 Notification notification = new Notification(ERROR_NOTIFICATION_NAME); |
| 152 notification.setParameter(SOURCE_PARAM, notice.source.encoding); | 152 notification.setParameter(SOURCE_PARAM, notice.source.encoding); |
| 153 notification.setParameter(ERRORS_PARAM, notice.errors); | 153 notification.setParameter(ERRORS_PARAM, notice.errors); |
| 154 sendNotification(notification); | 154 sendNotification(notification); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Perform the tasks that are waiting for execution until the server is shut | 159 * Perform the tasks that are waiting for execution until the server is shut |
| 160 * down. | 160 * down. |
| 161 */ | 161 */ |
| 162 void run() { | 162 void run() { |
| 163 if (!running) { | 163 if (!running) { |
| 164 running = true; | 164 running = true; |
| 165 new Future(performTask).catchError((exception, stackTrace) { | 165 new Future(performTask).catchError((exception, stackTrace) { |
| 166 AnalysisEngine.instance.logger.logError3(exception); | 166 AnalysisEngine.instance.logger.logError(exception); |
| 167 }); | 167 }); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 /** | 171 /** |
| 172 * Send the given [notification] to the client. | 172 * Send the given [notification] to the client. |
| 173 */ | 173 */ |
| 174 void sendNotification(Notification notification) { | 174 void sendNotification(Notification notification) { |
| 175 channel.sendNotification(notification); | 175 channel.sendNotification(notification); |
| 176 } | 176 } |
| 177 } | 177 } |
| OLD | NEW |