Back out changesets from bug 1342567.
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 17 May 2017 16:17:23 -0500
changeset 358822 641fa04790771eff942517d200348a72501c09e7
parent 358821 2aa6d03565faddb0072e125e8cd2d1583ef05aac
child 358823 0a7ad731e1e92919079b1f68463536e111cf53ad
push id90404
push usertnikkel@gmail.com
push dateWed, 17 May 2017 21:21:52 +0000
treeherdermozilla-inbound@641fa0479077 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1342567
milestone55.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
Back out changesets from bug 1342567. Backed out changeset 06d6f928ed64 * * * Backed out changeset f577512b1a29 * * * Backed out changeset 289645ac65c1 * * * Backed out changeset 600f9d60d76f * * * Backed out changeset 445330fd1211
image/imgLoader.cpp
image/imgLoader.h
image/imgRequestProxy.cpp
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -889,18 +889,17 @@ imgCacheEntry::imgCacheEntry(imgLoader* 
    mTouchedTime(SecondsFromPRTime(PR_Now())),
    mLoadTime(SecondsFromPRTime(PR_Now())),
    mExpiryTime(0),
    mMustValidate(false),
    // We start off as evicted so we don't try to update the cache. PutIntoCache
    // will set this to false.
    mEvicted(true),
    mHasNoProxies(true),
-   mForcePrincipalCheck(forcePrincipalCheck),
-   mInUse(false)
+   mForcePrincipalCheck(forcePrincipalCheck)
 { }
 
 imgCacheEntry::~imgCacheEntry()
 {
   LOG_FUNC(gImgLog, "imgCacheEntry::~imgCacheEntry()");
 }
 
 void
@@ -1393,18 +1392,16 @@ imgLoader::RemoveEntry(nsIURI* aURI,
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
 imgLoader::FindEntryProperties(nsIURI* uri,
                                nsIDOMDocument* aDOMDoc,
                                nsIProperties** _retval)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   *_retval = nullptr;
 
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDOMDoc);
 
   OriginAttributes attrs;
   if (doc) {
     nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
     if (principal) {
@@ -1478,18 +1475,16 @@ imgLoader::MinimizeCaches()
 {
   EvictEntries(mCacheQueue);
   EvictEntries(mChromeCacheQueue);
 }
 
 bool
 imgLoader::PutIntoCache(const ImageCacheKey& aKey, imgCacheEntry* entry)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   imgCacheTable& cache = GetCache(aKey);
 
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                              "imgLoader::PutIntoCache", "uri", aKey.Spec());
 
   // Check to see if this request already exists in the cache. If so, we'll
   // replace the old version.
   RefPtr<imgCacheEntry> tmpCacheEntry;
@@ -1539,18 +1534,16 @@ imgLoader::PutIntoCache(const ImageCache
   RemoveFromUncachedImages(request);
 
   return true;
 }
 
 bool
 imgLoader::SetHasNoProxies(imgRequest* aRequest, imgCacheEntry* aEntry)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                              "imgLoader::SetHasNoProxies", "uri",
                              aRequest->CacheKey().Spec());
 
   aEntry->SetHasNoProxies(true);
 
   if (aEntry->Evicted()) {
     return false;
@@ -1572,18 +1565,16 @@ imgLoader::SetHasNoProxies(imgRequest* a
   CheckCacheLimits(cache, queue);
 
   return true;
 }
 
 bool
 imgLoader::SetHasProxies(imgRequest* aRequest)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   VerifyCacheSizes();
 
   const ImageCacheKey& key = aRequest->CacheKey();
   imgCacheTable& cache = GetCache(key);
 
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                              "imgLoader::SetHasProxies", "uri", key.Spec());
 
@@ -1901,30 +1892,24 @@ imgLoader::ValidateEntry(imgCacheEntry* 
   }
 
   return !validateRequest;
 }
 
 bool
 imgLoader::RemoveFromCache(const ImageCacheKey& aKey)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                              "imgLoader::RemoveFromCache", "uri", aKey.Spec());
 
   imgCacheTable& cache = GetCache(aKey);
   imgCacheQueue& queue = GetCacheQueue(aKey);
 
   RefPtr<imgCacheEntry> entry;
   if (cache.Get(aKey, getter_AddRefs(entry)) && entry) {
-    if (MOZ_UNLIKELY(entry->GetInUse())) {
-      gfxCriticalNoteOnce << "RemoveFromCache(key) removing inuse cache entry";
-    }
-
     cache.Remove(aKey);
 
     MOZ_ASSERT(!entry->Evicted(), "Evicting an already-evicted cache entry!");
 
     // Entries with no proxies are in the tracker.
     if (entry->HasNoProxies()) {
       if (mCacheTracker) {
         mCacheTracker->RemoveObject(entry);
@@ -1941,35 +1926,28 @@ imgLoader::RemoveFromCache(const ImageCa
     return true;
   }
   return false;
 }
 
 bool
 imgLoader::RemoveFromCache(imgCacheEntry* entry)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   LOG_STATIC_FUNC(gImgLog, "imgLoader::RemoveFromCache entry");
 
   RefPtr<imgRequest> request = entry->GetRequest();
   if (request) {
     const ImageCacheKey& key = request->CacheKey();
     imgCacheTable& cache = GetCache(key);
     imgCacheQueue& queue = GetCacheQueue(key);
 
     LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                                "imgLoader::RemoveFromCache", "entry's uri",
                                key.Spec());
 
-    if (MOZ_UNLIKELY(entry->GetInUse())) {
-      gfxCriticalNoteOnce << "RemoveFromCache(entry) removing inuse cache entry";
-      MOZ_RELEASE_ASSERT(false);
-    }
-
     cache.Remove(key);
 
     if (entry->HasNoProxies()) {
       LOG_STATIC_FUNC(gImgLog,
                       "imgLoader::RemoveFromCache removing from tracker");
       if (mCacheTracker) {
         mCacheTracker->RemoveObject(entry);
       }
@@ -2109,18 +2087,16 @@ imgLoader::LoadImage(nsIURI* aURI,
                      nsIDocument* aLoadingDocument,
                      nsLoadFlags aLoadFlags,
                      nsISupports* aCacheKey,
                      nsContentPolicyType aContentPolicyType,
                      const nsAString& initiatorType,
                      bool aUseUrgentStartForChannel,
                      imgRequestProxy** _retval)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   VerifyCacheSizes();
 
   NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
 
   if (!aURI) {
     return NS_ERROR_NULL_POINTER;
   }
 
@@ -2191,59 +2167,39 @@ imgLoader::LoadImage(nsIURI* aURI,
   if (aLoadingPrincipal) {
     attrs = aLoadingPrincipal->OriginAttributesRef();
   }
   ImageCacheKey key(aURI, attrs, aLoadingDocument, rv);
   NS_ENSURE_SUCCESS(rv, rv);
   imgCacheTable& cache = GetCache(key);
 
   if (cache.Get(key, getter_AddRefs(entry)) && entry) {
-    entry->SetInUse(true);
     if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerURI,
                       aReferrerPolicy, aLoadGroup, aObserver, aLoadingDocument,
                       requestFlags, aContentPolicyType, true, _retval,
                       aLoadingPrincipal, corsmode)) {
       request = entry->GetRequest();
 
       // If this entry has no proxies, its request has no reference to the
       // entry.
       if (entry->HasNoProxies()) {
         LOG_FUNC_WITH_PARAM(gImgLog,
           "imgLoader::LoadImage() adding proxyless entry", "uri", key.Spec());
         MOZ_ASSERT(!request->HasCacheEntry(),
           "Proxyless entry's request has cache entry!");
         request->SetCacheEntry(entry);
 
         if (mCacheTracker) {
-          if (MOZ_UNLIKELY(!entry->GetExpirationState()->IsTracked())) {
-            bool inCache = false;
-            bool cacheHasEntry = false;
-            RefPtr<imgCacheEntry> e;
-            if (cache.Get(key, getter_AddRefs(e)) && e) {
-              cacheHasEntry = true;
-              inCache = (e == entry);
-            }
-            gfxCriticalNoteOnce << "entry with no proxies is no in tracker "
-                                << "request->HasConsumers() "
-                                << (request->HasConsumers() ? "true" : "false")
-                                << " inCache " << (inCache ? "true" : "false")
-                                << " cacheHasEntry " << (cacheHasEntry ? "true" : "false");
-          }
-
           mCacheTracker->MarkUsed(entry);
         }
       }
 
       entry->Touch();
 
-      entry->SetInUse(false);
-
     } else {
-      entry->SetInUse(false);
-
       // We can't use this entry. We'll try to load it off the network, and if
       // successful, overwrite the old entry in the cache with a new one.
       entry = nullptr;
     }
   }
 
   // Keep the channel in this scope, so we can adjust its notificationCallbacks
   // later when we create the proxy.
@@ -2405,18 +2361,16 @@ imgLoader::LoadImageWithChannelXPCOM(nsI
 
 nsresult
 imgLoader::LoadImageWithChannel(nsIChannel* channel,
                                 imgINotificationObserver* aObserver,
                                 nsISupports* aCX,
                                 nsIStreamListener** listener,
                                 imgRequestProxy** _retval)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   NS_ASSERTION(channel,
                "imgLoader::LoadImageWithChannel -- NULL channel pointer");
 
   MOZ_ASSERT(NS_UsePrivateBrowsing(channel) == mRespectPrivacy);
 
   RefPtr<imgRequest> request;
 
   nsCOMPtr<nsIURI> uri;
@@ -2444,18 +2398,16 @@ imgLoader::LoadImageWithChannel(nsIChann
     RemoveFromCache(key);
   } else {
     // Look in the cache for our URI, and then validate it.
     // XXX For now ignore aCacheKey. We will need it in the future
     // for correctly dealing with image load requests that are a result
     // of post data.
     imgCacheTable& cache = GetCache(key);
     if (cache.Get(key, getter_AddRefs(entry)) && entry) {
-      entry->SetInUse(true);
-
       // We don't want to kick off another network load. So we ask
       // ValidateEntry to only do validation without creating a new proxy. If
       // it says that the entry isn't valid any more, we'll only use the entry
       // we're getting if the channel is loading from the cache anyways.
       //
       // XXX -- should this be changed? it's pretty much verbatim from the old
       // code, but seems nonsensical.
       //
@@ -2480,17 +2432,16 @@ imgLoader::LoadImageWithChannel(nsIChann
 
         if (cacheChan) {
           cacheChan->IsFromCache(&bUseCacheCopy);
         } else {
           bUseCacheCopy = false;
         }
 
         if (!bUseCacheCopy) {
-          entry->SetInUse(false);
           entry = nullptr;
         } else {
           request = entry->GetRequest();
         }
       }
 
       if (request && entry) {
         // If this entry has no proxies, its request has no reference to
@@ -2503,19 +2454,16 @@ imgLoader::LoadImageWithChannel(nsIChann
             "Proxyless entry's request has cache entry!");
           request->SetCacheEntry(entry);
 
           if (mCacheTracker) {
             mCacheTracker->MarkUsed(entry);
           }
         }
       }
-      if (entry) {
-        entry->SetInUse(false);
-      }
     }
   }
 
   nsCOMPtr<nsILoadGroup> loadGroup;
   channel->GetLoadGroup(getter_AddRefs(loadGroup));
 
   // Filter out any load flags not from nsIRequest
   requestFlags &= nsIRequest::LOAD_REQUESTMASK;
--- a/image/imgLoader.h
+++ b/image/imgLoader.h
@@ -137,24 +137,16 @@ public:
     return mHasNoProxies;
   }
 
   bool ForcePrincipalCheck() const
   {
     return mForcePrincipalCheck;
   }
 
-  bool GetInUse() const {
-    return mInUse;
-  }
-
-  void SetInUse(bool aInUse) {
-    mInUse = aInUse;
-  }
-
   imgLoader* Loader() const
   {
     return mLoader;
   }
 
 private: // methods
   friend class imgLoader;
   friend class imgCacheQueue;
@@ -179,17 +171,16 @@ private: // data
   int32_t mTouchedTime;
   uint32_t mLoadTime;
   int32_t mExpiryTime;
   nsExpirationState mExpirationState;
   bool mMustValidate : 1;
   bool mEvicted : 1;
   bool mHasNoProxies : 1;
   bool mForcePrincipalCheck : 1;
-  bool mInUse : 1;
 };
 
 #include <vector>
 
 #define NS_IMGLOADER_CID \
 { /* c1354898-e3fe-4602-88a7-c4520c21cb4e */         \
      0xc1354898,                                     \
      0xe3fe,                                         \
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -638,18 +638,16 @@ nsresult imgRequestProxy::Clone(imgINoti
   return PerformClone(aObserver, NewProxy, aClone);
 }
 
 nsresult
 imgRequestProxy::PerformClone(imgINotificationObserver* aObserver,
                               imgRequestProxy* (aAllocFn)(imgRequestProxy*),
                               imgRequestProxy** aClone)
 {
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
   NS_PRECONDITION(aClone, "Null out param");
 
   LOG_SCOPE(gImgLog, "imgRequestProxy::Clone");
 
   *aClone = nullptr;
   RefPtr<imgRequestProxy> clone = aAllocFn(this);
 
   // It is important to call |SetLoadFlags()| before calling |Init()| because