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

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

Issue 1241683005: Support piping log data over the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/service.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"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 buffer_.Printf("%" Pd "", i); 263 buffer_.Printf("%" Pd "", i);
264 } 264 }
265 265
266 266
267 void JSONStream::PrintValue64(int64_t i) { 267 void JSONStream::PrintValue64(int64_t i) {
268 PrintCommaIfNeeded(); 268 PrintCommaIfNeeded();
269 buffer_.Printf("%" Pd64 "", i); 269 buffer_.Printf("%" Pd64 "", i);
270 } 270 }
271 271
272 272
273 void JSONStream::PrintValueTimeMillis(int64_t millis) {
274 PrintValue(static_cast<double>(millis));
275 }
276
277
273 void JSONStream::PrintValue(double d) { 278 void JSONStream::PrintValue(double d) {
274 PrintCommaIfNeeded(); 279 PrintCommaIfNeeded();
275 buffer_.Printf("%f", d); 280 buffer_.Printf("%f", d);
276 } 281 }
277 282
278 283
279 static const char base64_digits[65] = 284 static const char base64_digits[65] =
280 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 285 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
281 static const char base64_pad = '='; 286 static const char base64_pad = '=';
282 287
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 420 }
416 421
417 422
418 void JSONStream::PrintProperty64(const char* name, int64_t i) { 423 void JSONStream::PrintProperty64(const char* name, int64_t i) {
419 ASSERT(Utils::IsJavascriptInt64(i)); 424 ASSERT(Utils::IsJavascriptInt64(i));
420 PrintPropertyName(name); 425 PrintPropertyName(name);
421 PrintValue64(i); 426 PrintValue64(i);
422 } 427 }
423 428
424 429
430 void JSONStream::PrintPropertyTimeMillis(const char* name, int64_t millis) {
431 PrintProperty(name, static_cast<double>(millis));
432 }
433
434
425 void JSONStream::PrintProperty(const char* name, double d) { 435 void JSONStream::PrintProperty(const char* name, double d) {
426 PrintPropertyName(name); 436 PrintPropertyName(name);
427 PrintValue(d); 437 PrintValue(d);
428 } 438 }
429 439
430 440
431 void JSONStream::PrintProperty(const char* name, const char* s) { 441 void JSONStream::PrintProperty(const char* name, const char* s) {
432 PrintPropertyName(name); 442 PrintPropertyName(name);
433 PrintValue(s); 443 PrintValue(s);
434 } 444 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 687 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
678 va_end(args); 688 va_end(args);
679 ASSERT(len == len2); 689 ASSERT(len == len2);
680 stream_->buffer_.AddChar('"'); 690 stream_->buffer_.AddChar('"');
681 stream_->AddEscapedUTF8String(p); 691 stream_->AddEscapedUTF8String(p);
682 stream_->buffer_.AddChar('"'); 692 stream_->buffer_.AddChar('"');
683 free(p); 693 free(p);
684 } 694 }
685 695
686 } // namespace dart 696 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698