Conversation
|
CC @iskakaushik : just in case that you're interested in the shader warm-up work. Would you like to review this when it's out of wip? |
|
@liyuqian yes please! |
chinmaygarde
left a comment
There was a problem hiding this comment.
Some initial suggestions.
|
|
||
| std::vector<std::string> ListFiles(const fml::UniqueFD& directory) { | ||
| std::vector<std::string> files; | ||
| DIR* dir = ::fdopendir(directory.get()); |
There was a problem hiding this comment.
This is being leaked without a balancing closedir. I suggest creating a fml::UniqueObject<T>. There is an early return as well. Its just easier with RAII wrappers.
There was a problem hiding this comment.
We cannot call closedir because it will also close the corresponding UniqueFD, and later reference to that UniqueFD will fail. Also, we don't have to call closedir because UniqueFD will call close on its destructor.
There was a problem hiding this comment.
::closedir won't close the FD. The FD and the DIR* are different. Maybe that is why you had to rewinddir?
0458dac to
2a2a398
Compare
2a2a398 to
fc39cfd
Compare
|
@chinmaygarde @iskakaushik : unit tests are added and the PR is now ready for review. |
fc39cfd to
5ac4685
Compare
fml/file.h
Outdated
| const char* file_name, | ||
| const Mapping& mapping); | ||
|
|
||
| using FileVisitor = std::function<void(const fml::UniqueFD& directory, |
There was a problem hiding this comment.
Can we make the FileVisitor return a bool to indicate if further traversal is necessary? For example, folks can use this to implement a FindFile whereby they can return false when a file is found so further traversal is unnecessary.
There was a problem hiding this comment.
Please document if the filename is relative or absolute.
There was a problem hiding this comment.
filename inherently implies it's the name of the file as opposed to filepath, no? :-)
There was a problem hiding this comment.
Sure, it now returns bool. I agree that filename sounds clear to me but it's no harm to add a comment to make it even clearer.
fml/file.h
Outdated
| /// use our helper method `VisitFilesRecursively`. | ||
| /// | ||
| /// @see `VisitFilesRecursively`. | ||
| void VisitFiles(const fml::UniqueFD& directory, const FileVisitor& visitor); |
There was a problem hiding this comment.
You don't need to pass closures by const reference. Just FileVisitor visitor is fine.
|
|
||
| std::vector<std::string> ListFiles(const fml::UniqueFD& directory) { | ||
| std::vector<std::string> files; | ||
| DIR* dir = ::fdopendir(directory.get()); |
There was a problem hiding this comment.
::closedir won't close the FD. The FD and the DIR* are different. Maybe that is why you had to rewinddir?
chinmaygarde
left a comment
There was a problem hiding this comment.
Sorry, I accidentally approved earlier. Can you make sure to recheck how you got away with not requiring a ::closedir?
|
Calling BTW, I've also reset your accidental approval :) |
Try to dismiss the accidental approval
|
|
||
| void VisitFilesRecursively(const fml::UniqueFD& directory, | ||
| const FileVisitor& visitor) { | ||
| FileVisitor recursive_visitor = [&recursive_visitor, &visitor]( |
There was a problem hiding this comment.
nit: you could use nftw https://linux.die.net/man/3/nftw to simplify this.
There was a problem hiding this comment.
Ah, nftw looks useful. Do you also happen to know the corresponding API for Windows? I wonder if I shall adjust our API to be more close to ntfw (e.g., provide nopenfd argument)
| static void SetCacheSkSL(bool value); | ||
| static void MarkStrategySet() { strategy_set_ = true; } | ||
|
|
There was a problem hiding this comment.
I wonder if we can use some builder like pattern here. Like:
PersistentCacheBuilder
.setCacheSkSl(true)
...
.build()
That way we could avoid having this extra flag. But i'm not sure if this is a common c++ paradigm.
There was a problem hiding this comment.
We use this pattern in the embedder_unittests in for the EmbedderConfigBuilder.
There was a problem hiding this comment.
I like the builder pattern, but it doesn't seem to be compatible with our current PersistentCache::GetCacheForProcess usages. If we think that it's worth to do a yak shave to remove PersistentCache::GetCacheForProcess and let Shell own the PersistentCache used by Rasterizer and IOManager, maybe we shall do that in another isolated PR and create an issue to track its progress.
bcad574 to
2c41d1d
Compare
Otherwise, the unit test would fail if previous unit tests have already set the PersistentCache with different settings.
|
I've finally made all tests pass on both Windows and Linux 😄 This is now ready for review again @chinmaygarde @iskakaushik |
[email protected]:flutter/engine.git/compare/5b3182294f63...c635d70 git log 5b31822..c635d70 --no-merges --oneline 2019-10-08 [email protected] Roll src/third_party/skia 902cf1e12a74..1494a7f1ec03 (10 commits) (flutter/engine#13000) 2019-10-08 [email protected] SkSL precompile (flutter/engine#12412) 2019-10-08 [email protected] Compile sanitizer suppressions list and file bugs as necessary. (flutter/engine#12991) 2019-10-08 [email protected] Add a unit-test to verify that root surface transformation affect platform view coordinates. (flutter/engine#12783) 2019-10-08 [email protected] Re-land Adding Link Semantics (flutter/engine#12972) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
So we can test SkSL precompile using the command line tools. See flutter/engine#12412.
So we can test SkSL precompile using the command line tools. See flutter/engine#12412.
[email protected]:flutter/engine.git/compare/5b3182294f63...c635d70 git log 5b31822..c635d70 --no-merges --oneline 2019-10-08 [email protected] Roll src/third_party/skia 902cf1e12a74..1494a7f1ec03 (10 commits) (flutter/engine#13000) 2019-10-08 [email protected] SkSL precompile (flutter/engine#12412) 2019-10-08 [email protected] Compile sanitizer suppressions list and file bugs as necessary. (flutter/engine#12991) 2019-10-08 [email protected] Add a unit-test to verify that root surface transformation affect platform view coordinates. (flutter/engine#12783) 2019-10-08 [email protected] Re-land Adding Link Semantics (flutter/engine#12972) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
So we can test SkSL precompile using the command line tools. See flutter/engine#12412.
For flutter/flutter#40686
Unit tests added: