зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f262b1efaa
Коммит
e15e0ca584
|
@ -51,6 +51,7 @@ class SharedMemory {
|
||||||
|
|
||||||
virtual bool Create(size_t size) = 0;
|
virtual bool Create(size_t size) = 0;
|
||||||
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) = 0;
|
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) = 0;
|
||||||
|
virtual void Unmap() = 0;
|
||||||
|
|
||||||
virtual void CloseHandle() = 0;
|
virtual void CloseHandle() = 0;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ class SharedMemoryBasic final
|
||||||
|
|
||||||
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) override;
|
virtual bool Map(size_t nBytes, void* fixed_address = nullptr) override;
|
||||||
|
|
||||||
|
virtual void Unmap() override;
|
||||||
|
|
||||||
virtual void CloseHandle() override;
|
virtual void CloseHandle() override;
|
||||||
|
|
||||||
virtual void* memory() const override {
|
virtual void* memory() const override {
|
||||||
|
@ -60,8 +62,6 @@ class SharedMemoryBasic final
|
||||||
private:
|
private:
|
||||||
~SharedMemoryBasic();
|
~SharedMemoryBasic();
|
||||||
|
|
||||||
void Unmap();
|
|
||||||
|
|
||||||
// The /dev/ashmem fd we allocate.
|
// The /dev/ashmem fd we allocate.
|
||||||
int mShmFd;
|
int mShmFd;
|
||||||
// Pointer to mapped region, null if unmapped.
|
// Pointer to mapped region, null if unmapped.
|
||||||
|
|
|
@ -49,6 +49,8 @@ class SharedMemoryBasic final
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void Unmap() override { mSharedMemory.Unmap(); }
|
||||||
|
|
||||||
virtual void CloseHandle() override { mSharedMemory.Close(false); }
|
virtual void CloseHandle() override { mSharedMemory.Close(false); }
|
||||||
|
|
||||||
virtual void* memory() const override {
|
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 bool Map(size_t nBytes, void* fixed_address = nullptr) override;
|
||||||
|
|
||||||
|
virtual void Unmap() override;
|
||||||
|
|
||||||
virtual void CloseHandle() override;
|
virtual void CloseHandle() override;
|
||||||
|
|
||||||
virtual void* memory() const override {
|
virtual void* memory() const override {
|
||||||
|
@ -97,7 +99,6 @@ class SharedMemoryBasic final : public SharedMemoryCommon<mach_port_t> {
|
||||||
private:
|
private:
|
||||||
~SharedMemoryBasic();
|
~SharedMemoryBasic();
|
||||||
|
|
||||||
void Unmap();
|
|
||||||
mach_port_t mPort;
|
mach_port_t mPort;
|
||||||
// Pointer to mapped region, null if unmapped.
|
// Pointer to mapped region, null if unmapped.
|
||||||
void* mMemory;
|
void* mMemory;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче