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

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

Issue 2059883003: DevFS initial implementation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/text_buffer.h" 9 #include "platform/text_buffer.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 kInternalError = -32603, 46 kInternalError = -32603,
47 47
48 kExtensionError = -32000, 48 kExtensionError = -32000,
49 49
50 kFeatureDisabled = 100, 50 kFeatureDisabled = 100,
51 kCannotAddBreakpoint = 102, 51 kCannotAddBreakpoint = 102,
52 kStreamAlreadySubscribed = 103, 52 kStreamAlreadySubscribed = 103,
53 kStreamNotSubscribed = 104, 53 kStreamNotSubscribed = 104,
54 kIsolateMustBeRunnable = 105, 54 kIsolateMustBeRunnable = 105,
55 kIsolateMustBePaused = 106, 55 kIsolateMustBePaused = 106,
56 kIsolateIsReloading = 107, 56
57 // Experimental (used in private rpcs).
58 kIsolateIsReloading = 1000,
59 kFileSystemAlreadyExists = 1001,
60 kFileSystemDoesNotExist = 1002,
61 kFileDoesNotExist = 1003,
57 }; 62 };
58 63
59 // Expected that user_data is a JSONStream*. 64 // Expected that user_data is a JSONStream*.
60 void AppendJSONStreamConsumer(Dart_StreamConsumer_State state, 65 void AppendJSONStreamConsumer(Dart_StreamConsumer_State state,
61 const char* stream_name, 66 const char* stream_name,
62 const uint8_t* buffer, 67 const uint8_t* buffer,
63 intptr_t buffer_length, 68 intptr_t buffer_length,
64 void* user_data); 69 void* user_data);
65 70
66 class JSONStream : ValueObject { 71 class JSONStream : ValueObject {
67 public: 72 public:
68 explicit JSONStream(intptr_t buf_size = 256); 73 explicit JSONStream(intptr_t buf_size = 256);
69 ~JSONStream(); 74 ~JSONStream();
70 75
71 void Setup(Zone* zone, 76 void Setup(Zone* zone,
72 Dart_Port reply_port, 77 Dart_Port reply_port,
73 const Instance& seq, 78 const Instance& seq,
74 const String& method, 79 const String& method,
75 const Array& param_keys, 80 const Array& param_keys,
76 const Array& param_values); 81 const Array& param_values,
82 bool parameters_are_dart_objects = false);
77 void SetupError(); 83 void SetupError();
78 84
79 void PrintError(intptr_t code, const char* details_format, ...); 85 void PrintError(intptr_t code, const char* details_format, ...);
80 86
81 void PostReply(); 87 void PostReply();
82 88
83 void set_id_zone(ServiceIdZone* id_zone) { 89 void set_id_zone(ServiceIdZone* id_zone) {
84 id_zone_ = id_zone; 90 id_zone_ = id_zone;
85 } 91 }
86 ServiceIdZone* id_zone() { 92 ServiceIdZone* id_zone() {
87 return id_zone_; 93 return id_zone_;
88 } 94 }
89 95
90 TextBuffer* buffer() { return &buffer_; } 96 TextBuffer* buffer() { return &buffer_; }
91 const char* ToCString() { return buffer_.buf(); } 97 const char* ToCString() { return buffer_.buf(); }
92 98
93 void Steal(const char** buffer, intptr_t* buffer_length); 99 void Steal(const char** buffer, intptr_t* buffer_length);
94 100
95 void set_reply_port(Dart_Port port); 101 void set_reply_port(Dart_Port port);
96 102
97 void SetParams(const char** param_keys, const char** param_values, 103 void SetParams(const char** param_keys, const char** param_values,
98 intptr_t num_params); 104 intptr_t num_params);
99 105
100 Dart_Port reply_port() const { return reply_port_; } 106 Dart_Port reply_port() const { return reply_port_; }
101 107
108 intptr_t NumObjectParameters() const;
109 RawObject* GetObjectParameterKey(intptr_t i) const;
110 RawObject* GetObjectParameterValue(intptr_t i) const;
111 RawObject* LookupObjectParam(const char* key) const;
112
102 intptr_t num_params() const { return num_params_; } 113 intptr_t num_params() const { return num_params_; }
103 const char* GetParamKey(intptr_t i) const { 114 const char* GetParamKey(intptr_t i) const {
104 return param_keys_[i]; 115 return param_keys_[i];
105 } 116 }
106 const char* GetParamValue(intptr_t i) const { 117 const char* GetParamValue(intptr_t i) const {
107 return param_values_[i]; 118 return param_values_[i];
108 } 119 }
109 120
110 const char* LookupParam(const char* key) const; 121 const char* LookupParam(const char* key) const;
111 122
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Debug only fatal assertion. 231 // Debug only fatal assertion.
221 static void EnsureIntegerIsRepresentableInJavaScript(int64_t i); 232 static void EnsureIntegerIsRepresentableInJavaScript(int64_t i);
222 233
223 intptr_t open_objects_; 234 intptr_t open_objects_;
224 TextBuffer buffer_; 235 TextBuffer buffer_;
225 // Default service id zone. 236 // Default service id zone.
226 RingServiceIdZone default_id_zone_; 237 RingServiceIdZone default_id_zone_;
227 ServiceIdZone* id_zone_; 238 ServiceIdZone* id_zone_;
228 Dart_Port reply_port_; 239 Dart_Port reply_port_;
229 Instance* seq_; 240 Instance* seq_;
241 Array* parameter_keys_;
242 Array* parameter_values_;
230 const char* method_; 243 const char* method_;
231 const char** param_keys_; 244 const char** param_keys_;
232 const char** param_values_; 245 const char** param_values_;
233 intptr_t num_params_; 246 intptr_t num_params_;
234 intptr_t offset_; 247 intptr_t offset_;
235 intptr_t count_; 248 intptr_t count_;
236 int64_t setup_time_micros_; 249 int64_t setup_time_micros_;
237 250
238 friend class JSONObject; 251 friend class JSONObject;
239 friend class JSONArray; 252 friend class JSONArray;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 426
414 friend class JSONObject; 427 friend class JSONObject;
415 428
416 DISALLOW_ALLOCATION(); 429 DISALLOW_ALLOCATION();
417 DISALLOW_COPY_AND_ASSIGN(JSONArray); 430 DISALLOW_COPY_AND_ASSIGN(JSONArray);
418 }; 431 };
419 432
420 } // namespace dart 433 } // namespace dart
421 434
422 #endif // VM_JSON_STREAM_H_ 435 #endif // VM_JSON_STREAM_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698