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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 string_iterator ^= param_values.At(i); | 115 string_iterator ^= param_values.At(i); |
116 param_values_native[i] = | 116 param_values_native[i] = |
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 int64_t main_port = static_cast<int64_t>(isolate->main_port()); |
125 const char* isolate_name = isolate->name(); | 126 const char* isolate_name = isolate->name(); |
126 setup_time_micros_ = OS::GetCurrentTimeMicros(); | 127 setup_time_micros_ = OS::GetCurrentTimeMicros(); |
127 OS::PrintErr("[+%" Pd64 "ms] Isolate %s processing service request %s\n", | 128 OS::PrintErr("[+%" Pd64 "ms] Isolate (%" Pd64 |
128 Dart::UptimeMillis(), isolate_name, method_); | 129 ") %s processing service " |
| 130 "request %s\n", |
| 131 Dart::UptimeMillis(), main_port, isolate_name, method_); |
129 } | 132 } |
130 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); | 133 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); |
131 } | 134 } |
132 | 135 |
133 void JSONStream::SetupError() { | 136 void JSONStream::SetupError() { |
134 buffer_.Clear(); | 137 buffer_.Clear(); |
135 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); | 138 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); |
136 } | 139 } |
137 | 140 |
138 static const char* GetJSONRpcErrorMessage(intptr_t code) { | 141 static const char* GetJSONRpcErrorMessage(intptr_t code) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 result = Dart_PostCObject(port, &message); | 275 result = Dart_PostCObject(port, &message); |
273 } | 276 } |
274 | 277 |
275 if (!result) { | 278 if (!result) { |
276 free(cstr); | 279 free(cstr); |
277 } | 280 } |
278 | 281 |
279 if (FLAG_trace_service) { | 282 if (FLAG_trace_service) { |
280 Isolate* isolate = Isolate::Current(); | 283 Isolate* isolate = Isolate::Current(); |
281 ASSERT(isolate != NULL); | 284 ASSERT(isolate != NULL); |
| 285 int64_t main_port = static_cast<int64_t>(isolate->main_port()); |
282 const char* isolate_name = isolate->name(); | 286 const char* isolate_name = isolate->name(); |
283 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_; | 287 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_; |
284 if (result) { | 288 if (result) { |
285 OS::PrintErr("[+%" Pd64 | 289 OS::PrintErr("[+%" Pd64 "ms] Isolate (%" Pd64 |
286 "ms] Isolate %s processed service request %s " | 290 ") %s processed service request %s (%" Pd64 "us)\n", |
287 "(%" Pd64 "us)\n", | 291 Dart::UptimeMillis(), main_port, isolate_name, method_, |
288 Dart::UptimeMillis(), isolate_name, method_, total_time); | 292 total_time); |
289 } else { | 293 } else { |
290 OS::PrintErr("[+%" Pd64 | 294 OS::PrintErr("[+%" Pd64 "ms] Isolate (%" Pd64 |
291 "ms] Isolate %s processed service request %s " | 295 ") %s processed service request %s (%" Pd64 "us) FAILED\n", |
292 "(%" Pd64 "us) FAILED\n", | 296 Dart::UptimeMillis(), main_port, isolate_name, method_, |
293 Dart::UptimeMillis(), isolate_name, method_, total_time); | 297 total_time); |
294 } | 298 } |
295 } | 299 } |
296 } | 300 } |
297 | 301 |
298 const char* JSONStream::LookupParam(const char* key) const { | 302 const char* JSONStream::LookupParam(const char* key) const { |
299 for (int i = 0; i < num_params(); i++) { | 303 for (int i = 0; i < num_params(); i++) { |
300 if (!strcmp(key, param_keys_[i])) { | 304 if (!strcmp(key, param_keys_[i])) { |
301 return param_values_[i]; | 305 return param_values_[i]; |
302 } | 306 } |
303 } | 307 } |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 va_end(args); | 954 va_end(args); |
951 ASSERT(len == len2); | 955 ASSERT(len == len2); |
952 stream_->buffer_.AddChar('"'); | 956 stream_->buffer_.AddChar('"'); |
953 stream_->AddEscapedUTF8String(p, len); | 957 stream_->AddEscapedUTF8String(p, len); |
954 stream_->buffer_.AddChar('"'); | 958 stream_->buffer_.AddChar('"'); |
955 } | 959 } |
956 | 960 |
957 #endif // !PRODUCT | 961 #endif // !PRODUCT |
958 | 962 |
959 } // namespace dart | 963 } // namespace dart |
OLD | NEW |