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

Side by Side Diff: runtime/vm/flags.cc

Issue 1149403007: Rework the format of the FlagList response. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « runtime/observatory/lib/src/elements/flag_list.html ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flags.h" 5 #include "vm/flags.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/json_stream.h" 8 #include "vm/json_stream.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 10
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 421
422 422
423 void Flags::PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag) { 423 void Flags::PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag) {
424 if (flag->IsUnrecognized() || flag->type_ == Flag::kFunc) { 424 if (flag->IsUnrecognized() || flag->type_ == Flag::kFunc) {
425 return; 425 return;
426 } 426 }
427 JSONObject jsflag(jsarr); 427 JSONObject jsflag(jsarr);
428 jsflag.AddProperty("name", flag->name_); 428 jsflag.AddProperty("name", flag->name_);
429 jsflag.AddProperty("comment", flag->comment_); 429 jsflag.AddProperty("comment", flag->comment_);
430 jsflag.AddProperty("modified", flag->changed_);
430 switch (flag->type_) { 431 switch (flag->type_) {
431 case Flag::kBoolean: { 432 case Flag::kBoolean: {
432 jsflag.AddProperty("_flagType", "Bool"); 433 jsflag.AddProperty("_flagType", "Bool");
433 jsflag.AddProperty("valueAsString", 434 jsflag.AddProperty("valueAsString",
434 (*flag->bool_ptr_ ? "true" : "false")); 435 (*flag->bool_ptr_ ? "true" : "false"));
435 break; 436 break;
436 } 437 }
437 case Flag::kInteger: { 438 case Flag::kInteger: {
438 jsflag.AddProperty("_flagType", "Int"); 439 jsflag.AddProperty("_flagType", "Int");
439 jsflag.AddPropertyF("valueAsString", "%d", *flag->int_ptr_); 440 jsflag.AddPropertyF("valueAsString", "%d", *flag->int_ptr_);
(...skipping 16 matching lines...) Expand all
456 default: 457 default:
457 UNREACHABLE(); 458 UNREACHABLE();
458 break; 459 break;
459 } 460 }
460 } 461 }
461 462
462 463
463 void Flags::PrintJSON(JSONStream* js) { 464 void Flags::PrintJSON(JSONStream* js) {
464 JSONObject jsobj(js); 465 JSONObject jsobj(js);
465 jsobj.AddProperty("type", "FlagList"); 466 jsobj.AddProperty("type", "FlagList");
466 { 467 JSONArray jsarr(&jsobj, "flags");
467 JSONArray jsarr(&jsobj, "unmodifiedFlags"); 468 for (intptr_t i = 0; i < num_flags_; ++i) {
468 for (intptr_t i = 0; i < num_flags_; ++i) { 469 PrintFlagToJSONArray(&jsarr, flags_[i]);
469 Flag* flag = flags_[i];
470 if (!flag->changed_) {
471 PrintFlagToJSONArray(&jsarr, flag);
472 }
473 }
474 }
475 {
476 JSONArray jsarr(&jsobj, "modifiedFlags");
477 for (intptr_t i = 0; i < num_flags_; ++i) {
478 Flag* flag = flags_[i];
479 if (flag->changed_) {
480 PrintFlagToJSONArray(&jsarr, flag);
481 }
482 }
483 } 470 }
484 } 471 }
485 472
486 } // namespace dart 473 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/flag_list.html ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698