Unverified Commit 5c09eecd authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] remove special casing of web listview requests (#82826)

parent d7e49e55
......@@ -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();
......
......@@ -205,11 +205,7 @@ void main() {
'streamId': 'Isolate',
}
),
FakeVmServiceRequest(
method: 'getVM',
jsonResponse: fakeVM.toJson(),
args: <String, Object>{},
),
listViews,
FakeVmServiceRequest(
method: 'getIsolate',
jsonResponse: isolate.toJson(),
......
......@@ -81,11 +81,6 @@ final FakeVmServiceRequest listViews = FakeVmServiceRequest(
},
);
final FakeVmServiceRequest getVM = FakeVmServiceRequest(
method: 'getVM',
jsonResponse: fakeVM.toJson(),
);
void main() {
testWithoutContext('keyboard input handling single help character', () async {
final TestRunner testRunner = TestRunner();
......@@ -173,7 +168,7 @@ void main() {
testWithoutContext('a - debugToggleProfileWidgetBuilds with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.profileWidgetBuilds',
args: <String, Object>{
......@@ -235,7 +230,7 @@ void main() {
testWithoutContext('b - debugToggleBrightness with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.brightnessOverride',
args: <String, Object>{
......@@ -245,7 +240,7 @@ void main() {
'value': 'Brightness.light',
}
),
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.brightnessOverride',
args: <String, Object>{
......@@ -315,7 +310,7 @@ void main() {
testWithoutContext('i - debugToggleWidgetInspector with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.inspector.show',
args: <String, Object>{
......@@ -348,7 +343,7 @@ void main() {
testWithoutContext('I - debugToggleInvertOversizedImages with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.invertOversizedImages',
args: <String, Object>{
......@@ -389,7 +384,7 @@ void main() {
testWithoutContext('L - debugDumpLayerTree with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpLayerTree',
args: <String, Object>{
......@@ -472,7 +467,7 @@ void main() {
testWithoutContext('o,O - debugTogglePlatform with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
// Request 1.
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.platformOverride',
args: <String, Object>{
......@@ -482,7 +477,7 @@ void main() {
'value': 'iOS'
},
),
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.platformOverride',
args: <String, Object>{
......@@ -494,7 +489,7 @@ void main() {
},
),
// Request 2.
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.platformOverride',
args: <String, Object>{
......@@ -504,7 +499,7 @@ void main() {
'value': 'android'
},
),
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.platformOverride',
args: <String, Object>{
......@@ -544,7 +539,7 @@ void main() {
testWithoutContext('p - debugToggleDebugPaintSizeEnabled with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugPaint',
args: <String, Object>{
......@@ -603,7 +598,7 @@ void main() {
testWithoutContext('S - debugDumpSemanticsTreeInTraversalOrder with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpSemanticsTreeInTraversalOrder',
args: <String, Object>{
......@@ -644,7 +639,7 @@ void main() {
testWithoutContext('U - debugDumpSemanticsTreeInInverseHitTestOrder with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder',
args: <String, Object>{
......@@ -698,7 +693,7 @@ void main() {
testWithoutContext('t,T - debugDumpRenderTree with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpRenderTree',
args: <String, Object>{
......@@ -709,7 +704,7 @@ void main() {
},
),
// Request 2.
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpRenderTree',
args: <String, Object>{
......@@ -766,7 +761,7 @@ void main() {
testWithoutContext('w,W - debugDumpApp with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpApp',
args: <String, Object>{
......@@ -777,7 +772,7 @@ void main() {
},
),
// Request 2.
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugDumpApp',
args: <String, Object>{
......@@ -837,7 +832,7 @@ void main() {
testWithoutContext('z,Z - debugToggleDebugCheckElevationsEnabled with web target', () async {
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugCheckElevationsEnabled',
args: <String, Object>{
......@@ -845,7 +840,7 @@ void main() {
},
),
// Request 2.
getVM,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.debugCheckElevationsEnabled',
args: <String, Object>{
......@@ -1024,7 +1019,7 @@ void main() {
final BufferLogger logger = BufferLogger.test();
final FileSystem fileSystem = MemoryFileSystem.test();
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[
getVM,
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
args: <String, Object>{
......@@ -1173,7 +1168,7 @@ void main() {
final FileSystem fileSystem = MemoryFileSystem.test();
final TerminalHandler terminalHandler = setUpTerminalHandler(
<FakeVmServiceRequest>[
getVM,
listViews,
FakeVmServiceRequest(
method: 'ext.flutter.debugAllowBanner',
args: <String, Object>{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment