Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: runtime/vm/json_stream.h

Issue 1255003003: Make VM service id handling JSON-RPC 2 compliant. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review changes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_; } 103 Instance& seq() const { return seq_; }
Cutch 2015/07/27 21:10:10 RawInstance* seq() const { return seq_.raw(); }
nweiz 2015/07/27 21:17:35 This causes an "invalid use of incomplete type ‘cl
104 const char* method() const { return method_; } 104 const char* method() const { return method_; }
105 const char** param_keys() const { return param_keys_; } 105 const char** param_keys() const { return param_keys_; }
106 const char** param_values() const { return param_values_; } 106 const char** param_values() const { return param_values_; }
107 107
108 private: 108 private:
109 void Clear(); 109 void Clear();
110 110
111 void OpenObject(const char* property_name = NULL); 111 void OpenObject(const char* property_name = NULL);
112 void CloseObject(); 112 void CloseObject();
113 113
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void AddEscapedUTF8String(const char* s, intptr_t len); 164 void AddEscapedUTF8String(const char* s, intptr_t len);
165 165
166 intptr_t nesting_level() const { return open_objects_; } 166 intptr_t nesting_level() const { return open_objects_; }
167 167
168 intptr_t open_objects_; 168 intptr_t open_objects_;
169 TextBuffer buffer_; 169 TextBuffer buffer_;
170 // Default service id zone. 170 // Default service id zone.
171 RingServiceIdZone default_id_zone_; 171 RingServiceIdZone default_id_zone_;
172 ServiceIdZone* id_zone_; 172 ServiceIdZone* id_zone_;
173 Dart_Port reply_port_; 173 Dart_Port reply_port_;
174 const char* seq_; 174 Instance& seq_;
175 const char* method_; 175 const char* method_;
176 const char** param_keys_; 176 const char** param_keys_;
177 const char** param_values_; 177 const char** param_values_;
178 intptr_t num_params_; 178 intptr_t num_params_;
179 int64_t setup_time_micros_; 179 int64_t setup_time_micros_;
180 180
181 friend class JSONObject; 181 friend class JSONObject;
182 friend class JSONArray; 182 friend class JSONArray;
183 }; 183 };
184 184
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 friend class JSONObject; 324 friend class JSONObject;
325 325
326 DISALLOW_ALLOCATION(); 326 DISALLOW_ALLOCATION();
327 DISALLOW_COPY_AND_ASSIGN(JSONArray); 327 DISALLOW_COPY_AND_ASSIGN(JSONArray);
328 }; 328 };
329 329
330 } // namespace dart 330 } // namespace dart
331 331
332 #endif // VM_JSON_STREAM_H_ 332 #endif // VM_JSON_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698