| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 SetParams(param_keys_native, param_values_native, param_keys.Length()); | 66 SetParams(param_keys_native, param_values_native, param_keys.Length()); |
| 67 } | 67 } |
| 68 if (FLAG_trace_service) { | 68 if (FLAG_trace_service) { |
| 69 Isolate* isolate = Isolate::Current(); | 69 Isolate* isolate = Isolate::Current(); |
| 70 ASSERT(isolate != NULL); | 70 ASSERT(isolate != NULL); |
| 71 const char* isolate_name = isolate->name(); | 71 const char* isolate_name = isolate->name(); |
| 72 OS::Print("Isolate %s processing service request %s\n", | 72 OS::Print("Isolate %s processing service request %s\n", |
| 73 isolate_name, method_); | 73 isolate_name, method_); |
| 74 setup_time_micros_ = OS::GetCurrentTimeMicros(); | 74 setup_time_micros_ = OS::GetCurrentTimeMicros(); |
| 75 } | 75 } |
| 76 buffer_.Printf("{\"result\":"); | 76 buffer_.Printf("{\"json-rpc\":\"2.0\", \"result\":"); |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 void JSONStream::SetupError() { | 80 void JSONStream::SetupError() { |
| 81 buffer_.Clear(); | 81 buffer_.Clear(); |
| 82 buffer_.Printf("{\"error\":"); | 82 buffer_.Printf("{\"json-rpc\":\"2.0\", \"error\":"); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 static const char* GetJSONRpcErrorMessage(intptr_t code) { | 86 static const char* GetJSONRpcErrorMessage(intptr_t code) { |
| 87 switch (code) { | 87 switch (code) { |
| 88 case kParseError: | 88 case kParseError: |
| 89 return "Parse error"; | 89 return "Parse error"; |
| 90 case kInvalidRequest: | 90 case kInvalidRequest: |
| 91 return "Invalid Request"; | 91 return "Invalid Request"; |
| 92 case kMethodNotFound: | 92 case kMethodNotFound: |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 609 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 610 va_end(args); | 610 va_end(args); |
| 611 ASSERT(len == len2); | 611 ASSERT(len == len2); |
| 612 stream_->buffer_.AddChar('"'); | 612 stream_->buffer_.AddChar('"'); |
| 613 stream_->AddEscapedUTF8String(p); | 613 stream_->AddEscapedUTF8String(p); |
| 614 stream_->buffer_.AddChar('"'); | 614 stream_->buffer_.AddChar('"'); |
| 615 free(p); | 615 free(p); |
| 616 } | 616 } |
| 617 | 617 |
| 618 } // namespace dart | 618 } // namespace dart |
| OLD | NEW |