OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/service_isolate.h" | 5 #include "vm/service_isolate.h" |
6 | 6 |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 289 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
290 Isolate* isolate = arguments->isolate(); | 290 Isolate* isolate = arguments->isolate(); |
291 StackZone zone(isolate); | 291 StackZone zone(isolate); |
292 HANDLESCOPE(isolate); | 292 HANDLESCOPE(isolate); |
293 { | 293 { |
294 if (FLAG_trace_service) { | 294 if (FLAG_trace_service) { |
295 OS::Print("vm-service: processed exit message.\n"); | 295 OS::Print("vm-service: processed exit message.\n"); |
296 } | 296 } |
297 } | 297 } |
298 } | 298 } |
| 299 |
| 300 static void ListenStream(Dart_NativeArguments args) { |
| 301 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 302 Isolate* isolate = arguments->isolate(); |
| 303 StackZone stack_zone(isolate); |
| 304 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. |
| 305 HANDLESCOPE(isolate); |
| 306 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); |
| 307 Service::ListenStream(stream_id.ToCString()); |
| 308 } |
| 309 |
| 310 static void CancelStream(Dart_NativeArguments args) { |
| 311 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 312 Isolate* isolate = arguments->isolate(); |
| 313 StackZone stack_zone(isolate); |
| 314 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. |
| 315 HANDLESCOPE(isolate); |
| 316 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); |
| 317 Service::CancelStream(stream_id.ToCString()); |
| 318 } |
299 }; | 319 }; |
300 | 320 |
301 | 321 |
302 struct ServiceNativeEntry { | 322 struct ServiceNativeEntry { |
303 const char* name; | 323 const char* name; |
304 int num_arguments; | 324 int num_arguments; |
305 Dart_NativeFunction function; | 325 Dart_NativeFunction function; |
306 }; | 326 }; |
307 | 327 |
308 | 328 |
309 static ServiceNativeEntry _ServiceNativeEntries[] = { | 329 static ServiceNativeEntry _ServiceNativeEntries[] = { |
310 {"VMService_SendIsolateServiceMessage", 2, | 330 {"VMService_SendIsolateServiceMessage", 2, |
311 ServiceIsolateNatives::SendIsolateServiceMessage}, | 331 ServiceIsolateNatives::SendIsolateServiceMessage}, |
312 {"VMService_SendRootServiceMessage", 1, | 332 {"VMService_SendRootServiceMessage", 1, |
313 ServiceIsolateNatives::SendRootServiceMessage}, | 333 ServiceIsolateNatives::SendRootServiceMessage}, |
314 {"VMService_OnStart", 0, | 334 {"VMService_OnStart", 0, |
315 ServiceIsolateNatives::OnStart }, | 335 ServiceIsolateNatives::OnStart }, |
316 {"VMService_OnExit", 0, | 336 {"VMService_OnExit", 0, |
317 ServiceIsolateNatives::OnExit }, | 337 ServiceIsolateNatives::OnExit }, |
| 338 {"VMService_ListenStream", 1, |
| 339 ServiceIsolateNatives::ListenStream }, |
| 340 {"VMService_CancelStream", 1, |
| 341 ServiceIsolateNatives::CancelStream }, |
318 }; | 342 }; |
319 | 343 |
320 | 344 |
321 static Dart_NativeFunction ServiceNativeResolver(Dart_Handle name, | 345 static Dart_NativeFunction ServiceNativeResolver(Dart_Handle name, |
322 int num_arguments, | 346 int num_arguments, |
323 bool* auto_setup_scope) { | 347 bool* auto_setup_scope) { |
324 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 348 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
325 if (!obj.IsString()) { | 349 if (!obj.IsString()) { |
326 return NULL; | 350 return NULL; |
327 } | 351 } |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 return result; | 799 return result; |
776 } | 800 } |
777 Dart_Handle source = GetSource(url_string); | 801 Dart_Handle source = GetSource(url_string); |
778 if (Dart_IsError(source)) { | 802 if (Dart_IsError(source)) { |
779 return source; | 803 return source; |
780 } | 804 } |
781 return Dart_LoadSource(library, url, source, 0, 0); | 805 return Dart_LoadSource(library, url, source, 0, 0); |
782 } | 806 } |
783 | 807 |
784 } // namespace dart | 808 } // namespace dart |
OLD | NEW |