| Index: runtime/lib/vmservice.cc
|
| diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc
|
| index 831b9b8dae14210bec8d63aa97671237fb9a2776..9d2d82442e8a1a06388070cece149d85c9eb73ae 100644
|
| --- a/runtime/lib/vmservice.cc
|
| +++ b/runtime/lib/vmservice.cc
|
| @@ -13,6 +13,7 @@
|
| #include "vm/native_entry.h"
|
| #include "vm/object.h"
|
| #include "vm/port.h"
|
| +#include "vm/service_event.h"
|
| #include "vm/service_isolate.h"
|
| #include "vm/symbols.h"
|
|
|
| @@ -450,4 +451,39 @@ DEFINE_NATIVE_ENTRY(VMService_DecodeAssets, 1) {
|
| #endif
|
| }
|
|
|
| +
|
| +
|
| +DEFINE_NATIVE_ENTRY(VMService_spawnUriNotify, 2) {
|
| + GET_NON_NULL_NATIVE_ARGUMENT(Instance, result, arguments->NativeArgAt(0));
|
| + GET_NON_NULL_NATIVE_ARGUMENT(String, token, arguments->NativeArgAt(1));
|
| +
|
| + if (result.IsSendPort()) {
|
| + Dart_Port id = SendPort::Cast(result).Id();
|
| + Isolate* isolate = PortMap::GetIsolate(id);
|
| + if (isolate != NULL) {
|
| + ServiceEvent spawn_event(isolate, ServiceEvent::kIsolateSpawn);
|
| + spawn_event.set_spawn_token(&token);
|
| + Service::HandleEvent(&spawn_event);
|
| + } else {
|
| + // There is no isolate at the control port anymore. Must have
|
| + // died already.
|
| + ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn);
|
| + const String& error = String::Handle(String::New(
|
| + "spawned isolate exited before notification completed"));
|
| + spawn_event.set_spawn_token(&token);
|
| + spawn_event.set_spawn_error(&error);
|
| + Service::HandleEvent(&spawn_event);
|
| + }
|
| + } else {
|
| + // The isolate failed to spawn.
|
| + ASSERT(result.IsString());
|
| + ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn);
|
| + spawn_event.set_spawn_token(&token);
|
| + spawn_event.set_spawn_error(&String::Cast(result));
|
| + Service::HandleEvent(&spawn_event);
|
| + }
|
| +
|
| + return Object::null();
|
| +}
|
| +
|
| } // namespace dart
|
|
|