Bug 1699224 - Part 2. Expose SharedMemoryBasic::Unmap for use by callers. r=jld

This patch exposes SharedMemoryBasic::Unmap for use by callers to allow
one to unmap memory out of our address space without destroying the
SharedMemoryBasic object itself. This will be used by later patches in
this series.

Differential Revision: https://phabricator.services.mozilla.com/D109438
This commit is contained in:
Andrew Osmond 2021-03-29 22:43:27 +00:00
Родитель f262b1efaa
Коммит e15e0ca584
4 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -51,6 +51,7 @@ class SharedMemory {
virtual bool Create(size_t size) = 0;
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) = 0;
virtual void Unmap() = 0;
virtual void CloseHandle() = 0;

Просмотреть файл

@ -34,6 +34,8 @@ class SharedMemoryBasic final
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) override;
virtual void Unmap() override;
virtual void CloseHandle() override;
virtual void* memory() const override {
@ -60,8 +62,6 @@ class SharedMemoryBasic final
private:
~SharedMemoryBasic();
void Unmap();
// The /dev/ashmem fd we allocate.
int mShmFd;
// Pointer to mapped region, null if unmapped.

Просмотреть файл

@ -49,6 +49,8 @@ class SharedMemoryBasic final
return ok;
}
virtual void Unmap() override { mSharedMemory.Unmap(); }
virtual void CloseHandle() override { mSharedMemory.Close(false); }
virtual void* memory() const override {

Просмотреть файл

@ -73,6 +73,8 @@ class SharedMemoryBasic final : public SharedMemoryCommon<mach_port_t> {
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) override;
virtual void Unmap() override;
virtual void CloseHandle() override;
virtual void* memory() const override {
@ -97,7 +99,6 @@ class SharedMemoryBasic final : public SharedMemoryCommon<mach_port_t> {
private:
~SharedMemoryBasic();
void Unmap();
mach_port_t mPort;
// Pointer to mapped region, null if unmapped.
void* mMemory;