| 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 Field; | 14 class Field; |
| 15 class GrowableObjectArray; |
| 15 class Instance; | 16 class Instance; |
| 16 class JSONArray; | 17 class JSONArray; |
| 17 class JSONObject; | 18 class JSONObject; |
| 18 class Object; | 19 class Object; |
| 19 class SourceBreakpoint; | 20 class SourceBreakpoint; |
| 21 class Zone; |
| 20 | 22 |
| 21 class JSONStream : ValueObject { | 23 class JSONStream : ValueObject { |
| 22 public: | 24 public: |
| 23 explicit JSONStream(intptr_t buf_size = 256); | 25 explicit JSONStream(intptr_t buf_size = 256); |
| 24 ~JSONStream(); | 26 ~JSONStream(); |
| 25 | 27 |
| 28 void Setup(Zone* zone, |
| 29 const Instance& reply_port, |
| 30 const GrowableObjectArray& path, |
| 31 const GrowableObjectArray& option_keys, |
| 32 const GrowableObjectArray& option_values); |
| 33 void PostReply(); |
| 34 |
| 26 TextBuffer* buffer() { return &buffer_; } | 35 TextBuffer* buffer() { return &buffer_; } |
| 27 const char* ToCString() { return buffer_.buf(); } | 36 const char* ToCString() { return buffer_.buf(); } |
| 28 | 37 |
| 29 void set_reply_port(Dart_Port port); | 38 void set_reply_port(Dart_Port port); |
| 30 void SetArguments(const char** arguments, intptr_t num_arguments); | 39 void SetArguments(const char** arguments, intptr_t num_arguments); |
| 31 void SetOptions(const char** option_keys, const char** option_values, | 40 void SetOptions(const char** option_keys, const char** option_values, |
| 32 intptr_t num_options); | 41 intptr_t num_options); |
| 33 | 42 |
| 34 Dart_Port reply_port() const { return reply_port_; } | 43 Dart_Port reply_port() const { return reply_port_; } |
| 35 | 44 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 83 |
| 75 void PrintPropertyName(const char* name); | 84 void PrintPropertyName(const char* name); |
| 76 void PrintCommaIfNeeded(); | 85 void PrintCommaIfNeeded(); |
| 77 bool NeedComma(); | 86 bool NeedComma(); |
| 78 | 87 |
| 79 intptr_t nesting_level() const { return open_objects_; } | 88 intptr_t nesting_level() const { return open_objects_; } |
| 80 | 89 |
| 81 intptr_t open_objects_; | 90 intptr_t open_objects_; |
| 82 TextBuffer buffer_; | 91 TextBuffer buffer_; |
| 83 Dart_Port reply_port_; | 92 Dart_Port reply_port_; |
| 93 const char* command_; |
| 84 const char** arguments_; | 94 const char** arguments_; |
| 85 intptr_t num_arguments_; | 95 intptr_t num_arguments_; |
| 86 const char** option_keys_; | 96 const char** option_keys_; |
| 87 const char** option_values_; | 97 const char** option_values_; |
| 88 intptr_t num_options_; | 98 intptr_t num_options_; |
| 99 int64_t setup_time_micros_; |
| 89 | 100 |
| 90 friend class JSONObject; | 101 friend class JSONObject; |
| 91 friend class JSONArray; | 102 friend class JSONArray; |
| 92 }; | 103 }; |
| 93 | 104 |
| 94 | 105 |
| 95 class JSONObject : public ValueObject { | 106 class JSONObject : public ValueObject { |
| 96 public: | 107 public: |
| 97 explicit JSONObject(JSONStream* stream) : stream_(stream) { | 108 explicit JSONObject(JSONStream* stream) : stream_(stream) { |
| 98 stream_->OpenObject(); | 109 stream_->OpenObject(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 177 |
| 167 friend class JSONObject; | 178 friend class JSONObject; |
| 168 | 179 |
| 169 DISALLOW_ALLOCATION(); | 180 DISALLOW_ALLOCATION(); |
| 170 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 181 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 171 }; | 182 }; |
| 172 | 183 |
| 173 } // namespace dart | 184 } // namespace dart |
| 174 | 185 |
| 175 #endif // VM_JSON_STREAM_H_ | 186 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |