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