Bug 1501120 - Fix faulty assert when calculating memory footprint of animation. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Tue, 23 Oct 2018 07:59:18 -0400
changeset 443103 1fab862943ad9963334fc04eb55a7539197ec0f4
parent 443102 cf78ed26a33704588aeab6c0ffa250ac449e6a8b
child 443104 b412e9d74e5770ef2531ca603dbc29df93316009
push id109297
push useraosmond@gmail.com
push dateFri, 26 Oct 2018 11:50:53 +0000
treeherdermozilla-inbound@b412e9d74e57 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1501120
milestone65.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 1501120 - Fix faulty assert when calculating memory footprint of animation. r=tnikkel Differential Revision: https://phabricator.services.mozilla.com/D9506
image/AnimationFrameBuffer.cpp
--- a/image/AnimationFrameBuffer.cpp
+++ b/image/AnimationFrameBuffer.cpp
@@ -300,20 +300,23 @@ AnimationFrameDiscardingQueue::AddSizeOf
       aCallback(aMetadata);
     }
   );
 
   size_t i = mGetIndex;
   for (const RefPtr<imgFrame>& frame : mDisplay) {
     ++i;
     if (mSize < i) {
-      // First frame again, we already covered it above.
-      MOZ_ASSERT(mFirstFrame.get() == frame.get());
       i = 1;
-      continue;
+      if (mFirstFrame.get() == frame.get()) {
+        // First frame again, we already covered it above. We can have a
+        // different frame in the first frame position in the discard queue
+        // on subsequent passes of the animation. This is useful for recycling.
+        continue;
+      }
     }
 
     frame->AddSizeOfExcludingThis(aMallocSizeOf,
       [&](AddSizeOfCbData& aMetadata) {
         aMetadata.index = i;
         aCallback(aMetadata);
       }
     );