Backed out changeset 80c9125cfac0 (bug 1704812) for assertion failures on gfxPlatformFontList.cpp. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2021-05-13 12:26:03 +03:00
Родитель 40e823046b
Коммит ba272367cd
9 изменённых файлов: 0 добавлений и 112 удалений

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

@ -2357,14 +2357,6 @@ mozilla::ipc::IPCResult ContentChild::RecvRebuildFontList(
return IPC_OK();
}
mozilla::ipc::IPCResult ContentChild::RecvFontListShmBlockAdded(
const uint32_t& aGeneration, const uint32_t& aIndex,
const base::SharedMemoryHandle& aHandle) {
gfxPlatformFontList::PlatformFontList()->ShmBlockAdded(aGeneration, aIndex,
aHandle);
return IPC_OK();
}
mozilla::ipc::IPCResult ContentChild::RecvUpdateAppLocales(
nsTArray<nsCString>&& aAppLocales) {
LocaleService::GetInstance()->AssignAppLocales(aAppLocales);

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

@ -352,9 +352,6 @@ class ContentChild final : public PContentChild,
mozilla::ipc::IPCResult RecvUpdateFontList(SystemFontList&&);
mozilla::ipc::IPCResult RecvRebuildFontList(const bool& aFullRebuild);
mozilla::ipc::IPCResult RecvFontListShmBlockAdded(
const uint32_t& aGeneration, const uint32_t& aIndex,
const base::SharedMemoryHandle& aHandle);
mozilla::ipc::IPCResult RecvUpdateAppLocales(
nsTArray<nsCString>&& aAppLocales);

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

@ -1632,21 +1632,6 @@ void ContentParent::BroadcastFontListChanged() {
}
}
void ContentParent::BroadcastShmBlockAdded(uint32_t aGeneration,
uint32_t aIndex) {
auto* pfl = gfxPlatformFontList::PlatformFontList();
for (auto* cp : AllProcesses(eLive)) {
base::SharedMemoryHandle handle =
pfl->ShareShmBlockToProcess(aIndex, cp->Pid());
if (handle == base::SharedMemory::NULLHandle()) {
// If something went wrong here, we just skip it; the child will need to
// request the block as needed, at some performance cost.
continue;
}
Unused << cp->SendFontListShmBlockAdded(aGeneration, aIndex, handle);
}
}
void ContentParent::BroadcastThemeUpdate(widget::ThemeChangeKind aKind) {
const FullLookAndFeel& lnf = *RemoteLookAndFeel::ExtractData();
for (auto* cp : AllProcesses(eLive)) {

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

@ -259,7 +259,6 @@ class ContentParent final
static void BroadcastStringBundle(const StringBundleDescriptor&);
static void BroadcastFontListChanged();
static void BroadcastShmBlockAdded(uint32_t aGeneration, uint32_t aIndex);
static void BroadcastThemeUpdate(widget::ThemeChangeKind);

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

@ -635,13 +635,6 @@ child:
*/
async FontListChanged();
/**
* A new shmem block has been added to the font list; the child process
* should map the new block and add to its index.
*/
async FontListShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
SharedMemoryHandle aHandle);
async UpdateAppLocales(nsCString[] appLocales);
async UpdateRequestedLocales(nsCString[] requestedLocales);

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

@ -266,11 +266,6 @@ class FontList {
void ShareBlocksToProcess(nsTArray<base::SharedMemoryHandle>* aBlocks,
base::ProcessId aPid);
base::SharedMemoryHandle ShareBlockToProcess(uint32_t aIndex,
base::ProcessId aPid);
void ShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
base::SharedMemoryHandle aHandle);
/**
* Support for memory reporter.
*/

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

@ -9,7 +9,6 @@
#include "nsReadableUtils.h"
#include "prerror.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/Logging.h"
#define LOG_FONTLIST(args) \
@ -626,48 +625,9 @@ bool FontList::AppendShmBlock(uint32_t aSizeNeeded) {
mReadOnlyShmems.AppendElement(std::move(readOnly));
dom::ContentParent::BroadcastShmBlockAdded(GetGeneration(),
mBlocks.Length() - 1);
return true;
}
void FontList::ShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
base::SharedMemoryHandle aHandle) {
MOZ_ASSERT(!XRE_IsParentProcess());
MOZ_ASSERT(mBlocks.Length() > 0);
auto newShm = MakeUnique<base::SharedMemory>();
if (!newShm->IsHandleValid(aHandle)) {
return;
}
if (!newShm->SetHandle(aHandle, true)) {
MOZ_CRASH("failed to set shm handle");
}
if (aIndex != mBlocks.Length()) {
return;
}
if (aGeneration != GetGeneration()) {
return;
}
if (!newShm->Map(SHM_BLOCK_SIZE) || !newShm->memory()) {
MOZ_CRASH("failed to map shared memory");
}
uint32_t size = static_cast<BlockHeader*>(newShm->memory())->mBlockSize;
MOZ_ASSERT(size >= SHM_BLOCK_SIZE);
if (size != SHM_BLOCK_SIZE) {
newShm->Unmap();
if (!newShm->Map(size) || !newShm->memory()) {
MOZ_CRASH("failed to map shared memory");
}
}
mBlocks.AppendElement(new ShmBlock(std::move(newShm)));
}
void FontList::DetachShmBlocks() {
for (auto& i : mBlocks) {
i->mShmem = nullptr;
@ -736,20 +696,6 @@ void FontList::ShareBlocksToProcess(nsTArray<base::SharedMemoryHandle>* aBlocks,
}
}
base::SharedMemoryHandle FontList::ShareBlockToProcess(uint32_t aIndex,
base::ProcessId aPid) {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
MOZ_RELEASE_ASSERT(mReadOnlyShmems.Length() == mBlocks.Length());
MOZ_RELEASE_ASSERT(aIndex < mReadOnlyShmems.Length());
base::SharedMemoryHandle handle = base::SharedMemory::NULLHandle();
if (mReadOnlyShmems[aIndex]->ShareToProcess(aPid, &handle)) {
return handle;
}
return base::SharedMemory::NULLHandle();
}
Pointer FontList::Alloc(uint32_t aSize) {
// Only the parent process does allocation.
MOZ_ASSERT(XRE_IsParentProcess());

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

@ -2657,19 +2657,6 @@ void gfxPlatformFontList::ShareFontListToProcess(
}
}
base::SharedMemoryHandle gfxPlatformFontList::ShareShmBlockToProcess(
uint32_t aIndex, base::ProcessId aPid) {
MOZ_RELEASE_ASSERT(SharedFontList());
return SharedFontList()->ShareBlockToProcess(aIndex, aPid);
}
void gfxPlatformFontList::ShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
base::SharedMemoryHandle aHandle) {
if (SharedFontList()) {
SharedFontList()->ShmBlockAdded(aGeneration, aIndex, aHandle);
}
}
void gfxPlatformFontList::InitializeFamily(uint32_t aGeneration,
uint32_t aFamilyIndex,
bool aLoadCmaps) {

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

@ -277,12 +277,6 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
void ShareFontListToProcess(nsTArray<base::SharedMemoryHandle>* aBlocks,
base::ProcessId aPid);
void ShmBlockAdded(uint32_t aGeneration, uint32_t aIndex,
base::SharedMemoryHandle aHandle);
base::SharedMemoryHandle ShareShmBlockToProcess(uint32_t aIndex,
base::ProcessId aPid);
void SetCharacterMap(uint32_t aGeneration,
const mozilla::fontlist::Pointer& aFacePtr,
const gfxSparseBitSet& aMap);