forked from firka/flutter
[flutter_tools] remove special casing of web listview requests (#82826)
This commit is contained in:
@@ -166,7 +166,6 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
|
||||
try {
|
||||
await flutterDevice.vmService?.findExtensionIsolate(
|
||||
extension,
|
||||
webIsolate: flutterDevice.targetPlatform == TargetPlatform.web_javascript,
|
||||
);
|
||||
return flutterDevice;
|
||||
} on VmServiceDisappearedException {
|
||||
|
||||
@@ -405,18 +405,6 @@ class FlutterDevice {
|
||||
return devFS.create();
|
||||
}
|
||||
|
||||
Future<List<vm_service.IsolateRef>> _getCurrentIsolates() async {
|
||||
if (targetPlatform == TargetPlatform.web_javascript) {
|
||||
final vm_service.VM vm = await vmService.service.getVM();
|
||||
return vm.isolates;
|
||||
}
|
||||
final List<FlutterView> views = await vmService.getFlutterViews();
|
||||
return <vm_service.IsolateRef>[
|
||||
for (FlutterView view in views)
|
||||
view.uiIsolate,
|
||||
];
|
||||
}
|
||||
|
||||
Future<void> startEchoingDeviceLog() async {
|
||||
if (_loggingSubscription != null) {
|
||||
return;
|
||||
@@ -699,9 +687,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
final String data = await device.vmService.flutterDebugDumpApp(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
logger.printStatus(data);
|
||||
}
|
||||
@@ -715,9 +704,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
final String data = await device.vmService.flutterDebugDumpRenderTree(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
logger.printStatus(data);
|
||||
}
|
||||
@@ -731,9 +721,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
final String data = await device.vmService.flutterDebugDumpLayerTree(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
logger.printStatus(data);
|
||||
}
|
||||
@@ -749,9 +740,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
final String data = await device.vmService.flutterDebugDumpSemanticsTreeInTraversalOrder(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
logger.printStatus(data);
|
||||
}
|
||||
@@ -767,9 +759,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
final String data = await device.vmService.flutterDebugDumpSemanticsTreeInInverseHitTestOrder(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
logger.printStatus(data);
|
||||
}
|
||||
@@ -783,9 +776,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterToggleDebugPaintSizeEnabled(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -798,9 +792,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterToggleDebugCheckElevationsEnabled(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -818,9 +813,10 @@ abstract class ResidentHandlers {
|
||||
if (device.targetPlatform == TargetPlatform.web_javascript) {
|
||||
continue;
|
||||
}
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterTogglePerformanceOverlayOverride(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -833,9 +829,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterToggleWidgetInspector(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -848,9 +845,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterToggleInvertOversizedImages(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -863,9 +861,10 @@ abstract class ResidentHandlers {
|
||||
return false;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterToggleProfileWidgetBuilds(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -877,9 +876,9 @@ abstract class ResidentHandlers {
|
||||
if (!supportsServiceProtocol) {
|
||||
return false;
|
||||
}
|
||||
final List<vm_service.IsolateRef> views = await flutterDevices.first._getCurrentIsolates();
|
||||
final List<FlutterView> views = await flutterDevices.first.vmService.getFlutterViews();
|
||||
final Brightness current = await flutterDevices.first.vmService.flutterBrightnessOverride(
|
||||
isolateId: views.first.id,
|
||||
isolateId: views.first.uiIsolate.id,
|
||||
);
|
||||
Brightness next;
|
||||
if (current == Brightness.light) {
|
||||
@@ -888,9 +887,10 @@ abstract class ResidentHandlers {
|
||||
next = Brightness.light;
|
||||
}
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterBrightnessOverride(
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
brightness: next,
|
||||
);
|
||||
}
|
||||
@@ -904,17 +904,18 @@ abstract class ResidentHandlers {
|
||||
if (!supportsServiceProtocol || !isRunningDebug) {
|
||||
return false;
|
||||
}
|
||||
final List<vm_service.IsolateRef> views = await flutterDevices.first._getCurrentIsolates();
|
||||
final List<FlutterView> views = await flutterDevices.first.vmService.getFlutterViews();
|
||||
final String from = await flutterDevices
|
||||
.first.vmService.flutterPlatformOverride(
|
||||
isolateId: views.first.id,
|
||||
isolateId: views.first.uiIsolate.id,
|
||||
);
|
||||
final String to = nextPlatform(from);
|
||||
for (final FlutterDevice device in flutterDevices) {
|
||||
for (final vm_service.IsolateRef view in await device._getCurrentIsolates()) {
|
||||
final List<FlutterView> views = await device.vmService.getFlutterViews();
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterPlatformOverride(
|
||||
platform: to,
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1003,17 +1004,17 @@ abstract class ResidentHandlers {
|
||||
}
|
||||
|
||||
Future<bool> _toggleDebugBanner(FlutterDevice device, Future<void> Function() cb) async {
|
||||
List<vm_service.IsolateRef> views = <vm_service.IsolateRef>[];
|
||||
List<FlutterView> views = <FlutterView>[];
|
||||
if (supportsServiceProtocol) {
|
||||
views = await device._getCurrentIsolates();
|
||||
views = await device.vmService.getFlutterViews();
|
||||
}
|
||||
|
||||
Future<bool> setDebugBanner(bool value) async {
|
||||
try {
|
||||
for (final vm_service.IsolateRef view in views) {
|
||||
for (final FlutterView view in views) {
|
||||
await device.vmService.flutterDebugAllowBanner(
|
||||
value,
|
||||
isolateId: view.id,
|
||||
isolateId: view.uiIsolate.id,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -78,7 +78,6 @@ class IntegrationTestTestDevice implements TestDevice {
|
||||
globals.printTrace('test $id: Finding the correct isolate with the integration test service extension');
|
||||
final vm_service.IsolateRef isolateRef = await vmService.findExtensionIsolate(
|
||||
kIntegrationTestMethod,
|
||||
webIsolate: targetPlatform == TargetPlatform.web_javascript,
|
||||
);
|
||||
|
||||
await vmService.service.streamListen(vm_service.EventStreams.kExtension);
|
||||
|
||||
@@ -845,7 +845,7 @@ class FlutterVmService {
|
||||
///
|
||||
/// Throws a [VmServiceDisappearedException] should the VM Service disappear
|
||||
/// while making calls to it.
|
||||
Future<vm_service.IsolateRef> findExtensionIsolate(String extensionName, {bool webIsolate = false}) async {
|
||||
Future<vm_service.IsolateRef> findExtensionIsolate(String extensionName) async {
|
||||
try {
|
||||
await service.streamListen(vm_service.EventStreams.kIsolate);
|
||||
} on vm_service.RPCError {
|
||||
@@ -863,7 +863,7 @@ class FlutterVmService {
|
||||
});
|
||||
|
||||
try {
|
||||
final List<vm_service.IsolateRef> refs = await _getIsolateRefs(webIsolate);
|
||||
final List<vm_service.IsolateRef> refs = await _getIsolateRefs();
|
||||
for (final vm_service.IsolateRef ref in refs) {
|
||||
final vm_service.Isolate isolate = await getIsolateOrNull(ref.id);
|
||||
if (isolate != null && isolate.extensionRPCs.contains(extensionName)) {
|
||||
@@ -881,14 +881,7 @@ class FlutterVmService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<vm_service.IsolateRef>> _getIsolateRefs(bool webIsolate) async {
|
||||
if (webIsolate) {
|
||||
final List<vm_service.IsolateRef> refs = (await service.getVM()).isolates;
|
||||
if (refs.isEmpty) {
|
||||
throw VmServiceDisappearedException();
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
Future<List<vm_service.IsolateRef>> _getIsolateRefs() async {
|
||||
final List<FlutterView> flutterViews = await getFlutterViews();
|
||||
if (flutterViews.isEmpty) {
|
||||
throw VmServiceDisappearedException();
|
||||
|
||||
Reference in New Issue
Block a user