| 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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 | 52 |
| 53 class JSONStream : ValueObject { | 53 class JSONStream : ValueObject { |
| 54 public: | 54 public: |
| 55 explicit JSONStream(intptr_t buf_size = 256); | 55 explicit JSONStream(intptr_t buf_size = 256); |
| 56 ~JSONStream(); | 56 ~JSONStream(); |
| 57 | 57 |
| 58 void Setup(Zone* zone, | 58 void Setup(Zone* zone, |
| 59 Dart_Port reply_port, | 59 Dart_Port reply_port, |
| 60 const String& seq, | 60 const Instance& seq, |
| 61 const String& method, | 61 const String& method, |
| 62 const Array& param_keys, | 62 const Array& param_keys, |
| 63 const Array& param_values); | 63 const Array& param_values); |
| 64 void SetupError(); | 64 void SetupError(); |
| 65 | 65 |
| 66 void PrintError(intptr_t code, const char* details_format, ...); | 66 void PrintError(intptr_t code, const char* details_format, ...); |
| 67 | 67 |
| 68 void PostReply(); | 68 void PostReply(); |
| 69 | 69 |
| 70 void set_id_zone(ServiceIdZone* id_zone) { | 70 void set_id_zone(ServiceIdZone* id_zone) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 const char* LookupParam(const char* key) const; | 95 const char* LookupParam(const char* key) const; |
| 96 | 96 |
| 97 bool HasParam(const char* key) const; | 97 bool HasParam(const char* key) const; |
| 98 | 98 |
| 99 // Returns true if there is an param with key and value, false | 99 // Returns true if there is an param with key and value, false |
| 100 // otherwise. | 100 // otherwise. |
| 101 bool ParamIs(const char* key, const char* value) const; | 101 bool ParamIs(const char* key, const char* value) const; |
| 102 | 102 |
| 103 const char* seq() const { return seq_; } | |
| 104 const char* method() const { return method_; } | 103 const char* method() const { return method_; } |
| 105 const char** param_keys() const { return param_keys_; } | 104 const char** param_keys() const { return param_keys_; } |
| 106 const char** param_values() const { return param_values_; } | 105 const char** param_values() const { return param_values_; } |
| 107 | 106 |
| 108 private: | 107 private: |
| 109 void Clear(); | 108 void Clear(); |
| 110 | 109 |
| 111 void OpenObject(const char* property_name = NULL); | 110 void OpenObject(const char* property_name = NULL); |
| 112 void CloseObject(); | 111 void CloseObject(); |
| 113 | 112 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 void AddEscapedUTF8String(const char* s, intptr_t len); | 163 void AddEscapedUTF8String(const char* s, intptr_t len); |
| 165 | 164 |
| 166 intptr_t nesting_level() const { return open_objects_; } | 165 intptr_t nesting_level() const { return open_objects_; } |
| 167 | 166 |
| 168 intptr_t open_objects_; | 167 intptr_t open_objects_; |
| 169 TextBuffer buffer_; | 168 TextBuffer buffer_; |
| 170 // Default service id zone. | 169 // Default service id zone. |
| 171 RingServiceIdZone default_id_zone_; | 170 RingServiceIdZone default_id_zone_; |
| 172 ServiceIdZone* id_zone_; | 171 ServiceIdZone* id_zone_; |
| 173 Dart_Port reply_port_; | 172 Dart_Port reply_port_; |
| 174 const char* seq_; | 173 Instance& seq_; |
| 175 const char* method_; | 174 const char* method_; |
| 176 const char** param_keys_; | 175 const char** param_keys_; |
| 177 const char** param_values_; | 176 const char** param_values_; |
| 178 intptr_t num_params_; | 177 intptr_t num_params_; |
| 179 int64_t setup_time_micros_; | 178 int64_t setup_time_micros_; |
| 180 | 179 |
| 181 friend class JSONObject; | 180 friend class JSONObject; |
| 182 friend class JSONArray; | 181 friend class JSONArray; |
| 183 }; | 182 }; |
| 184 | 183 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 322 |
| 324 friend class JSONObject; | 323 friend class JSONObject; |
| 325 | 324 |
| 326 DISALLOW_ALLOCATION(); | 325 DISALLOW_ALLOCATION(); |
| 327 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 326 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 328 }; | 327 }; |
| 329 | 328 |
| 330 } // namespace dart | 329 } // namespace dart |
| 331 | 330 |
| 332 #endif // VM_JSON_STREAM_H_ | 331 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |