| 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 } | |
| 319 }; | 299 }; |
| 320 | 300 |
| 321 | 301 |
| 322 struct ServiceNativeEntry { | 302 struct ServiceNativeEntry { |
| 323 const char* name; | 303 const char* name; |
| 324 int num_arguments; | 304 int num_arguments; |
| 325 Dart_NativeFunction function; | 305 Dart_NativeFunction function; |
| 326 }; | 306 }; |
| 327 | 307 |
| 328 | 308 |
| 329 static ServiceNativeEntry _ServiceNativeEntries[] = { | 309 static ServiceNativeEntry _ServiceNativeEntries[] = { |
| 330 {"VMService_SendIsolateServiceMessage", 2, | 310 {"VMService_SendIsolateServiceMessage", 2, |
| 331 ServiceIsolateNatives::SendIsolateServiceMessage}, | 311 ServiceIsolateNatives::SendIsolateServiceMessage}, |
| 332 {"VMService_SendRootServiceMessage", 1, | 312 {"VMService_SendRootServiceMessage", 1, |
| 333 ServiceIsolateNatives::SendRootServiceMessage}, | 313 ServiceIsolateNatives::SendRootServiceMessage}, |
| 334 {"VMService_OnStart", 0, | 314 {"VMService_OnStart", 0, |
| 335 ServiceIsolateNatives::OnStart }, | 315 ServiceIsolateNatives::OnStart }, |
| 336 {"VMService_OnExit", 0, | 316 {"VMService_OnExit", 0, |
| 337 ServiceIsolateNatives::OnExit }, | 317 ServiceIsolateNatives::OnExit }, |
| 338 {"VMService_ListenStream", 1, | |
| 339 ServiceIsolateNatives::ListenStream }, | |
| 340 {"VMService_CancelStream", 1, | |
| 341 ServiceIsolateNatives::CancelStream }, | |
| 342 }; | 318 }; |
| 343 | 319 |
| 344 | 320 |
| 345 static Dart_NativeFunction ServiceNativeResolver(Dart_Handle name, | 321 static Dart_NativeFunction ServiceNativeResolver(Dart_Handle name, |
| 346 int num_arguments, | 322 int num_arguments, |
| 347 bool* auto_setup_scope) { | 323 bool* auto_setup_scope) { |
| 348 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 324 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
| 349 if (!obj.IsString()) { | 325 if (!obj.IsString()) { |
| 350 return NULL; | 326 return NULL; |
| 351 } | 327 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 return result; | 775 return result; |
| 800 } | 776 } |
| 801 Dart_Handle source = GetSource(url_string); | 777 Dart_Handle source = GetSource(url_string); |
| 802 if (Dart_IsError(source)) { | 778 if (Dart_IsError(source)) { |
| 803 return source; | 779 return source; |
| 804 } | 780 } |
| 805 return Dart_LoadSource(library, url, source, 0, 0); | 781 return Dart_LoadSource(library, url, source, 0, 0); |
| 806 } | 782 } |
| 807 | 783 |
| 808 } // namespace dart | 784 } // namespace dart |
| OLD | NEW |