Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Unified Diff: pkg/analyzer_plugin/lib/plugin/plugin.dart

Issue 2890163004: Add requestTime to responses (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/tool/spec/generate_all.dart ('k') | pkg/analyzer_plugin/lib/protocol/protocol.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/plugin/plugin.dart
diff --git a/pkg/analyzer_plugin/lib/plugin/plugin.dart b/pkg/analyzer_plugin/lib/plugin/plugin.dart
index fcbc571ea3bbf0880b15e3061e134b4d1727c1f1..406bbf3f65664a76efd327211348b03e1ab47c4a 100644
--- a/pkg/analyzer_plugin/lib/plugin/plugin.dart
+++ b/pkg/analyzer_plugin/lib/plugin/plugin.dart
@@ -489,7 +489,7 @@ abstract class ServerPlugin {
* Compute the response that should be returned for the given [request], or
* `null` if the response has already been sent.
*/
- Future<Response> _getResponse(Request request) async {
+ Future<Response> _getResponse(Request request, int requestTime) async {
ResponseResult result = null;
switch (request.method) {
case ANALYSIS_REQUEST_HANDLE_WATCH_EVENTS:
@@ -545,7 +545,7 @@ abstract class ServerPlugin {
case PLUGIN_REQUEST_SHUTDOWN:
var params = new PluginShutdownParams();
result = await handlePluginShutdown(params);
- _channel.sendResponse(result.toResponse(request.id));
+ _channel.sendResponse(result.toResponse(request.id, requestTime));
_channel.close();
return null;
case PLUGIN_REQUEST_VERSION_CHECK:
@@ -554,10 +554,10 @@ abstract class ServerPlugin {
break;
}
if (result == null) {
- return new Response(request.id,
+ return new Response(request.id, requestTime,
error: RequestErrorFactory.unknownRequest(request.method));
}
- return result.toResponse(request.id);
+ return result.toResponse(request.id, requestTime);
}
/**
@@ -565,14 +565,15 @@ abstract class ServerPlugin {
* server.
*/
Future<Null> _onRequest(Request request) async {
+ int requestTime = new DateTime.now().millisecondsSinceEpoch;
String id = request.id;
Response response;
try {
- response = await _getResponse(request);
+ response = await _getResponse(request, requestTime);
} on RequestFailure catch (exception) {
- response = new Response(id, error: exception.error);
+ response = new Response(id, requestTime, error: exception.error);
} catch (exception, stackTrace) {
- response = new Response(id,
+ response = new Response(id, requestTime,
error: new RequestError(
RequestErrorCode.PLUGIN_ERROR, exception.toString(),
stackTrace: stackTrace.toString()));
« no previous file with comments | « pkg/analysis_server/tool/spec/generate_all.dart ('k') | pkg/analyzer_plugin/lib/protocol/protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698