From d1e73ed3bc8fb6a28bcd3f98ebe4f8a168cb18e5 Mon Sep 17 00:00:00 2001 From: Razvan Maries Date: Fri, 31 May 2019 18:29:47 +0300 Subject: [PATCH] Backed out changeset 023c03347e6a (bug 1554183) for build bustages. CLOSED TREE --- gfx/thebes/gfxFT2FontList.cpp | 41 ++++++++++------------------------- gfx/thebes/gfxFT2FontList.h | 2 -- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 3b7a05e22d5d..864b335631f7 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -707,14 +707,11 @@ class FontNameCache { mCache = mozilla::scache::StartupCache::GetSingleton(); } - ~FontNameCache() { WriteCache(); } - - void WriteCache() { + ~FontNameCache() { if (!mWriteNeeded || !mCache) { return; } - LOG(("Writing FontNameCache:")); nsAutoCString buf; for (auto iter = mMap.Iter(); !iter.Done(); iter.Next()) { auto entry = static_cast(iter.Get()); @@ -732,11 +729,8 @@ class FontNameCache { buf.Append(';'); } - LOG(("putting FontNameCache to " CACHE_KEY ", length %u", - buf.Length() + 1)); mCache->PutBuffer(CACHE_KEY, UniquePtr(ToNewCString(buf)), buf.Length() + 1); - mWriteNeeded = false; } // This may be called more than once (if we re-load the font list). @@ -748,11 +742,10 @@ class FontNameCache { uint32_t size; UniquePtr buf; if (NS_FAILED(mCache->GetBuffer(CACHE_KEY, &buf, &size))) { - LOG(("no cache of " CACHE_KEY)); return; } - LOG(("got: %u bytes from the cache " CACHE_KEY, size)); + LOG(("got: %s from the cache", nsDependentCString(buf.get(), size).get())); mMap.Clear(); mWriteNeeded = false; @@ -1345,25 +1338,6 @@ void gfxFT2FontList::FindFonts() { RefPtr& family = iter.Data(); FinalizeFamilyMemberList(key, family, /* aSortFaces */ true); } - // Write out FontCache data if needed - WriteCache(); -} - -void gfxFT2FontList::WriteCache() { - if (mFontNameCache) { - mFontNameCache->WriteCache(); - } - mozilla::scache::StartupCache* cache = - mozilla::scache::StartupCache::GetSingleton(); - if (cache && mJarModifiedTime > 0) { - const size_t bufSize = sizeof(mJarModifiedTime); - auto buf = MakeUnique(bufSize); - memcpy(buf.get(), &mJarModifiedTime, bufSize); - - LOG(("WriteCache: putting Jar, length %u", bufSize)); - cache->PutBuffer(JAR_LAST_MODIFED_TIME, std::move(buf), bufSize); - } - LOG(("Done with writecache")); } void gfxFT2FontList::FindFontsInDir(const nsCString& aDir, @@ -1574,7 +1548,14 @@ gfxFontFamily* gfxFT2FontList::CreateFontFamily(const nsACString& aName) const { } void gfxFT2FontList::WillShutdown() { - LOG(("WillShutdown")); - WriteCache(); + mozilla::scache::StartupCache* cache = + mozilla::scache::StartupCache::GetSingleton(); + if (cache && mJarModifiedTime > 0) { + const size_t bufSize = sizeof(mJarModifiedTime); + auto buf = MakeUnique(bufSize); + memcpy(buf.get(), &mJarModifiedTime, bufSize); + + cache->PutBuffer(JAR_LAST_MODIFED_TIME, std::move(buf), bufSize); + } mFontNameCache = nullptr; } diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index 3cea2b0fd9ee..c0023a02aa4a 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -132,8 +132,6 @@ class gfxFT2FontList : public gfxPlatformFontList { const uint8_t* aFontData, uint32_t aLength) override; - void WriteCache(); - void GetSystemFontList(InfallibleTArray* retValue); static gfxFT2FontList* PlatformFontList() {