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

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

Issue 803523003: Add support for a client id (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « no previous file | editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/DartCore.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/StdioServerSocket.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/StdioServerSocket.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/StdioServerSocket.java
index 6b73e2dd7c4f1524a61f549bc82c46a518a0ce00..65d709190292aaef8ffd6246793a78df27713cbc 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/StdioServerSocket.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/StdioServerSocket.java
@@ -68,6 +68,12 @@ public class StdioServerSocket implements AnalysisServerSocket {
*/
private final boolean noErrorNotification;
+ /**
+ * The identifier used to identify this client to the server, or {@code null} if the client does
+ * not choose to identify itself.
+ */
+ private String clientId;
+
public StdioServerSocket(String runtimePath, String analysisServerPath,
DebugPrintStream debugStream, boolean debugRemoteProcess, boolean profileRemoteProcess,
int httpPort) {
@@ -116,33 +122,18 @@ public class StdioServerSocket implements AnalysisServerSocket {
return responseStream;
}
+ /**
+ * Set the identifier used to identify this client to the server to the given identifier. The
+ * identifier must be set before the server has been started.
+ */
+ public void setClientId(String id) {
+ clientId = id;
+ }
+
@Override
public void start() throws Exception {
int debugPort = findUnusedPort();
- List<String> args = new ArrayList<String>();
- args.add(runtimePath);
- args.add("--old_gen_heap_size=4096");
- if (packageRoot != null) {
- args.add("--package-root=" + packageRoot);
- }
- if (debugRemoteProcess) {
- args.add("--debug:" + debugPort);
- }
- if (profileRemoteProcess) {
- args.add("--observe");
- args.add("--pause-isolates-on-exit");
- }
- if (noErrorNotification) {
- args.add("--no-error-notification");
- }
- args.add(analysisServerPath);
- if (httpPort != 0) {
- args.add("--port=" + httpPort);
- }
- for (String arg : additionalProgramArguments) {
- args.add(arg);
- }
- String[] arguments = args.toArray(new String[args.size()]);
+ String[] arguments = computeProcessArguments(debugPort);
if (debugStream != null) {
StringBuilder builder = new StringBuilder();
builder.append(" ");
@@ -200,4 +191,52 @@ public class StdioServerSocket implements AnalysisServerSocket {
processToStop.destroy();
System.out.println("Terminated " + analysisServerPath);
}
+
+ /**
+ * Compute and return the command-line arguments used to start the analysis server process.
+ *
+ * @param debugPort the port that the VM should use for debug connections
+ * @return the command-line arguments that were computed
+ */
+ private String[] computeProcessArguments(int debugPort) {
+ List<String> args = new ArrayList<String>();
+ //
+ // The path to the VM.
+ //
+ args.add(runtimePath);
+ //
+ // VM arguments.
+ //
+ args.add("--old_gen_heap_size=4096");
+ if (packageRoot != null) {
+ args.add("--package-root=" + packageRoot);
+ }
+ if (debugRemoteProcess) {
+ args.add("--debug:" + debugPort);
+ }
+ if (profileRemoteProcess) {
+ args.add("--observe");
+ args.add("--pause-isolates-on-exit");
+ }
+ if (noErrorNotification) {
+ args.add("--no-error-notification");
+ }
+ //
+ // The analysis server path.
+ //
+ args.add(analysisServerPath);
+ //
+ // Analysis server arguments.
+ //
+ if (clientId != null) {
+ args.add("--client-id=" + clientId);
+ }
+ if (httpPort != 0) {
+ args.add("--port=" + httpPort);
+ }
+ for (String arg : additionalProgramArguments) {
+ args.add(arg);
+ }
+ return args.toArray(new String[args.size()]);
+ }
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/DartCore.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698