OLD | NEW |
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 157 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
158 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 158 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
159 return reinterpret_cast<uint8_t*>(new_ptr); | 159 return reinterpret_cast<uint8_t*>(new_ptr); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 void JSONStream::PostNullReply(Dart_Port port) { | 163 void JSONStream::PostNullReply(Dart_Port port) { |
164 const Object& reply = Object::Handle(Object::null()); | 164 PortMap::PostMessage(new Message( |
165 ASSERT(reply.IsNull()); | 165 port, Object::null(), Message::kNormalPriority)); |
166 | |
167 uint8_t* data = NULL; | |
168 MessageWriter writer(&data, &allocator, false); | |
169 writer.WriteMessage(reply); | |
170 PortMap::PostMessage(new Message(port, | |
171 data, | |
172 writer.BytesWritten(), | |
173 Message::kNormalPriority)); | |
174 } | 166 } |
175 | 167 |
176 | 168 |
177 void JSONStream::PostReply() { | 169 void JSONStream::PostReply() { |
178 Dart_Port port = reply_port(); | 170 Dart_Port port = reply_port(); |
179 ASSERT(port != ILLEGAL_PORT); | 171 ASSERT(port != ILLEGAL_PORT); |
180 set_reply_port(ILLEGAL_PORT); // Prevent double replies. | 172 set_reply_port(ILLEGAL_PORT); // Prevent double replies. |
181 int64_t process_delta_micros = 0; | 173 int64_t process_delta_micros = 0; |
182 if (FLAG_trace_service) { | 174 if (FLAG_trace_service) { |
183 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_; | 175 process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 828 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
837 va_end(args); | 829 va_end(args); |
838 ASSERT(len == len2); | 830 ASSERT(len == len2); |
839 stream_->buffer_.AddChar('"'); | 831 stream_->buffer_.AddChar('"'); |
840 stream_->AddEscapedUTF8String(p); | 832 stream_->AddEscapedUTF8String(p); |
841 stream_->buffer_.AddChar('"'); | 833 stream_->buffer_.AddChar('"'); |
842 free(p); | 834 free(p); |
843 } | 835 } |
844 | 836 |
845 } // namespace dart | 837 } // namespace dart |
OLD | NEW |