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

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

Issue 1400393002: Use offset and count to request slices of lists, maps, and typed_data. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: pre review tidy Created 5 years, 2 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bool HasParam(const char* key) const; 102 bool HasParam(const char* key) const;
103 103
104 // Returns true if there is an param with key and value, false 104 // Returns true if there is an param with key and value, false
105 // otherwise. 105 // otherwise.
106 bool ParamIs(const char* key, const char* value) const; 106 bool ParamIs(const char* key, const char* value) const;
107 107
108 const char* method() const { return method_; } 108 const char* method() const { return method_; }
109 const char** param_keys() const { return param_keys_; } 109 const char** param_keys() const { return param_keys_; }
110 const char** param_values() const { return param_values_; } 110 const char** param_values() const { return param_values_; }
111 111
112 void set_offset(intptr_t value) {
113 ASSERT(value > 0);
114 offset_ = value;
115 }
116
117 void set_count(intptr_t value) {
118 ASSERT(value > 0);
119 count_ = value;
120 }
121
122 void ComputeOffsetAndCount(intptr_t length,
123 intptr_t* offset,
124 intptr_t* count);
125
112 private: 126 private:
113 void Clear(); 127 void Clear();
114 void PostNullReply(Dart_Port port); 128 void PostNullReply(Dart_Port port);
115 129
116 void OpenObject(const char* property_name = NULL); 130 void OpenObject(const char* property_name = NULL);
117 void CloseObject(); 131 void CloseObject();
118 132
119 void OpenArray(const char* property_name = NULL); 133 void OpenArray(const char* property_name = NULL);
120 void CloseArray(); 134 void CloseArray();
121 135
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 TextBuffer buffer_; 195 TextBuffer buffer_;
182 // Default service id zone. 196 // Default service id zone.
183 RingServiceIdZone default_id_zone_; 197 RingServiceIdZone default_id_zone_;
184 ServiceIdZone* id_zone_; 198 ServiceIdZone* id_zone_;
185 Dart_Port reply_port_; 199 Dart_Port reply_port_;
186 Instance* seq_; 200 Instance* seq_;
187 const char* method_; 201 const char* method_;
188 const char** param_keys_; 202 const char** param_keys_;
189 const char** param_values_; 203 const char** param_values_;
190 intptr_t num_params_; 204 intptr_t num_params_;
205 intptr_t offset_;
206 intptr_t count_;
191 int64_t setup_time_micros_; 207 int64_t setup_time_micros_;
192 208
193 friend class JSONObject; 209 friend class JSONObject;
194 friend class JSONArray; 210 friend class JSONArray;
195 }; 211 };
196 212
197 213
198 class JSONObject : public ValueObject { 214 class JSONObject : public ValueObject {
199 public: 215 public:
200 explicit JSONObject(JSONStream* stream) : stream_(stream) { 216 explicit JSONObject(JSONStream* stream) : stream_(stream) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 367
352 friend class JSONObject; 368 friend class JSONObject;
353 369
354 DISALLOW_ALLOCATION(); 370 DISALLOW_ALLOCATION();
355 DISALLOW_COPY_AND_ASSIGN(JSONArray); 371 DISALLOW_COPY_AND_ASSIGN(JSONArray);
356 }; 372 };
357 373
358 } // namespace dart 374 } // namespace dart
359 375
360 #endif // VM_JSON_STREAM_H_ 376 #endif // VM_JSON_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698