Bug 1519918 - Drop nsFontFaceLoader::mChannel more often. r=jfkthame
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 21 Jan 2019 10:39:07 +0000
changeset 454684 4c05fb631121d80c6c41a9b0ffcf3eeb9cd5459f
parent 454683 b277b79a2e7c6c35b74026ad58b844dca3b7d01f
child 454685 e9570ad88e6d4ac55d26342dca0ded559b8c2ff9
push id111317
push userrmaries@mozilla.com
push dateMon, 21 Jan 2019 18:01:55 +0000
treeherdermozilla-inbound@19db0edfbc10 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1519918
milestone66.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 1519918 - Drop nsFontFaceLoader::mChannel more often. r=jfkthame Doesn't look like the HTTP channel breaks the reference cycle at all, so do it when we know we're done with it. Differential Revision: https://phabricator.services.mozilla.com/D16510
layout/style/nsFontFaceLoader.cpp
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -186,16 +186,18 @@ NS_IMPL_ISUPPORTS(nsFontFaceLoader, nsIS
 // nsIStreamLoaderObserver
 NS_IMETHODIMP
 nsFontFaceLoader::OnStreamComplete(nsIStreamLoader* aLoader,
                                    nsISupports* aContext, nsresult aStatus,
                                    uint32_t aStringLen,
                                    const uint8_t* aString) {
   MOZ_ASSERT(NS_IsMainThread());
 
+  DropChannel();
+
   if (!mFontFaceSet) {
     // We've been canceled
     return aStatus;
   }
 
   mFontFaceSet->RemoveLoader(this);
 
   TimeStamp doneTime = TimeStamp::Now();
@@ -293,27 +295,29 @@ nsFontFaceLoader::OnStartRequest(nsIRequ
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFontFaceLoader::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
                                 nsresult aStatusCode) {
   MOZ_ASSERT(NS_IsMainThread());
+  DropChannel();
   return NS_OK;
 }
 
 void nsFontFaceLoader::Cancel() {
   mUserFontEntry->LoadCanceled();
   mFontFaceSet = nullptr;
   if (mLoadTimer) {
     mLoadTimer->Cancel();
     mLoadTimer = nullptr;
   }
-  mChannel->Cancel(NS_BINDING_ABORTED);
+  nsCOMPtr<nsIChannel> channel = mChannel.forget();
+  channel->Cancel(NS_BINDING_ABORTED);
 }
 
 StyleFontDisplay nsFontFaceLoader::GetFontDisplay() {
   if (!StaticPrefs::layout_css_font_display_enabled()) {
     return StyleFontDisplay::Auto;
   }
   return mUserFontEntry->GetFontDisplay();
 }