-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Image tracing #50648
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
Image tracing #50648
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
I tried to keep the package updates out of this but two more snuck in. Oh well. |
|
🤷♂️ You could try pinning it in update_packages.dart |
bkonyi
left a comment
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.
Timeline code and test LGTM
| List<TimelineEvent> events, List<Map<String, dynamic>> expected) { | ||
| for (final TimelineEvent event in events) { | ||
| for (int index = 0; index < expected.length; index += 1) { | ||
| if (expected[index]['name'] == event.json['name']) { |
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.
This would be cleaner if you did:
for (final e in expected) {
...
if (_mapsEqual(expectedArgs, args)) {
expected.remove(e);
}
}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.
_mapsEqual assumes it's doing a flat map though, and there are no nested maps. I guess I could update it to check for that...
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'm trying to short circuit the more expensive recursion this way though by keying on the name. It's faster to check that one property than to recurse the entire structure, which could become large as we add to these tests.
| return; | ||
| TimelineTask timelineTask; | ||
| if (!kReleaseMode) { | ||
| timelineTask = TimelineTask()..start('ImageCache.setMaximumSize', arguments: <String, dynamic>{'value': value}); |
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.
Nit: You might want to consider breaking this into multiple lines (below as well)
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.
Done
2569ea0 to
6148146
Compare
|
This test either has to be rewritten (the dwds pinned version of vm_service is broken for what the test uses), or we have to get dwds to bump vmservice for this. I'm separately going to open an internal CL to open up visibility for flutter to use this package. |
|
I rewrote the test to not depend on package:vm_service. Filed dart-lang/webdev#899 to track getting that bumped in dwds and added a TODO. |
56766b8 to
c708be9
Compare
goderbauer
left a comment
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.
LGTM
| @@ -0,0 +1,7 @@ | |||
| # Tracing tests | |||
|
|
|||
| The tests in this folder must be run with `flutter test --enable-vmservice`, | |||
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.
Any chance you can check for this condition from within the test and just print this message if the test was run incorrectly?
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.
(Readmes usually get ignored..)
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.
Never mind, I see below that you already do this: 🌟
| import 'dart:isolate' as isolate; | ||
|
|
||
| import 'package:flutter/painting.dart'; | ||
|
|
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.
nit: I believe this blank line shouldn't be here?
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.
Removed.
| @@ -0,0 +1,7 @@ | |||
| # Tracing tests | |||
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.
Should this be removed?
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.
The whole file or this line?
I think most of the folders in dev/ have a README.md - the goal of this one is to make it clear what kind of tests belong in here, and what's special about running them.
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.
This isn't in dev though, this is in flutter/test
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.
Ah! Thanks, good catch. Removed.
jonahwilliams
left a comment
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.
LGTM
Description
Add tracing to image cache calls outside of release mode. Looks like this:
And can be easily lined up with engine work to see what's going on. The small line dropping off of
listeneris to a cleanup routine that runs at the end of listening, which is too small to be visible at the zoom level of the screenshot (but is there!) :)./cc @liyuqian @chinmaygarde @alml @ignatz @goderbauer @gaaclarke
Tests
I added the following tests:
I'm trying to figure out the right way to test this. I think we'll need to update a driver test and check that this data is in there to start, but I'm open to suggestions.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.