[Base] Android content URI file memory mapping

This commit is contained in:
Triang3l
2022-07-17 16:34:17 +03:00
parent 93a7918025
commit 624f2b2d9e
4 changed files with 73 additions and 39 deletions

View File

@@ -32,9 +32,6 @@ class Win32MappedMemory : public MappedMemory {
// CreateFileMapping returns nullptr in case of failure.
static constexpr HANDLE kMappingHandleInvalid = nullptr;
Win32MappedMemory(const std::filesystem::path& path, Mode mode)
: MappedMemory(path, mode) {}
~Win32MappedMemory() override {
if (data_) {
UnmapViewOfFile(data_);
@@ -135,7 +132,7 @@ std::unique_ptr<MappedMemory> MappedMemory::Open(
offset & ~static_cast<size_t>(system_info.dwAllocationGranularity - 1);
const size_t aligned_length = length + (offset - aligned_offset);
auto mm = std::make_unique<Win32MappedMemory>(path, mode);
auto mm = std::make_unique<Win32MappedMemory>();
mm->view_access_ = view_access;
mm->file_handle = CreateFile(path.c_str(), file_access, file_share, nullptr,