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 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/json_stream.h" | 10 #include "vm/json_stream.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 zone->MakeCopyOfString(string_iterator.ToCString()); | 117 zone->MakeCopyOfString(string_iterator.ToCString()); |
118 } | 118 } |
119 SetParams(param_keys_native, param_values_native, param_keys.Length()); | 119 SetParams(param_keys_native, param_values_native, param_keys.Length()); |
120 } | 120 } |
121 | 121 |
122 if (FLAG_trace_service) { | 122 if (FLAG_trace_service) { |
123 Isolate* isolate = Isolate::Current(); | 123 Isolate* isolate = Isolate::Current(); |
124 ASSERT(isolate != NULL); | 124 ASSERT(isolate != NULL); |
125 const char* isolate_name = isolate->name(); | 125 const char* isolate_name = isolate->name(); |
126 setup_time_micros_ = OS::GetCurrentTimeMicros(); | 126 setup_time_micros_ = OS::GetCurrentTimeMicros(); |
127 OS::Print("[+%" Pd64 "ms] Isolate %s processing service request %s\n", | 127 OS::PrintErr("[+%" Pd64 "ms] Isolate %s processing service request %s\n", |
128 Dart::UptimeMillis(), isolate_name, method_); | 128 Dart::UptimeMillis(), isolate_name, method_); |
129 } | 129 } |
130 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); | 130 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); |
131 } | 131 } |
132 | 132 |
133 void JSONStream::SetupError() { | 133 void JSONStream::SetupError() { |
134 buffer_.Clear(); | 134 buffer_.Clear(); |
135 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); | 135 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); |
136 } | 136 } |
137 | 137 |
138 static const char* GetJSONRpcErrorMessage(intptr_t code) { | 138 static const char* GetJSONRpcErrorMessage(intptr_t code) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 if (!result) { | 275 if (!result) { |
276 free(cstr); | 276 free(cstr); |
277 } | 277 } |
278 | 278 |
279 if (FLAG_trace_service) { | 279 if (FLAG_trace_service) { |
280 Isolate* isolate = Isolate::Current(); | 280 Isolate* isolate = Isolate::Current(); |
281 ASSERT(isolate != NULL); | 281 ASSERT(isolate != NULL); |
282 const char* isolate_name = isolate->name(); | 282 const char* isolate_name = isolate->name(); |
283 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_; | 283 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_; |
284 if (result) { | 284 if (result) { |
285 OS::Print("[+%" Pd64 | 285 OS::PrintErr("[+%" Pd64 |
286 "ms] Isolate %s processed service request %s " | 286 "ms] Isolate %s processed service request %s " |
287 "(%" Pd64 "us)\n", | 287 "(%" Pd64 "us)\n", |
288 Dart::UptimeMillis(), isolate_name, method_, total_time); | 288 Dart::UptimeMillis(), isolate_name, method_, total_time); |
289 } else { | 289 } else { |
290 OS::Print("[+%" Pd64 | 290 OS::PrintErr("[+%" Pd64 |
291 "ms] Isolate %s processed service request %s " | 291 "ms] Isolate %s processed service request %s " |
292 "(%" Pd64 "us) FAILED\n", | 292 "(%" Pd64 "us) FAILED\n", |
293 Dart::UptimeMillis(), isolate_name, method_, total_time); | 293 Dart::UptimeMillis(), isolate_name, method_, total_time); |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 const char* JSONStream::LookupParam(const char* key) const { | 298 const char* JSONStream::LookupParam(const char* key) const { |
299 for (int i = 0; i < num_params(); i++) { | 299 for (int i = 0; i < num_params(); i++) { |
300 if (!strcmp(key, param_keys_[i])) { | 300 if (!strcmp(key, param_keys_[i])) { |
301 return param_values_[i]; | 301 return param_values_[i]; |
302 } | 302 } |
303 } | 303 } |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 va_end(args); | 950 va_end(args); |
951 ASSERT(len == len2); | 951 ASSERT(len == len2); |
952 stream_->buffer_.AddChar('"'); | 952 stream_->buffer_.AddChar('"'); |
953 stream_->AddEscapedUTF8String(p, len); | 953 stream_->AddEscapedUTF8String(p, len); |
954 stream_->buffer_.AddChar('"'); | 954 stream_->buffer_.AddChar('"'); |
955 } | 955 } |
956 | 956 |
957 #endif // !PRODUCT | 957 #endif // !PRODUCT |
958 | 958 |
959 } // namespace dart | 959 } // namespace dart |
OLD | NEW |