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

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: gen js + code review 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
« no previous file with comments | « runtime/vm/flags.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index a19f02bb882b0651e0e46ed8fb778379f8a482df..3881a1d20df837dd98f5ef168921b7bf490131cd 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1933,7 +1933,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);
@@ -1953,9 +1954,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 },
};
« no previous file with comments | « 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