diff options
author | 2021-02-19 00:08:36 -0800 | |
---|---|---|
committer | 2021-02-22 05:15:50 +0000 | |
commit | 3fde572afccd84e1a6573ebb02a89be3ff18d1fe (patch) | |
tree | 83abf13175c1272267b12a0ef09ffbe945824020 /services/incremental/ServiceWrappers.cpp | |
parent | a5946f7056fe30957f8eebd2beac06ea389dbbc9 (diff) |
Fix the progress getting for mapped files
Mapped files don't support querying their loading progress,
so we should simply skip them - they are already a part of
some other file, and will get accounted for loading when
that file's progress get queried
+ a bunch of small improvements
Bug: 180535478
Test: atest service.incremental_test, adb install --incremental
with mapped native libs
Change-Id: Ifc8a402144f2f3669a0419124fb0f35d7002190a
(cherry picked from commit 7731ebd1d8187c92a992d1f53c4114a6c40f7563)
Diffstat (limited to 'services/incremental/ServiceWrappers.cpp')
-rw-r--r-- | services/incremental/ServiceWrappers.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/services/incremental/ServiceWrappers.cpp b/services/incremental/ServiceWrappers.cpp index 36bda49d278c..d61328942e5c 100644 --- a/services/incremental/ServiceWrappers.cpp +++ b/services/incremental/ServiceWrappers.cpp @@ -287,11 +287,10 @@ private: auto it = mJobs.begin(); // Always acquire begin(). We can't use it after unlock as mTimedJobs can change. for (; it != mJobs.end() && it->when <= now; it = mJobs.begin()) { - auto job = std::move(it->what); - mJobs.erase(it); + auto jobNode = mJobs.extract(it); lock.unlock(); - job(); + jobNode.value().what(); lock.lock(); } nextJobTs = it != mJobs.end() ? it->when : kInfinityTs; @@ -313,20 +312,20 @@ private: std::thread mThread; }; -class RealFsWrapper : public FsWrapper { +class RealFsWrapper final : public FsWrapper { public: RealFsWrapper() = default; ~RealFsWrapper() = default; - std::vector<std::string> listFilesRecursive(std::string_view directoryPath) const final { - std::vector<std::string> files; + void listFilesRecursive(std::string_view directoryPath, FileCallback onFile) const final { for (const auto& entry : std::filesystem::recursive_directory_iterator(directoryPath)) { if (!entry.is_regular_file()) { continue; } - files.push_back(entry.path().c_str()); + if (!onFile(entry.path().native())) { + break; + } } - return files; } }; |