Bug 1498755 - Part 3: Merge AssertIsMainThreadOrServo{FontMetrics,LangFontPrefsCache}Locked r=emilio
authorCameron McCormack <cam@mcc.id.au>
Sun, 14 Oct 2018 00:05:50 +0000
changeset 489535 ab1c2c7f02391a2fffd5202e7f4d5131b50d20d1
parent 489534 84fe3307a2734850dcf235b44570f2513c85d530
child 489536 fb4ec4a85293a3f83fb5b8c37bf85da3d1b0b60d
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersemilio
bugs1498755
milestone64.0a1
Bug 1498755 - Part 3: Merge AssertIsMainThreadOrServo{FontMetrics,LangFontPrefsCache}Locked r=emilio Depends on D8644 Differential Revision: https://phabricator.services.mozilla.com/D8645
intl/locale/nsLanguageAtomService.cpp
layout/base/StaticPresData.cpp
layout/style/GeckoBindings.cpp
layout/style/ServoUtils.h
--- a/intl/locale/nsLanguageAtomService.cpp
+++ b/intl/locale/nsLanguageAtomService.cpp
@@ -91,17 +91,17 @@ nsLanguageAtomService::GetLanguageGroup(
   if (!retVal) {
     if (aNeedsToCache) {
       *aNeedsToCache = true;
       return nullptr;
     }
     RefPtr<nsAtom> uncached = GetUncachedLanguageGroup(aLanguage);
     retVal = uncached.get();
 
-    AssertIsMainThreadOrServoLangFontPrefsCacheLocked();
+    AssertIsMainThreadOrServoFontMetricsLocked();
     // The hashtable will keep an owning reference to the atom
     mLangToGroup.Put(aLanguage, uncached);
   }
 
   return retVal;
 }
 
 already_AddRefed<nsAtom>
--- a/layout/base/StaticPresData.cpp
+++ b/layout/base/StaticPresData.cpp
@@ -260,27 +260,27 @@ StaticPresData::GetFontPrefsForLangHelpe
         break;
       }
       prefs = prefs->mNext;
     }
     if (aNeedsToCache) {
       *aNeedsToCache = true;
       return nullptr;
     }
-    AssertIsMainThreadOrServoLangFontPrefsCacheLocked();
+    AssertIsMainThreadOrServoFontMetricsLocked();
     // nothing cached, so go on and fetch the prefs for this lang group:
     prefs = prefs->mNext = new LangGroupFontPrefs;
   }
 
   if (aNeedsToCache) {
     *aNeedsToCache = true;
     return nullptr;
   }
 
-  AssertIsMainThreadOrServoLangFontPrefsCacheLocked();
+  AssertIsMainThreadOrServoFontMetricsLocked();
   prefs->Initialize(langGroupAtom);
 
   return prefs;
 }
 
 const nsFont*
 StaticPresData::GetDefaultFontHelper(uint8_t aFontID, nsAtom *aLanguage,
                                      const LangGroupFontPrefs* aPrefs) const
--- a/layout/style/GeckoBindings.cpp
+++ b/layout/style/GeckoBindings.cpp
@@ -119,23 +119,16 @@ ThreadSafeGetDefaultFontHelper(const nsP
   }
   {
     AutoWriteLock guard(*sServoFFILock);
     retval = aPresContext->GetDefaultFont(aGenericId, aLanguage, nullptr);
   }
   return retval;
 }
 
-void
-AssertIsMainThreadOrServoLangFontPrefsCacheLocked()
-{
-  MOZ_ASSERT(NS_IsMainThread() || sServoFFILock->LockedForWritingByCurrentThread());
-}
-
-
 /*
  * Does this child count as significant for selector matching?
  *
  * See nsStyleUtil::IsSignificantChild for details.
  */
 bool
 Gecko_IsSignificantChild(RawGeckoNodeBorrowed aNode,
                          bool aWhitespaceIsSignificant)
--- a/layout/style/ServoUtils.h
+++ b/layout/style/ServoUtils.h
@@ -8,18 +8,16 @@
 
 #ifndef mozilla_ServoUtils_h
 #define mozilla_ServoUtils_h
 
 #include "mozilla/Assertions.h"
 #include "mozilla/TypeTraits.h"
 #include "MainThreadUtils.h"
 
-void AssertIsMainThreadOrServoLangFontPrefsCacheLocked();
-
 namespace mozilla {
 
 // Defined in GeckoBindings.cpp.
 void InitializeServo();
 void ShutdownServo();
 void AssertIsMainThreadOrServoFontMetricsLocked();
 
 class ServoStyleSet;