OLD | NEW |
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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 void Flags::PrintFlags() { | 450 void Flags::PrintFlags() { |
451 OS::Print("Flag settings:\n"); | 451 OS::Print("Flag settings:\n"); |
452 for (intptr_t i = 0; i < num_flags_; ++i) { | 452 for (intptr_t i = 0; i < num_flags_; ++i) { |
453 flags_[i]->Print(); | 453 flags_[i]->Print(); |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 | 457 |
458 void Flags::PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag) { | 458 void Flags::PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag) { |
| 459 if (!FLAG_support_service) { |
| 460 return; |
| 461 } |
459 if (flag->IsUnrecognized() || flag->type_ == Flag::kFunc) { | 462 if (flag->IsUnrecognized() || flag->type_ == Flag::kFunc) { |
460 return; | 463 return; |
461 } | 464 } |
462 JSONObject jsflag(jsarr); | 465 JSONObject jsflag(jsarr); |
463 jsflag.AddProperty("name", flag->name_); | 466 jsflag.AddProperty("name", flag->name_); |
464 jsflag.AddProperty("comment", flag->comment_); | 467 jsflag.AddProperty("comment", flag->comment_); |
465 jsflag.AddProperty("modified", flag->changed_); | 468 jsflag.AddProperty("modified", flag->changed_); |
466 switch (flag->type_) { | 469 switch (flag->type_) { |
467 case Flag::kBoolean: { | 470 case Flag::kBoolean: { |
468 jsflag.AddProperty("_flagType", "Bool"); | 471 jsflag.AddProperty("_flagType", "Bool"); |
(...skipping 21 matching lines...) Expand all Loading... |
490 break; | 493 break; |
491 } | 494 } |
492 default: | 495 default: |
493 UNREACHABLE(); | 496 UNREACHABLE(); |
494 break; | 497 break; |
495 } | 498 } |
496 } | 499 } |
497 | 500 |
498 | 501 |
499 void Flags::PrintJSON(JSONStream* js) { | 502 void Flags::PrintJSON(JSONStream* js) { |
| 503 if (!FLAG_support_service) { |
| 504 return; |
| 505 } |
500 JSONObject jsobj(js); | 506 JSONObject jsobj(js); |
501 jsobj.AddProperty("type", "FlagList"); | 507 jsobj.AddProperty("type", "FlagList"); |
502 JSONArray jsarr(&jsobj, "flags"); | 508 JSONArray jsarr(&jsobj, "flags"); |
503 for (intptr_t i = 0; i < num_flags_; ++i) { | 509 for (intptr_t i = 0; i < num_flags_; ++i) { |
504 PrintFlagToJSONArray(&jsarr, flags_[i]); | 510 PrintFlagToJSONArray(&jsarr, flags_[i]); |
505 } | 511 } |
506 } | 512 } |
507 | 513 |
508 } // namespace dart | 514 } // namespace dart |
OLD | NEW |