Index: runtime/vm/service_isolate.cc |
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc |
index d823fe046b92c532dee76a6e01268be5eacb1806..76f5b993fea1dab0fd7ca842e9ed7b9f27a8c92f 100644 |
--- a/runtime/vm/service_isolate.cc |
+++ b/runtime/vm/service_isolate.cc |
@@ -149,6 +149,7 @@ const char* ServiceIsolate::kName = "vm-service"; |
Isolate* ServiceIsolate::isolate_ = NULL; |
Dart_Port ServiceIsolate::port_ = ILLEGAL_PORT; |
Dart_Port ServiceIsolate::load_port_ = ILLEGAL_PORT; |
+Dart_Port ServiceIsolate::origin_ = ILLEGAL_PORT; |
Dart_IsolateCreateCallback ServiceIsolate::create_callback_ = NULL; |
uint8_t* ServiceIsolate::exit_message_ = NULL; |
intptr_t ServiceIsolate::exit_message_length_ = 0; |
@@ -180,9 +181,9 @@ class RegisterRunningIsolatesVisitor : public IsolateVisitor { |
virtual void VisitIsolate(Isolate* isolate) { |
ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current())); |
- if (ServiceIsolate::IsServiceIsolate(isolate) || |
+ if (ServiceIsolate::IsServiceIsolateDescendant(isolate) || |
(isolate == Dart::vm_isolate())) { |
- // We do not register the service or vm isolate. |
+ // We do not register the service (and descendants) or the vm-isolate. |
return; |
} |
// Setup arguments for call. |
@@ -377,6 +378,12 @@ bool ServiceIsolate::IsServiceIsolate(Isolate* isolate) { |
} |
+bool ServiceIsolate::IsServiceIsolateDescendant(Isolate* isolate) { |
+ MonitorLocker ml(monitor_); |
+ return isolate->origin_id() == origin_; |
+} |
+ |
+ |
Dart_Port ServiceIsolate::Port() { |
MonitorLocker ml(monitor_); |
return port_; |
@@ -405,7 +412,7 @@ bool ServiceIsolate::SendIsolateStartupMessage() { |
return false; |
} |
Isolate* isolate = Isolate::Current(); |
- if (IsServiceIsolate(isolate)) { |
+ if (IsServiceIsolateDescendant(isolate)) { |
return false; |
} |
ASSERT(isolate != NULL); |
@@ -436,7 +443,7 @@ bool ServiceIsolate::SendIsolateShutdownMessage() { |
return false; |
} |
Isolate* isolate = Isolate::Current(); |
- if (IsServiceIsolate(isolate)) { |
+ if (IsServiceIsolateDescendant(isolate)) { |
return false; |
} |
ASSERT(isolate != NULL); |
@@ -490,6 +497,9 @@ void ServiceIsolate::SetServiceIsolate(Isolate* isolate) { |
isolate_ = isolate; |
if (isolate_ != NULL) { |
isolate_->is_service_isolate_ = true; |
+ origin_ = isolate_->origin_id(); |
+ } else { |
+ origin_ = ILLEGAL_PORT; |
} |
} |