Allow profile widget builds in profile mode (#30990)

## Description

Previously, such function is only available in the debug mode. But the
performance information is very noisy in debug mode with JIT. I feel
that such function is as important and useful as the performance overlay
and the `--trace-skia` option for the GPU thread.  So we should give it
the same ability to run in both profile and debug mode.

I've tested it using flutter_gallery in the profile mode. There's no
observable difference in the performance overlay between toggling widget
build profiling.

## Related Issues

https://github.com/flutter/flutter/issues/30984
This commit is contained in:
liyuqian
2019-04-15 13:57:43 -07:00
committed by GitHub
parent 330dc94c0f
commit a8116e9ea3
3 changed files with 16 additions and 22 deletions

View File

@@ -884,7 +884,7 @@ abstract class ResidentRunner {
}
return true;
} else if (character == 'a') {
if (supportsServiceProtocol && isRunningDebug) {
if (supportsServiceProtocol) {
await _debugToggleProfileWidgetBuilds();
}
} else if (lower == 'o') {
@@ -993,12 +993,12 @@ 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).');
}
printStatus('To display the performance overlay (WidgetsApp.showPerformanceOverlay), press "P".');
printStatus('To enable timeline events for all widget build methods, (debugProfileWidgetBuilds), press "a"');
}
if (flutterDevices.any((FlutterDevice d) => d.device.supportsScreenshot)) {
printStatus('To save a screenshot to flutter.png, press "s".');