| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void JSONStream::PrintError(intptr_t code, | 124 void JSONStream::PrintError(intptr_t code, |
| 125 const char* details_format, ...) { | 125 const char* details_format, ...) { |
| 126 SetupError(); | 126 SetupError(); |
| 127 JSONObject jsobj(this); | 127 JSONObject jsobj(this); |
| 128 jsobj.AddProperty("code", code); | 128 jsobj.AddProperty("code", code); |
| 129 jsobj.AddProperty("message", GetJSONRpcErrorMessage(code)); | 129 jsobj.AddProperty("message", GetJSONRpcErrorMessage(code)); |
| 130 { | 130 { |
| 131 JSONObject data(&jsobj, "data"); | 131 JSONObject data(&jsobj, "data"); |
| 132 PrintRequest(&data, this); | 132 PrintRequest(&data, this); |
| 133 if (details_format != NULL) { | 133 if (details_format != NULL) { |
| 134 Isolate* isolate = Isolate::Current(); | |
| 135 | |
| 136 va_list args; | 134 va_list args; |
| 137 va_start(args, details_format); | 135 va_start(args, details_format); |
| 138 intptr_t len = OS::VSNPrint(NULL, 0, details_format, args); | 136 intptr_t len = OS::VSNPrint(NULL, 0, details_format, args); |
| 139 va_end(args); | 137 va_end(args); |
| 140 | 138 |
| 141 char* buffer = isolate->current_zone()->Alloc<char>(len + 1); | 139 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1); |
| 142 va_list args2; | 140 va_list args2; |
| 143 va_start(args2, details_format); | 141 va_start(args2, details_format); |
| 144 OS::VSNPrint(buffer, (len + 1), details_format, args2); | 142 OS::VSNPrint(buffer, (len + 1), details_format, args2); |
| 145 va_end(args2); | 143 va_end(args2); |
| 146 | 144 |
| 147 data.AddProperty("details", buffer); | 145 data.AddProperty("details", buffer); |
| 148 } | 146 } |
| 149 } | 147 } |
| 150 } | 148 } |
| 151 | 149 |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 677 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 680 va_end(args); | 678 va_end(args); |
| 681 ASSERT(len == len2); | 679 ASSERT(len == len2); |
| 682 stream_->buffer_.AddChar('"'); | 680 stream_->buffer_.AddChar('"'); |
| 683 stream_->AddEscapedUTF8String(p); | 681 stream_->AddEscapedUTF8String(p); |
| 684 stream_->buffer_.AddChar('"'); | 682 stream_->buffer_.AddChar('"'); |
| 685 free(p); | 683 free(p); |
| 686 } | 684 } |
| 687 | 685 |
| 688 } // namespace dart | 686 } // namespace dart |
| OLD | NEW |