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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/utilities/RequestUtilities.java

Issue 865383002: add optional request field to record time at which client made request (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 11 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
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/utilities/RequestUtilities.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/utilities/RequestUtilities.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/utilities/RequestUtilities.java
index 1f18f3f190749fc46422a9ace8744bc41e717c49..a92926b8ab55d9bf1eadb3d46057be530768ac4d 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/utilities/RequestUtilities.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/utilities/RequestUtilities.java
@@ -43,6 +43,7 @@ public class RequestUtilities {
private static final String METHOD = "method";
private static final String OFFSET = "offset";
private static final String PARAMS = "params";
+ private static final String CLIENT_REQUEST_TIME = "clientRequestTime";
private static final String SELECTION_LENGTH = "selectionLength";
private static final String SELECTION_OFFSET = "selectionOffset";
private static final String SUBSCRIPTIONS = "subscriptions";
@@ -89,6 +90,11 @@ public class RequestUtilities {
private static final String METHOD_EXECUTION_MAP_URI = "execution.mapUri";
private static final String METHOD_EXECUTION_SET_SUBSCRIPTIONS = "execution.setSubscriptions";
+ /**
+ * Flag indicating whether requests should include the time at which the request is made.
+ */
+ private static boolean includeRequestTime = true;
+
@VisibleForTesting
public static JsonElement buildJsonElement(Object object) {
if (object instanceof Boolean) {
@@ -741,6 +747,13 @@ public class RequestUtilities {
return buildJsonObjectRequest(idValue, METHOD_SERVER_SHUTDOWN);
}
+ /**
+ * Set whether the request time is included in the request itself.
+ */
+ public static void setIncludeRequestTime(boolean includeRequestTime) {
+ RequestUtilities.includeRequestTime = includeRequestTime;
+ }
+
private static JsonObject buildJsonObjectAnalysisError(AnalysisError error) {
JsonObject errorJsonObject = new JsonObject();
errorJsonObject.addProperty("severity", error.getSeverity());
@@ -776,6 +789,9 @@ public class RequestUtilities {
if (params != null) {
jsonObject.add(PARAMS, params);
}
+ if (includeRequestTime) {
+ jsonObject.addProperty(CLIENT_REQUEST_TIME, System.currentTimeMillis());
+ }
return jsonObject;
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.server_test/src/com/google/dart/server/internal/remote/RemoteAnalysisServerImplTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698