Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1159)

Unified Diff: runtime/lib/vmservice.cc

Issue 2072543002: First cut at _spawnUri rpc in the vm service. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/vmservice_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | runtime/lib/vmservice_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698