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

Unified Diff: samples/total/src/TotalRunner.dart

Issue 8317006: Added builtin native call to exit the running vm (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More readable test for parameter type Created 9 years, 2 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 | « runtime/bin/builtin_in.cc ('k') | samples/total/src/TotalServer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/total/src/TotalRunner.dart
diff --git a/samples/total/src/TotalRunner.dart b/samples/total/src/TotalRunner.dart
index c05c9b0962f598d5ef0cac246ffd14cfb9a95636..4db1892c9fb0a4b2126176a7d60923deea4de7f7 100755
--- a/samples/total/src/TotalRunner.dart
+++ b/samples/total/src/TotalRunner.dart
@@ -9,39 +9,34 @@ typedef void ExitCallback(int status, String exitString);
void main() {
String SERVER_EXEC_PATH = './TotalServer.dart';
- String RESTART = "GRACEFUL RESTART!!";
- String EXIT = "GRACEFUL EXIT!!";
+ final int RESTART_STATUS = 42;
+ final int EXIT_STATUS = 0;
void keepServerRunning(int status, ServerRunner runner) {
- switch (runner.lastExitString) {
- case RESTART:
- runner.lastExitString = '';
+ switch (status) {
+ case RESTART_STATUS:
runner.run(keepServerRunning);
break;
- case EXIT:
+ case EXIT_STATUS:
break;
default:
- print("ERROR: exiting due to unknown condition. Exit status: $status."
- + " Exit string: '${runner.lastExitString}'");
+ print("ERROR: exiting due to unknown condition. Exit status: $status.");
break;
}
}
- new ServerRunner(SERVER_EXEC_PATH, [RESTART, EXIT]).run(keepServerRunning);
+ new ServerRunner(SERVER_EXEC_PATH).run(keepServerRunning);
}
class ServerRunner {
- List<String> _exitStrings;
String _serverMain;
- String lastExitString;
-
// TODO: Release or Debug? We should be able to find automatically
static final DART_EXEC_PATH = '../../../runtime/out/Release_ia32/dart_bin';
static final CR = 0x0d;
static final LF = 0x0a;
- ServerRunner(String this._serverMain, List<String> this._exitStrings);
+ ServerRunner(String this._serverMain);
void run(ExitCallback exitCallback) {
Process dart = new Process(DART_EXEC_PATH, [_serverMain]);
@@ -72,21 +67,8 @@ class ServerRunner {
readSoFar.clear();
if (line.length != 0) {
print(line);
- _updateLastExitString(line);
}
}
});
}
-
- void _updateLastExitString(String line) {
- _exitStrings.some((String e) {
- if (line.contains(e, 0)) {
- lastExitString = e;
- return true;
- } else {
- return false;
- }
- });
- }
-
}
« no previous file with comments | « runtime/bin/builtin_in.cc ('k') | samples/total/src/TotalServer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698