Unverified Commit cadde245 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Add toggle for debugProfileWidgetBuilds (#30867)

parent b4edfb15
......@@ -287,6 +287,12 @@ class FlutterDevice {
await view.uiIsolate.flutterToggleWidgetInspector();
}
Future<void> toggleProfileWidgetBuilds() async {
for (FlutterView view in views) {
await view.uiIsolate.flutterToggleProfileWidgetBuilds();
}
}
Future<String> togglePlatform({ String from }) async {
String to;
switch (from) {
......@@ -643,6 +649,13 @@ abstract class ResidentRunner {
await device.toggleWidgetInspector();
}
Future<void> _debugToggleProfileWidgetBuilds() async {
await refreshViews();
for (FlutterDevice device in flutterDevices) {
await device.toggleProfileWidgetBuilds();
}
}
Future<void> _screenshot(FlutterDevice device) async {
final Status status = logger.startProgress('Taking screenshot for ${device.device.name}...', timeout: timeoutConfiguration.fastOperation);
final File outputFile = getUniqueFile(fs.currentDirectory, 'flutter', 'png');
......@@ -870,6 +883,10 @@ abstract class ResidentRunner {
await _screenshot(device);
}
return true;
} else if (character == 'a') {
if (supportsServiceProtocol && isRunningDebug) {
await _debugToggleProfileWidgetBuilds();
}
} else if (lower == 'o') {
if (supportsServiceProtocol && isRunningDebug) {
await _debugTogglePlatform();
......@@ -976,6 +993,7 @@ abstract class ResidentRunner {
printStatus('To toggle the widget inspector (WidgetsApp.showWidgetInspectorOverride), press "i".');
printStatus('To toggle the display of construction lines (debugPaintSizeEnabled), press "p".');
printStatus('To simulate different operating systems, (defaultTargetPlatform), press "o".');
printStatus('To enable timeline events for all widget build methods, (debugProfileWidgetBuilds), press "a"');
printStatus('To toggle the elevation checker, press "z".');
} else {
printStatus('To dump the accessibility tree (debugDumpSemantics), press "S" (for traversal order) or "U" (for inverse hit test order).');
......
......@@ -1289,6 +1289,8 @@ class Isolate extends ServiceObjectOwner {
Future<Map<String, dynamic>> flutterToggleWidgetInspector() => _flutterToggle('inspector.show');
Future<Map<String, dynamic>> flutterToggleProfileWidgetBuilds() => _flutterToggle('profileWidgetBuilds');
Future<Map<String, dynamic>> flutterDebugAllowBanner(bool show) {
return invokeFlutterExtensionRpcRaw(
'ext.flutter.debugAllowBanner',
......
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