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

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
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/native_api_impl.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"
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/service.h" 14 #include "vm/service.h"
15 #include "vm/unicode.h" 15 #include "vm/unicode.h"
16 16
17 17
18 namespace dart { 18 namespace dart {
19 19
20 DECLARE_FLAG(bool, trace_service); 20 DECLARE_FLAG(bool, trace_service);
21 21
22 JSONStream::JSONStream(intptr_t buf_size) 22 JSONStream::JSONStream(intptr_t buf_size)
23 : open_objects_(0), 23 : open_objects_(0),
24 buffer_(buf_size), 24 buffer_(buf_size),
25 default_id_zone_(Isolate::Current()->object_id_ring(), 25 default_id_zone_(Isolate::Current()->object_id_ring(),
26 ObjectIdRing::kAllocateId), 26 ObjectIdRing::kAllocateId),
27 id_zone_(&default_id_zone_), 27 id_zone_(&default_id_zone_),
28 reply_port_(ILLEGAL_PORT), 28 reply_port_(DART_ILLEGAL_PORT),
29 seq_(""), 29 seq_(""),
30 method_(""), 30 method_(""),
31 param_keys_(NULL), 31 param_keys_(NULL),
32 param_values_(NULL), 32 param_values_(NULL),
33 num_params_(0) { 33 num_params_(0) {
34 } 34 }
35 35
36 36
37 JSONStream::~JSONStream() { 37 JSONStream::~JSONStream() {
38 } 38 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 153
154 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 154 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
155 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); 155 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
156 return reinterpret_cast<uint8_t*>(new_ptr); 156 return reinterpret_cast<uint8_t*>(new_ptr);
157 } 157 }
158 158
159 159
160 void JSONStream::PostReply() { 160 void JSONStream::PostReply() {
161 Dart_Port port = reply_port(); 161 Dart_Port port = reply_port();
162 ASSERT(port != ILLEGAL_PORT); 162 ASSERT(port != DART_ILLEGAL_PORT);
163 set_reply_port(ILLEGAL_PORT); // Prevent double replies. 163 set_reply_port(DART_ILLEGAL_PORT); // Prevent double replies.
164 int64_t process_delta_micros = 0; 164 int64_t process_delta_micros = 0;
165 if (FLAG_trace_service) { 165 if (FLAG_trace_service) {
166 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_; 166 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_;
167 } 167 }
168 // TODO(turnidge): Handle non-string sequence numbers. 168 // TODO(turnidge): Handle non-string sequence numbers.
169 buffer_.Printf(", \"id\":\"%s\"}", seq()); 169 buffer_.Printf(", \"id\":\"%s\"}", seq());
170 const String& reply = String::Handle(String::New(ToCString())); 170 const String& reply = String::Handle(String::New(ToCString()));
171 ASSERT(!reply.IsNull()); 171 ASSERT(!reply.IsNull());
172 172
173 uint8_t* data = NULL; 173 uint8_t* data = NULL;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); 588 intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
589 va_end(args); 589 va_end(args);
590 ASSERT(len == len2); 590 ASSERT(len == len2);
591 stream_->buffer_.AddChar('"'); 591 stream_->buffer_.AddChar('"');
592 stream_->AddEscapedUTF8String(p); 592 stream_->AddEscapedUTF8String(p);
593 stream_->buffer_.AddChar('"'); 593 stream_->buffer_.AddChar('"');
594 free(p); 594 free(p);
595 } 595 }
596 596
597 } // namespace dart 597 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/native_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698