-
Notifications
You must be signed in to change notification settings - Fork 344
Disable debug buttons in profile mode. #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
final Isolate isolate = await serviceInfo.service | ||
.getIsolate(serviceInfo.isolateManager.selectedIsolate.id); | ||
|
||
bool isProfileMode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create a FlutterApp object that tracks whether the app is debug mode or not.
@@ -46,9 +46,29 @@ class TimelineScreen extends Screen { | |||
PButton resumeButton; | |||
|
|||
@override | |||
void createContent(Framework framework, CoreElement mainDiv) { | |||
void createContent(Framework framework, CoreElement mainDiv) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be a little concerned about making this method Async. I would expect a reasonable contract is that this method is not async.
); | ||
isProfileMode = !(evaluate is InstanceRef); | ||
} catch (e) { | ||
isProfileMode = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exception is thrown? Instead of catching all exceptions verify we got the expected one.
return new PButton(text) | ||
..small() | ||
..disabled = shouldDisableForProfileMode && isProfileMode | ||
..tooltip = isProfileMode ? 'Unavailable on a profile build.' : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better is to create the UI right away with the button disabled and then enable it async when we verify the app is debug mode.
} | ||
|
||
final PButton trackWidgetBuildsButton = createButton('Track widget builds', true); | ||
final PButton perfOverlayButton = createButton('Performance overlay', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be turned on and off by similar logic to VMServiceManager in the Java app instead of triggering based on whether we are in debug or profile mode. That is more robust as potentially flutter will support some or all of these options in profile mode.
Is this PR still relevant or has it been superseded by following PRs? |
PR is obsolete now. Closing. |
Also added a null check to prevent an exception.