Bug 505385 - Part 0: Remove the last vestiges of manual animation reset within imagelib. r=joe
authorBobby Holley <bobbyholley@gmail.com>
Fri, 12 Oct 2012 12:11:20 -0400
changeset 110225 5953ad4a69515f00a58a18baa1a1b416386c1a6f
parent 110224 f6ce9ce830399fca617695de08b10b5e05c284e2
child 110226 d23ba35302e679b6860d0c0f55184cfc9e50773d
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjoe
bugs505385
milestone19.0a1
Bug 505385 - Part 0: Remove the last vestiges of manual animation reset within imagelib. r=joe This stuff should now all be taken care of by the AnimationConsumers infrastructure.
image/src/imgRequest.cpp
image/src/imgRequest.h
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -183,23 +183,16 @@ void imgRequest::AddProxy(imgRequestProx
 
   // If we're empty before adding, we have to tell the loader we now have
   // proxies.
   if (mObservers.IsEmpty()) {
     NS_ABORT_IF_FALSE(mURI, "Trying to SetHasProxies without key uri.");
     mLoader->SetHasProxies(mURI);
   }
 
-  // If we don't have any current observers, we should restart any animation.
-  if (mImage && !HaveProxyWithObserver(proxy) && proxy->HasObserver()) {
-    LOG_MSG(gImgLog, "imgRequest::AddProxy", "resetting animation");
-
-    mImage->ResetAnimation();
-  }
-
   proxy->SetPrincipal(mPrincipal);
 
   mObservers.AppendElementUnlessExists(proxy);
 }
 
 nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus)
 {
   LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::RemoveProxy", "proxy", proxy);
@@ -337,34 +330,16 @@ void imgRequest::RemoveFromCache()
       mLoader->RemoveFromCache(mCacheEntry);
     else
       mLoader->RemoveFromCache(mURI);
   }
 
   mCacheEntry = nullptr;
 }
 
-bool imgRequest::HaveProxyWithObserver(imgRequestProxy* aProxyToIgnore) const
-{
-  nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mObservers);
-  imgRequestProxy* proxy;
-  while (iter.HasMore()) {
-    proxy = iter.GetNext();
-    if (proxy == aProxyToIgnore) {
-      continue;
-    }
-    
-    if (proxy->HasObserver()) {
-      return true;
-    }
-  }
-  
-  return false;
-}
-
 int32_t imgRequest::Priority() const
 {
   int32_t priority = nsISupportsPriority::PRIORITY_NORMAL;
   nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(mRequest);
   if (p)
     p->GetPriority(&priority);
   return priority;
 }
--- a/image/src/imgRequest.h
+++ b/image/src/imgRequest.h
@@ -143,20 +143,16 @@ private:
   // Reset the cache entry after we've dropped our reference to it. Used by the
   // imgLoader when our cache entry is re-requested after we've dropped our
   // reference to it.
   void SetCacheEntry(imgCacheEntry *entry);
 
   // Returns whether we've got a reference to the cache entry.
   bool HasCacheEntry() const;
 
-  // Return true if at least one of our proxies, excluding
-  // aProxyToIgnore, has an observer.  aProxyToIgnore may be null.
-  bool HaveProxyWithObserver(imgRequestProxy* aProxyToIgnore) const;
-
   // Return the priority of the underlying network request, or return
   // PRIORITY_NORMAL if it doesn't support nsISupportsPriority.
   int32_t Priority() const;
 
   // Adjust the priority of the underlying network request by the given delta
   // on behalf of the given proxy.
   void AdjustPriority(imgRequestProxy *aProxy, int32_t aDelta);