Loading gfx/thebes/SharedFontList-impl.h +1 −5 Original line number Diff line number Diff line Loading @@ -334,11 +334,7 @@ class FontList { mozilla::UniquePtr<base::SharedMemory> mShmem; }; Header& GetHeader() { // It's invalid to try and access this before the first block exists. MOZ_ASSERT(mBlocks.Length() > 0); return *static_cast<Header*>(mBlocks[0]->Memory()); } Header& GetHeader() const; /** * Create a new shared memory block and append to the FontList's list Loading gfx/thebes/SharedFontList.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -725,6 +725,24 @@ FontList::FontList(uint32_t aGeneration) { FontList::~FontList() { DetachShmBlocks(); } FontList::Header& FontList::GetHeader() const MOZ_NO_THREAD_SAFETY_ANALYSIS { // We only need to lock if we're not on the main thread. bool isMainThread = NS_IsMainThread(); if (!isMainThread) { gfxPlatformFontList::PlatformFontList()->Lock(); } // It's invalid to try and access this before the first block exists. MOZ_ASSERT(mBlocks.Length() > 0); auto& result = *static_cast<Header*>(mBlocks[0]->Memory()); if (!isMainThread) { gfxPlatformFontList::PlatformFontList()->Unlock(); } return result; } bool FontList::AppendShmBlock(uint32_t aSizeNeeded) { MOZ_ASSERT(XRE_IsParentProcess()); uint32_t size = std::max(aSizeNeeded, SHM_BLOCK_SIZE); Loading gfx/thebes/gfxPlatformFontList.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -2984,6 +2984,7 @@ base::SharedMemoryHandle gfxPlatformFontList::ShareShmBlockToProcess( void gfxPlatformFontList::ShmBlockAdded(uint32_t aGeneration, uint32_t aIndex, base::SharedMemoryHandle aHandle) { if (SharedFontList()) { AutoLock lock(mLock); SharedFontList()->ShmBlockAdded(aGeneration, aIndex, std::move(aHandle)); } } Loading Loading
gfx/thebes/SharedFontList-impl.h +1 −5 Original line number Diff line number Diff line Loading @@ -334,11 +334,7 @@ class FontList { mozilla::UniquePtr<base::SharedMemory> mShmem; }; Header& GetHeader() { // It's invalid to try and access this before the first block exists. MOZ_ASSERT(mBlocks.Length() > 0); return *static_cast<Header*>(mBlocks[0]->Memory()); } Header& GetHeader() const; /** * Create a new shared memory block and append to the FontList's list Loading
gfx/thebes/SharedFontList.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -725,6 +725,24 @@ FontList::FontList(uint32_t aGeneration) { FontList::~FontList() { DetachShmBlocks(); } FontList::Header& FontList::GetHeader() const MOZ_NO_THREAD_SAFETY_ANALYSIS { // We only need to lock if we're not on the main thread. bool isMainThread = NS_IsMainThread(); if (!isMainThread) { gfxPlatformFontList::PlatformFontList()->Lock(); } // It's invalid to try and access this before the first block exists. MOZ_ASSERT(mBlocks.Length() > 0); auto& result = *static_cast<Header*>(mBlocks[0]->Memory()); if (!isMainThread) { gfxPlatformFontList::PlatformFontList()->Unlock(); } return result; } bool FontList::AppendShmBlock(uint32_t aSizeNeeded) { MOZ_ASSERT(XRE_IsParentProcess()); uint32_t size = std::max(aSizeNeeded, SHM_BLOCK_SIZE); Loading
gfx/thebes/gfxPlatformFontList.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -2984,6 +2984,7 @@ base::SharedMemoryHandle gfxPlatformFontList::ShareShmBlockToProcess( void gfxPlatformFontList::ShmBlockAdded(uint32_t aGeneration, uint32_t aIndex, base::SharedMemoryHandle aHandle) { if (SharedFontList()) { AutoLock lock(mLock); SharedFontList()->ShmBlockAdded(aGeneration, aIndex, std::move(aHandle)); } } Loading