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

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

Issue 979823003: Major rework of vm service events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/message_handler.h » ('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"
11 #include "vm/metrics.h" 11 #include "vm/metrics.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/service_event.h"
13 #include "vm/unicode.h" 14 #include "vm/unicode.h"
14 15
15 16
16 namespace dart { 17 namespace dart {
17 18
18 DECLARE_FLAG(bool, trace_service); 19 DECLARE_FLAG(bool, trace_service);
19 20
20 JSONStream::JSONStream(intptr_t buf_size) 21 JSONStream::JSONStream(intptr_t buf_size)
21 : open_objects_(0), 22 : open_objects_(0),
22 buffer_(buf_size), 23 buffer_(buf_size),
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 o.PrintJSON(this, ref); 237 o.PrintJSON(this, ref);
237 } 238 }
238 239
239 240
240 void JSONStream::PrintValue(SourceBreakpoint* bpt) { 241 void JSONStream::PrintValue(SourceBreakpoint* bpt) {
241 PrintCommaIfNeeded(); 242 PrintCommaIfNeeded();
242 bpt->PrintJSON(this); 243 bpt->PrintJSON(this);
243 } 244 }
244 245
245 246
246 void JSONStream::PrintValue(const DebuggerEvent* event) { 247 void JSONStream::PrintValue(const ServiceEvent* event) {
247 PrintCommaIfNeeded(); 248 PrintCommaIfNeeded();
248 event->PrintJSON(this); 249 event->PrintJSON(this);
249 } 250 }
250 251
251 252
252 void JSONStream::PrintValue(Metric* metric) { 253 void JSONStream::PrintValue(Metric* metric) {
253 PrintCommaIfNeeded(); 254 PrintCommaIfNeeded();
254 metric->PrintJSON(this); 255 metric->PrintJSON(this);
255 } 256 }
256 257
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return PrintValueStr(s, limit); 299 return PrintValueStr(s, limit);
299 } 300 }
300 301
301 302
302 void JSONStream::PrintPropertyNoEscape(const char* name, const char* s) { 303 void JSONStream::PrintPropertyNoEscape(const char* name, const char* s) {
303 PrintPropertyName(name); 304 PrintPropertyName(name);
304 PrintValueNoEscape(s); 305 PrintValueNoEscape(s);
305 } 306 }
306 307
307 308
308 void JSONStream::PrintProperty(const char* name, const DebuggerEvent* event) { 309 void JSONStream::PrintProperty(const char* name, const ServiceEvent* event) {
309 PrintPropertyName(name); 310 PrintPropertyName(name);
310 PrintValue(event); 311 PrintValue(event);
311 } 312 }
312 313
313 314
314 void JSONStream::PrintProperty(const char* name, SourceBreakpoint* bpt) { 315 void JSONStream::PrintProperty(const char* name, SourceBreakpoint* bpt) {
315 PrintPropertyName(name); 316 PrintPropertyName(name);
316 PrintValue(bpt); 317 PrintValue(bpt);
317 } 318 }
318 319
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 478 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
478 va_end(args); 479 va_end(args);
479 ASSERT(len == len2); 480 ASSERT(len == len2);
480 stream_->buffer_.AddChar('"'); 481 stream_->buffer_.AddChar('"');
481 stream_->AddEscapedUTF8String(p); 482 stream_->AddEscapedUTF8String(p);
482 stream_->buffer_.AddChar('"'); 483 stream_->buffer_.AddChar('"');
483 free(p); 484 free(p);
484 } 485 }
485 486
486 } // namespace dart 487 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698