From 0d71b28d15679e45c2966820b24311eedb9fd589 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 30 Aug 2024 18:11:44 +0000 Subject: [PATCH] [ Service ] Remove dead code TEST=CQ CoreLibraryReviewExempt: VM service only change Change-Id: I7518c8eefb98c80f1748897834d99457a6083929 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383001 Commit-Queue: Ben Konyi Reviewed-by: Derek Xu Auto-Submit: Ben Konyi --- sdk/lib/vmservice/vmservice.dart | 41 +------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart index 4a531f214361..f120364bc2d5 100644 --- a/sdk/lib/vmservice/vmservice.dart +++ b/sdk/lib/vmservice/vmservice.dart @@ -5,7 +5,6 @@ library dart._vmservice; import 'dart:async'; -import 'dart:collection'; import 'dart:convert'; import 'dart:isolate'; import 'dart:math'; @@ -22,11 +21,6 @@ part 'message_router.dart'; part 'named_lookup.dart'; final isolateControlPort = RawReceivePort(null, 'Isolate Control Port'); -final scriptLoadPort = RawReceivePort(null, 'Script Load'); - -abstract class IsolateEmbedderData { - void cleanup(); -} String _makeAuthToken() { final kTokenByteSize = 8; @@ -41,11 +35,6 @@ String _makeAuthToken() { // The randomly generated auth token used to access the VM service. final serviceAuthToken = _makeAuthToken(); -// 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 isolateEmbedderData = {}; - // These must be kept in sync with the declarations in vm/json_stream.h and // pkg/dds/lib/src/rpc_error_codes.dart. const kParseError = -32700; @@ -139,12 +128,6 @@ String encodeSuccess(Message message) => const shortDelay = Duration(milliseconds: 10); -/// Called when the server should be started. -typedef Future ServerStartCallback(); - -/// Called when the server should be stopped. -typedef Future ServerStopCallback(); - /// Called when DDS has connected. typedef Future DdsConnectedCallback(); @@ -191,8 +174,6 @@ typedef void ServeObservatoryCallback(); /// Hooks that are setup by the embedder. class VMServiceEmbedderHooks { - static ServerStartCallback? serverStart; - static ServerStopCallback? serverStop; static DdsConnectedCallback? ddsConnected; static DdsDisconnectedCallback? ddsDisconnected; static CleanupCallback? cleanup; @@ -209,11 +190,6 @@ class VMServiceEmbedderHooks { static ServeObservatoryCallback? serveObservatory; } -class _ClientResumePermissions { - final List clients = []; - int permissionsMask = 0; -} - class VMService extends MessageRouter { static VMService? _instance; @@ -223,10 +199,6 @@ class VMService extends MessageRouter { final clients = NamedLookup(prologue: serviceNamespace); final _serviceRequests = IdGenerator(prologue: 'sr'); - /// Mapping of client names to all clients of that name and their resume - /// permissions. - final Map clientResumePermissions = {}; - /// Collection of currently running isolates. final runningIsolates = RunningIsolates(); @@ -393,7 +365,6 @@ class VMService extends MessageRouter { break; case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID: runningIsolates.isolateShutdown(portId, sp); - isolateEmbedderData.remove(portId)?.cleanup(); break; } } @@ -467,19 +438,9 @@ class VMService extends MessageRouter { Future _exit() async { isExiting = true; - final serverStop = VMServiceEmbedderHooks.serverStop; - // Stop the server. - if (serverStop != null) { - await serverStop(); - } - // Close receive ports. isolateControlPort.close(); - scriptLoadPort.close(); - final cleanup = VMServiceEmbedderHooks.cleanup; - if (cleanup != null) { - await cleanup(); - } + await VMServiceEmbedderHooks.cleanup!(); await clearState(); // Notify the VM that we have exited. _onExit();