| 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 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // priorityFiles.add(source.fullName); | 382 // priorityFiles.add(source.fullName); |
| 383 // }); | 383 // }); |
| 384 // }); | 384 // }); |
| 385 // return priorityFiles; | 385 // return priorityFiles; |
| 386 // } | 386 // } |
| 387 | 387 |
| 388 /** | 388 /** |
| 389 * Handle a [request] that was read from the communication channel. | 389 * Handle a [request] that was read from the communication channel. |
| 390 */ | 390 */ |
| 391 void handleRequest(Request request) { | 391 void handleRequest(Request request) { |
| 392 int count = handlers.length; | 392 runZoned(() { |
| 393 for (int i = 0; i < count; i++) { | 393 int count = handlers.length; |
| 394 try { | 394 for (int i = 0; i < count; i++) { |
| 395 Response response = handlers[i].handleRequest(request); | 395 try { |
| 396 if (response == Response.DELAYED_RESPONSE) { | 396 Response response = handlers[i].handleRequest(request); |
| 397 if (response == Response.DELAYED_RESPONSE) { |
| 398 return; |
| 399 } |
| 400 if (response != null) { |
| 401 channel.sendResponse(response); |
| 402 return; |
| 403 } |
| 404 } on RequestFailure catch (exception) { |
| 405 channel.sendResponse(exception.response); |
| 397 return; | 406 return; |
| 398 } | 407 } catch (exception, stackTrace) { |
| 399 if (response != null) { | 408 _sendServerErrorNotification(exception, stackTrace); |
| 409 RequestError error = |
| 410 new RequestError(RequestErrorCode.SERVER_ERROR, 'Server Error'); |
| 411 Response response = new Response(request.id, error: error); |
| 400 channel.sendResponse(response); | 412 channel.sendResponse(response); |
| 401 return; | 413 return; |
| 402 } | 414 } |
| 403 } on RequestFailure catch (exception) { | |
| 404 channel.sendResponse(exception.response); | |
| 405 return; | |
| 406 } | 415 } |
| 407 } | 416 channel.sendResponse(new Response.unknownRequest(request)); |
| 408 channel.sendResponse(new Response.unknownRequest(request)); | 417 }, onError: _sendServerErrorNotification); |
| 409 } | 418 } |
| 410 | 419 |
| 411 /** | 420 /** |
| 412 * Returns `true` if there is a subscription for the given [server] and [file]
. | 421 * Returns `true` if there is a subscription for the given [server] and [file]
. |
| 413 */ | 422 */ |
| 414 bool hasAnalysisSubscription(AnalysisService service, String file) { | 423 bool hasAnalysisSubscription(AnalysisService service, String file) { |
| 415 Set<String> files = analysisServices[service]; | 424 Set<String> files = analysisServices[service]; |
| 416 return files != null && files.contains(file); | 425 return files != null && files.contains(file); |
| 417 } | 426 } |
| 418 | 427 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 * An object that is listening for lifecycle events from an analysis server. | 935 * An object that is listening for lifecycle events from an analysis server. |
| 927 */ | 936 */ |
| 928 abstract class AnalysisServerListener { | 937 abstract class AnalysisServerListener { |
| 929 /** | 938 /** |
| 930 * Analysis is complete. | 939 * Analysis is complete. |
| 931 */ | 940 */ |
| 932 void analysisComplete(); | 941 void analysisComplete(); |
| 933 } | 942 } |
| 934 | 943 |
| 935 typedef void OptionUpdater(AnalysisOptionsImpl options); | 944 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| OLD | NEW |