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

Unified Diff: runtime/vm/service.cc

Issue 299143007: Show flags in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweaks Created 6 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
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 07334619a7fce141aa824daae4e0be0443b68806..54ee16855bf7b603c6c1547265dc4abbb8f11d40 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1912,7 +1912,8 @@ static bool HandleVM(JSONStream* js) {
JSONObject jsobj(js);
jsobj.AddProperty("type", "VM");
jsobj.AddProperty("id", "vm");
- jsobj.AddProperty("architecture", CPU::Id());
+ jsobj.AddProperty("targetCPU", CPU::Id());
+ jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
jsobj.AddProperty("version", Version::String());
jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts);
jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks);
@@ -1932,9 +1933,47 @@ static bool HandleVM(JSONStream* js) {
}
+static bool HandleFlags(JSONStream* js) {
+ if (js->num_arguments() == 1) {
+ Flags::PrintJSON(js);
+ return true;
+ } else if (js->num_arguments() == 2) {
+ const char* arg = js->GetArgument(1);
+ if (strcmp(arg, "set") == 0) {
+ if (js->num_arguments() > 2) {
+ PrintError(js, "expected at most 2 arguments but found %" Pd "\n",
+ js->num_arguments());
+ } else {
+ if (js->HasOption("name") && js->HasOption("value")) {
+ JSONObject jsobj(js);
+ const char* flag_name = js->LookupOption("name");
+ const char* flag_value = js->LookupOption("value");
+ const char* error = NULL;
+ if (Flags::SetFlag(flag_name, flag_value, &error)) {
+ jsobj.AddProperty("type", "Success");
+ jsobj.AddProperty("id", "");
+ } else {
+ jsobj.AddProperty("type", "Failure");
+ jsobj.AddProperty("id", "");
+ jsobj.AddProperty("message", error);
+ }
+ } else {
+ PrintError(js, "expected to find 'name' and 'value' options");
+ }
+ }
+ }
+ return true;
+ } else {
+ PrintError(js, "Command too long");
+ return true;
+ }
+}
+
+
static RootMessageHandlerEntry root_handlers[] = {
{ "_echo", HandleRootEcho },
{ "vm", HandleVM },
+ { "flags", HandleFlags },
};
« runtime/vm/flags.cc ('K') | « runtime/vm/flags.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698