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

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

Issue 328663008: Add support to trace warnings in TraceBuffer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/parser.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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 210
211 void JSONStream::PrintValue(const char* s) { 211 void JSONStream::PrintValue(const char* s) {
212 PrintCommaIfNeeded(); 212 PrintCommaIfNeeded();
213 buffer_.AddChar('"'); 213 buffer_.AddChar('"');
214 AddEscapedUTF8String(s); 214 AddEscapedUTF8String(s);
215 buffer_.AddChar('"'); 215 buffer_.AddChar('"');
216 } 216 }
217 217
218 218
219 void JSONStream::PrintValueNoEscape(const char* s) {
220 PrintCommaIfNeeded();
221 buffer_.Printf("%s", s);
222 }
223
224
219 void JSONStream::PrintfValue(const char* format, ...) { 225 void JSONStream::PrintfValue(const char* format, ...) {
220 PrintCommaIfNeeded(); 226 PrintCommaIfNeeded();
221 227
222 va_list args; 228 va_list args;
223 va_start(args, format); 229 va_start(args, format);
224 intptr_t len = OS::VSNPrint(NULL, 0, format, args); 230 intptr_t len = OS::VSNPrint(NULL, 0, format, args);
225 va_end(args); 231 va_end(args);
226 char* p = reinterpret_cast<char*>(malloc(len+1)); 232 char* p = reinterpret_cast<char*>(malloc(len+1));
227 va_start(args, format); 233 va_start(args, format);
228 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 234 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 PrintValue(d); 288 PrintValue(d);
283 } 289 }
284 290
285 291
286 void JSONStream::PrintProperty(const char* name, const char* s) { 292 void JSONStream::PrintProperty(const char* name, const char* s) {
287 PrintPropertyName(name); 293 PrintPropertyName(name);
288 PrintValue(s); 294 PrintValue(s);
289 } 295 }
290 296
291 297
298 void JSONStream::PrintPropertyNoEscape(const char* name, const char* s) {
299 PrintPropertyName(name);
300 PrintValueNoEscape(s);
301 }
302
303
292 void JSONStream::PrintProperty(const char* name, const DebuggerEvent* event) { 304 void JSONStream::PrintProperty(const char* name, const DebuggerEvent* event) {
293 PrintPropertyName(name); 305 PrintPropertyName(name);
294 PrintValue(event); 306 PrintValue(event);
295 } 307 }
296 308
297 309
298 void JSONStream::PrintProperty(const char* name, Isolate* isolate) { 310 void JSONStream::PrintProperty(const char* name, Isolate* isolate) {
299 PrintPropertyName(name); 311 PrintPropertyName(name);
300 PrintValue(isolate); 312 PrintValue(isolate);
301 } 313 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 441 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
430 va_end(args); 442 va_end(args);
431 ASSERT(len == len2); 443 ASSERT(len == len2);
432 stream_->buffer_.AddChar('"'); 444 stream_->buffer_.AddChar('"');
433 stream_->AddEscapedUTF8String(p); 445 stream_->AddEscapedUTF8String(p);
434 stream_->buffer_.AddChar('"'); 446 stream_->buffer_.AddChar('"');
435 free(p); 447 free(p);
436 } 448 }
437 449
438 } // namespace dart 450 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698