Skip to content

Commit

Permalink
[ Service ] Remove dead code
Browse files Browse the repository at this point in the history
TEST=CQ

CoreLibraryReviewExempt: VM service only change
Change-Id: I7518c8eefb98c80f1748897834d99457a6083929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383001
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
  • Loading branch information
bkonyi authored and Commit Queue committed Aug 30, 2024
1 parent b8018a8 commit 0d71b28
Showing 1 changed file with 1 addition and 40 deletions.
41 changes: 1 addition & 40 deletions sdk/lib/vmservice/vmservice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
library dart._vmservice;

import 'dart:async';
import 'dart:collection';
import 'dart:convert';
import 'dart:isolate';
import 'dart:math';
Expand All @@ -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;
Expand All @@ -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 = <int, 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;
Expand Down Expand Up @@ -139,12 +128,6 @@ String encodeSuccess(Message message) =>

const shortDelay = Duration(milliseconds: 10);

/// Called when the server should be started.
typedef Future<void> ServerStartCallback();

/// Called when the server should be stopped.
typedef Future<void> ServerStopCallback();

/// Called when DDS has connected.
typedef Future<void> DdsConnectedCallback();

Expand Down Expand Up @@ -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;
Expand All @@ -209,11 +190,6 @@ class VMServiceEmbedderHooks {
static ServeObservatoryCallback? serveObservatory;
}

class _ClientResumePermissions {
final List<Client> clients = [];
int permissionsMask = 0;
}

class VMService extends MessageRouter {
static VMService? _instance;

Expand All @@ -223,10 +199,6 @@ class VMService extends MessageRouter {
final clients = NamedLookup<Client>(prologue: serviceNamespace);
final _serviceRequests = IdGenerator(prologue: 'sr');

/// Mapping of client names to all clients of that name and their resume
/// permissions.
final Map<String, _ClientResumePermissions> clientResumePermissions = {};

/// Collection of currently running isolates.
final runningIsolates = RunningIsolates();

Expand Down Expand Up @@ -393,7 +365,6 @@ class VMService extends MessageRouter {
break;
case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID:
runningIsolates.isolateShutdown(portId, sp);
isolateEmbedderData.remove(portId)?.cleanup();
break;
}
}
Expand Down Expand Up @@ -467,19 +438,9 @@ class VMService extends MessageRouter {
Future<void> _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();
Expand Down

0 comments on commit 0d71b28

Please sign in to comment.