Bug 1245241 - part 1 - Close Shmem file handles after mapping them when possible to reduce exhaustion issues. r=billm

This commit is contained in:
Lee Salzman
2016-02-18 10:56:15 -05:00
parent 8bcce717c3
commit 0e305a9861
13 changed files with 225 additions and 323 deletions

View File

@@ -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);