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

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

Issue 113513004: Handle vmservice messages while at breakpoint. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/debugger.h"
7 #include "vm/json_stream.h" 8 #include "vm/json_stream.h"
8 9
9 10
10 namespace dart { 11 namespace dart {
11 12
12 JSONStream::JSONStream(intptr_t buf_size) : buffer_(buf_size) { 13 JSONStream::JSONStream(intptr_t buf_size) : buffer_(buf_size) {
13 open_objects_ = 0; 14 open_objects_ = 0;
14 arguments_ = NULL; 15 arguments_ = NULL;
15 num_arguments_ = 0; 16 num_arguments_ = 0;
16 option_keys_ = NULL; 17 option_keys_ = NULL;
17 option_values_ = NULL; 18 option_values_ = NULL;
18 num_options_ = 0; 19 num_options_ = 0;
19 } 20 }
20 21
21 22
22 JSONStream::~JSONStream() { 23 JSONStream::~JSONStream() {
23 } 24 }
24 25
25 26
27 const char* JSONStream::LookupOption(const char* key) const {
28 for (int i = 0; i < num_options(); i++) {
29 if (!strcmp(key, option_keys_[i])) {
30 return option_values_[i];
31 }
32 }
33 return NULL;
34 }
35
36
26 void JSONStream::Clear() { 37 void JSONStream::Clear() {
27 buffer_.Clear(); 38 buffer_.Clear();
28 open_objects_ = 0; 39 open_objects_ = 0;
29 } 40 }
30 41
31 42
32 void JSONStream::OpenObject(const char* property_name) { 43 void JSONStream::OpenObject(const char* property_name) {
33 PrintCommaIfNeeded(); 44 PrintCommaIfNeeded();
34 open_objects_++; 45 open_objects_++;
35 if (property_name != NULL) { 46 if (property_name != NULL) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 126
116 127
117 void JSONStream::PrintValue(const Field& field, 128 void JSONStream::PrintValue(const Field& field,
118 const Instance& instance, 129 const Instance& instance,
119 bool ref) { 130 bool ref) {
120 PrintCommaIfNeeded(); 131 PrintCommaIfNeeded();
121 field.PrintToJSONStreamWithInstance(this, instance, ref); 132 field.PrintToJSONStreamWithInstance(this, instance, ref);
122 } 133 }
123 134
124 135
136 void JSONStream::PrintValue(const SourceBreakpoint* bpt) {
137 PrintCommaIfNeeded();
138 bpt->PrintToJSONStream(this);
139 }
140
141
125 void JSONStream::PrintPropertyBool(const char* name, bool b) { 142 void JSONStream::PrintPropertyBool(const char* name, bool b) {
126 PrintPropertyName(name); 143 PrintPropertyName(name);
127 PrintValueBool(b); 144 PrintValueBool(b);
128 } 145 }
129 146
130 147
131 void JSONStream::PrintProperty(const char* name, intptr_t i) { 148 void JSONStream::PrintProperty(const char* name, intptr_t i) {
132 PrintPropertyName(name); 149 PrintPropertyName(name);
133 PrintValue(i); 150 PrintValue(i);
134 } 151 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 265 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
249 va_end(args); 266 va_end(args);
250 ASSERT(len == len2); 267 ASSERT(len == len2);
251 stream_->buffer_.AddChar('"'); 268 stream_->buffer_.AddChar('"');
252 stream_->buffer_.AddEscapedString(p); 269 stream_->buffer_.AddEscapedString(p);
253 stream_->buffer_.AddChar('"'); 270 stream_->buffer_.AddChar('"');
254 free(p); 271 free(p);
255 } 272 }
256 273
257 } // namespace dart 274 } // 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