Index: sdk/lib/vmservice/vmservice.dart |
diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart |
index 445f5d5302d96bc40747da0fe0b881e936dc18d7..f1253524dc8c38c1b6c3e09b9cef969fce810854 100644 |
--- a/sdk/lib/vmservice/vmservice.dart |
+++ b/sdk/lib/vmservice/vmservice.dart |
@@ -21,6 +21,16 @@ part 'message_router.dart'; |
final RawReceivePort isolateLifecyclePort = new RawReceivePort(); |
final RawReceivePort scriptLoadPort = new RawReceivePort(); |
+abstract class IsolateEmbedderData { |
+ void cleanup(); |
+} |
+ |
+// This is for use by the embedder. It is a map from the isolateId to |
+// anything implementing IsolateEmbedderData. When an isolate goes away, |
+// the cleanup method will be invoked after being removed from the map. |
+final Map<int, IsolateEmbedderData> isolateEmbedderData = |
+ new Map<int, IsolateEmbedderData>(); |
+ |
// These must be kept in sync with the declarations in vm/json_stream.h. |
const kInvalidParams = -32602; |
const kInternalError = -32603; |
@@ -124,6 +134,10 @@ class VMService extends MessageRouter { |
break; |
case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID: |
runningIsolates.isolateShutdown(portId, sp); |
+ IsolateEmbedderData ied = isolateEmbedderData.remove(portId); |
+ if (ied != null) { |
+ ied.cleanup(); |
+ } |
break; |
} |
} |