Skip to content

Commit

Permalink
Register a restart handler directly over the VM service connection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored May 24, 2024
1 parent fc32eb6 commit 15028c4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dwds/lib/src/dwds_vm_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef VmResponse = Map<String, Object?>;

enum _NamespacedServiceExtension {
extDwdsEmitEvent(method: 'ext.dwds.emitEvent'),
extDwdsRestart(method: 'ext.dwds.restart'),
extDwdsScreenshot(method: 'ext.dwds.screenshot'),
extDwdsSendEvent(method: 'ext.dwds.sendEvent'),
flutterListViews(method: '_flutter.listViews');
Expand Down Expand Up @@ -193,6 +194,8 @@ class DwdsVmClient {
response = await _flutterListViewsHandler(chromeProxyService);
} else if (method == _NamespacedServiceExtension.extDwdsEmitEvent.method) {
response = _extDwdsEmitEventHandler(request);
} else if (method == _NamespacedServiceExtension.extDwdsRestart.method) {
response = await _extDwdsRestartHandler(chromeProxyService);
} else if (method == _NamespacedServiceExtension.extDwdsSendEvent.method) {
response = await _extDwdsSendEventHandler(request, dwdsStats);
} else if (method == _NamespacedServiceExtension.extDwdsScreenshot.method) {
Expand Down Expand Up @@ -262,6 +265,13 @@ class DwdsVmClient {
return {'result': Success().toJson()};
}

static Future<Map<String, Object>> _extDwdsRestartHandler(
ChromeProxyService chromeProxyService,
) async {
await _fullReload(chromeProxyService);
return {'result': Success().toJson()};
}

static Future<void> _registerServiceExtensions({
required VmService client,
required ChromeProxyService chromeProxyService,
Expand Down

0 comments on commit 15028c4

Please sign in to comment.