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 #ifndef VM_JSON_STREAM_H_ | 5 #ifndef VM_JSON_STREAM_H_ |
6 #define VM_JSON_STREAM_H_ | 6 #define VM_JSON_STREAM_H_ |
7 | 7 |
8 #include "include/dart_api.h" // for Dart_Port | 8 #include "include/dart_api.h" // for Dart_Port |
9 #include "platform/json.h" | 9 #include "platform/json.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 class Array; | 14 class Array; |
15 class Field; | 15 class Field; |
16 class GrowableObjectArray; | 16 class GrowableObjectArray; |
17 class Instance; | 17 class Instance; |
18 class JSONArray; | 18 class JSONArray; |
19 class JSONObject; | 19 class JSONObject; |
20 class MessageQueue; | 20 class MessageQueue; |
21 class Metric; | 21 class Metric; |
22 class Object; | 22 class Object; |
23 class ServiceEvent; | 23 class ServiceEvent; |
24 class SourceBreakpoint; | 24 class SourceBreakpoint; |
25 class String; | 25 class String; |
26 class Zone; | 26 class Zone; |
27 | 27 |
| 28 |
| 29 enum JSONRpcErrorCode { |
| 30 kParseError = -32700, |
| 31 kInvalidRequest = -32600, |
| 32 kMethodNotFound = -32601, |
| 33 kInvalidParams = -32602, |
| 34 kInternalError = -32603, |
| 35 |
| 36 kVMMustBePaused = 100, |
| 37 kNoBreakAtLine = 101, |
| 38 kNoBreakAtFunction = 102, |
| 39 |
| 40 kProfilingDisabled = 200, |
| 41 }; |
| 42 |
| 43 |
28 class JSONStream : ValueObject { | 44 class JSONStream : ValueObject { |
29 public: | 45 public: |
30 explicit JSONStream(intptr_t buf_size = 256); | 46 explicit JSONStream(intptr_t buf_size = 256); |
31 ~JSONStream(); | 47 ~JSONStream(); |
32 | 48 |
33 void Setup(Zone* zone, | 49 void Setup(Zone* zone, |
34 Dart_Port reply_port, | 50 Dart_Port reply_port, |
35 const String& seq, | 51 const String& seq, |
36 const String& method, | 52 const String& method, |
37 const Array& param_keys, | 53 const Array& param_keys, |
38 const Array& param_values); | 54 const Array& param_values); |
39 void SetupError(); | 55 void SetupError(); |
40 | 56 |
| 57 void PrintError(intptr_t code, const char* details_format, ...); |
| 58 |
41 void PostReply(); | 59 void PostReply(); |
42 | 60 |
43 TextBuffer* buffer() { return &buffer_; } | 61 TextBuffer* buffer() { return &buffer_; } |
44 const char* ToCString() { return buffer_.buf(); } | 62 const char* ToCString() { return buffer_.buf(); } |
45 | 63 |
46 void set_reply_port(Dart_Port port); | 64 void set_reply_port(Dart_Port port); |
47 | 65 |
48 void SetParams(const char** param_keys, const char** param_values, | 66 void SetParams(const char** param_keys, const char** param_values, |
49 intptr_t num_params); | 67 intptr_t num_params); |
50 | 68 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 268 |
251 friend class JSONObject; | 269 friend class JSONObject; |
252 | 270 |
253 DISALLOW_ALLOCATION(); | 271 DISALLOW_ALLOCATION(); |
254 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 272 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
255 }; | 273 }; |
256 | 274 |
257 } // namespace dart | 275 } // namespace dart |
258 | 276 |
259 #endif // VM_JSON_STREAM_H_ | 277 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |