1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:24:58 +00:00

LibCore: Make MappedFile OwnPtr-based

Since it will become a stream in a little bit, it should behave like all
non-trivial stream classes, who are not primarily intended to have
shared ownership to make closing behavior more predictable. Across all
uses of MappedFile, there is only one use case of shared mapped files in
LibVideo, which now uses the thin SharedMappedFile wrapper.
This commit is contained in:
kleines Filmröllchen 2023-09-26 00:54:34 +02:00 committed by Tim Schumacher
parent 5b2496e522
commit 062e0db46c
32 changed files with 80 additions and 64 deletions

View file

@ -122,7 +122,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// FIXME: Map file chunk-by-chunk once we have mmap() with offset.
// This will require mapping some parts then unmapping them repeatedly,
// but it would be significantly faster and less syscall heavy than seek()/read() at every read.
RefPtr<Core::MappedFile> mapped_file;
OwnPtr<Core::MappedFile> mapped_file;
ReadonlyBytes input_bytes;
if (st.st_size > 0) {
mapped_file = TRY(Core::MappedFile::map(zip_file_path));