Bug 1144450 - Part 4: Replace uses of mReadyIsResolved with mStatus, as they're equivalent. r=jdaggett
authorCameron McCormack <cam@mcc.id.au>
Tue, 24 Mar 2015 19:34:32 +1100
changeset 265553 fabd2ae326921bddf114f4f5f025b43525128c44
parent 265552 8530a96751c6b43aed6783b8936b31dce36fed31
child 265554 6a83dc07c6c85c23ff81271dfdd620307163f0b9
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1144450
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1144450 - Part 4: Replace uses of mReadyIsResolved with mStatus, as they're equivalent. r=jdaggett
layout/style/FontFaceSet.cpp
layout/style/FontFaceSet.h
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -71,17 +71,16 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 FontFaceSet::FontFaceSet(nsPIDOMWindow* aWindow, nsPresContext* aPresContext)
   : DOMEventTargetHelper(aWindow)
   , mPresContext(aPresContext)
   , mDocument(aPresContext->Document())
   , mStatus(FontFaceSetLoadStatus::Loaded)
   , mNonRuleFacesDirty(false)
-  , mReadyIsResolved(true)
   , mHasLoadingFontFaces(false)
   , mHasLoadingFontFacesIsDirty(false)
 {
   MOZ_COUNT_CTOR(FontFaceSet);
 
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aWindow);
 
   // If the pref is not set, don't create the Promise (which the page wouldn't
@@ -1344,26 +1343,25 @@ FontFaceSet::CheckLoadingStarted()
     // with a fresh, unresolved promise.
     return;
   }
 
   mStatus = FontFaceSetLoadStatus::Loading;
   (new AsyncEventDispatcher(this, NS_LITERAL_STRING("loading"),
                             false))->RunDOMEventWhenSafe();
 
-  if (mReadyIsResolved && PrefEnabled()) {
+  if (PrefEnabled()) {
     nsRefPtr<Promise> ready;
     if (GetParentObject()) {
       ErrorResult rv;
       ready = Promise::Create(GetParentObject(), rv);
     }
 
     if (ready) {
       mReady.swap(ready);
-      mReadyIsResolved = false;
     }
   }
 }
 
 void
 FontFaceSet::UpdateHasLoadingFontFaces()
 {
   mHasLoadingFontFacesIsDirty = false;
@@ -1420,31 +1418,30 @@ FontFaceSet::MightHavePendingFontLoads()
   }
 
   return false;
 }
 
 void
 FontFaceSet::CheckLoadingFinished()
 {
-  if (mReadyIsResolved) {
+  if (mStatus == FontFaceSetLoadStatus::Loaded) {
     // We've already resolved mReady and dispatched the loadingdone/loadingerror
     // events.
     return;
   }
 
   if (MightHavePendingFontLoads()) {
     // We're not finished loading yet.
     return;
   }
 
   mStatus = FontFaceSetLoadStatus::Loaded;
   if (mReady) {
     mReady->MaybeResolve(this);
-    mReadyIsResolved = true;
   }
 
   // Now dispatch the loadingdone/loadingerror events.
   nsTArray<FontFace*> loaded;
   nsTArray<FontFace*> failed;
 
   for (size_t i = 0; i < mRuleFaces.Length(); i++) {
     FontFace* f = mRuleFaces[i].mFontFace;
--- a/layout/style/FontFaceSet.h
+++ b/layout/style/FontFaceSet.h
@@ -306,19 +306,16 @@ private:
   nsTArray<FontFace*> mUnavailableFaces;
 
   // The overall status of the loading or loaded fonts in the FontFaceSet.
   mozilla::dom::FontFaceSetLoadStatus mStatus;
 
   // Whether mNonRuleFaces has changed since last time UpdateRules ran.
   bool mNonRuleFacesDirty;
 
-  // Whether we have called MaybeResolve() on mReady.
-  bool mReadyIsResolved;
-
   // Whether any FontFace objects in mRuleFaces or mNonRuleFaces are
   // loading.  Only valid when mHasLoadingFontFacesIsDirty is false.  Don't use
   // this variable directly; call the HasLoadingFontFaces method instead.
   bool mHasLoadingFontFaces;
 
   // This variable is only valid when mLoadingDirty is false.
   bool mHasLoadingFontFacesIsDirty;
 };