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

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

Issue 1130753006: Hide Isolate pointer from embedder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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
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/service_event.h"
14 #include "vm/unicode.h" 14 #include "vm/unicode.h"
15 15
16 16
17 namespace dart { 17 namespace dart {
18 18
19 DECLARE_FLAG(bool, trace_service); 19 DECLARE_FLAG(bool, trace_service);
20 20
21 JSONStream::JSONStream(intptr_t buf_size) 21 JSONStream::JSONStream(intptr_t buf_size)
22 : open_objects_(0), 22 : open_objects_(0),
23 buffer_(buf_size), 23 buffer_(buf_size),
24 reply_port_(ILLEGAL_PORT), 24 reply_port_(DART_ILLEGAL_PORT),
25 seq_(""), 25 seq_(""),
26 method_(""), 26 method_(""),
27 param_keys_(NULL), 27 param_keys_(NULL),
28 param_values_(NULL), 28 param_values_(NULL),
29 num_params_(0) { 29 num_params_(0) {
30 } 30 }
31 31
32 32
33 JSONStream::~JSONStream() { 33 JSONStream::~JSONStream() {
34 } 34 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 81
82 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 82 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
83 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); 83 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
84 return reinterpret_cast<uint8_t*>(new_ptr); 84 return reinterpret_cast<uint8_t*>(new_ptr);
85 } 85 }
86 86
87 87
88 void JSONStream::PostReply() { 88 void JSONStream::PostReply() {
89 Dart_Port port = reply_port(); 89 Dart_Port port = reply_port();
90 ASSERT(port != ILLEGAL_PORT); 90 ASSERT(port != DART_ILLEGAL_PORT);
91 set_reply_port(ILLEGAL_PORT); // Prevent double replies. 91 set_reply_port(DART_ILLEGAL_PORT); // Prevent double replies.
92 int64_t process_delta_micros = 0; 92 int64_t process_delta_micros = 0;
93 if (FLAG_trace_service) { 93 if (FLAG_trace_service) {
94 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_; 94 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_;
95 } 95 }
96 // TODO(turnidge): Handle non-string sequence numbers. 96 // TODO(turnidge): Handle non-string sequence numbers.
97 buffer_.Printf(", \"id\":\"%s\"}", seq()); 97 buffer_.Printf(", \"id\":\"%s\"}", seq());
98 const String& reply = String::Handle(String::New(ToCString())); 98 const String& reply = String::Handle(String::New(ToCString()));
99 ASSERT(!reply.IsNull()); 99 ASSERT(!reply.IsNull());
100 100
101 uint8_t* data = NULL; 101 uint8_t* data = NULL;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 510 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
511 va_end(args); 511 va_end(args);
512 ASSERT(len == len2); 512 ASSERT(len == len2);
513 stream_->buffer_.AddChar('"'); 513 stream_->buffer_.AddChar('"');
514 stream_->AddEscapedUTF8String(p); 514 stream_->AddEscapedUTF8String(p);
515 stream_->buffer_.AddChar('"'); 515 stream_->buffer_.AddChar('"');
516 free(p); 516 free(p);
517 } 517 }
518 518
519 } // namespace dart 519 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698