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

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

Issue 217323006: Redo allocationprofile options (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/service.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/debugger.h" 8 #include "vm/debugger.h"
9 #include "vm/json_stream.h" 9 #include "vm/json_stream.h"
10 #include "vm/message.h" 10 #include "vm/message.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const char* JSONStream::LookupOption(const char* key) const { 132 const char* JSONStream::LookupOption(const char* key) const {
133 for (int i = 0; i < num_options(); i++) { 133 for (int i = 0; i < num_options(); i++) {
134 if (!strcmp(key, option_keys_[i])) { 134 if (!strcmp(key, option_keys_[i])) {
135 return option_values_[i]; 135 return option_values_[i];
136 } 136 }
137 } 137 }
138 return NULL; 138 return NULL;
139 } 139 }
140 140
141 141
142 bool JSONStream::HasOption(const char* key) const {
143 ASSERT(key);
144 return LookupOption(key) != NULL;
145 }
146
147
148 bool JSONStream::OptionIs(const char* key, const char* value) const {
149 ASSERT(key);
150 ASSERT(value);
151 const char* key_value = LookupOption(key);
152 return (key_value != NULL) && (strcmp(key_value, value) == 0);
153 }
turnidge 2014/04/01 20:23:28 Consider adding a heartbeat unit test for these tw
Cutch 2014/04/01 22:01:14 Added a test for options and arguments in JSONStre
154
155
142 void JSONStream::Clear() { 156 void JSONStream::Clear() {
143 buffer_.Clear(); 157 buffer_.Clear();
144 open_objects_ = 0; 158 open_objects_ = 0;
145 } 159 }
146 160
147 161
148 void JSONStream::OpenObject(const char* property_name) { 162 void JSONStream::OpenObject(const char* property_name) {
149 PrintCommaIfNeeded(); 163 PrintCommaIfNeeded();
150 open_objects_++; 164 open_objects_++;
151 if (property_name != NULL) { 165 if (property_name != NULL) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 416 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
403 va_end(args); 417 va_end(args);
404 ASSERT(len == len2); 418 ASSERT(len == len2);
405 stream_->buffer_.AddChar('"'); 419 stream_->buffer_.AddChar('"');
406 stream_->AddEscapedUTF8String(p); 420 stream_->AddEscapedUTF8String(p);
407 stream_->buffer_.AddChar('"'); 421 stream_->buffer_.AddChar('"');
408 free(p); 422 free(p);
409 } 423 }
410 424
411 } // namespace dart 425 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698