Bug 1245241 - part 1 - Close Shmem file handles after mapping them when possible to reduce exhaustion issues. r=billm
This commit is contained in:
@@ -40,15 +40,18 @@ SharedMemoryBasic::SharedMemoryBasic()
|
||||
, mMemory(nullptr)
|
||||
{ }
|
||||
|
||||
SharedMemoryBasic::SharedMemoryBasic(const Handle& aHandle)
|
||||
: mShmFd(aHandle.fd)
|
||||
, mMemory(nullptr)
|
||||
{ }
|
||||
|
||||
SharedMemoryBasic::~SharedMemoryBasic()
|
||||
{
|
||||
Unmap();
|
||||
Destroy();
|
||||
CloseHandle();
|
||||
}
|
||||
|
||||
bool
|
||||
SharedMemoryBasic::SetHandle(const Handle& aHandle)
|
||||
{
|
||||
MOZ_ASSERT(-1 == mShmFd, "Already Create()d");
|
||||
mShmFd = aHandle.fd;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -125,7 +128,7 @@ SharedMemoryBasic::Unmap()
|
||||
}
|
||||
|
||||
void
|
||||
SharedMemoryBasic::Destroy()
|
||||
SharedMemoryBasic::CloseHandle()
|
||||
{
|
||||
if (mShmFd > 0) {
|
||||
close(mShmFd);
|
||||
|
||||
Reference in New Issue
Block a user