Bug 1439525 - Remove spurious "continue" statement. r?nical draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 20 Feb 2018 15:37:48 -0500
changeset 757561 9ce647109aa63be152b7a5a429ea4012b2eea80d
parent 757560 ea95e1785adf49a62fb39f0f3a89be5cd7354770
child 757562 aa4575c839099402ac2e1757f906eb861882ba6c
push id99776
push userkgupta@mozilla.com
push dateTue, 20 Feb 2018 20:38:26 +0000
reviewersnical
bugs1439525
milestone60.0a1
Bug 1439525 - Remove spurious "continue" statement. r?nical The "continue" statement makes it look like the loop can run multiple allocations in a row when that never actually happens. (And if it did, the latter half of the loop would do the wrong thing). This patch removes the spurious continue statement and replaces it with a more useful assertion that documents the state at that point. MozReview-Commit-ID: 3rpVZ1imX2y
gfx/layers/wr/IpcResourceUpdateQueue.cpp
--- a/gfx/layers/wr/IpcResourceUpdateQueue.cpp
+++ b/gfx/layers/wr/IpcResourceUpdateQueue.cpp
@@ -60,17 +60,19 @@ ShmSegmentsWriter::Write(Range<uint8_t> 
           MOZ_ASSERT(i > 0);
           RefCountedShmem& shm = mSmallAllocs.ElementAt(i - 1);
           RefCountedShm::Dealloc(mShmAllocator, shm);
           mSmallAllocs.RemoveElementAt(i - 1);
         }
         MOZ_ASSERT(mSmallAllocs.Length() == currAllocLen);
         return layers::OffsetRange(0, start, 0);
       }
-      continue;
+      // Allocation succeeded, so dstCursor should now be pointing to
+      // something inside the allocation buffer
+      MOZ_ASSERT(dstCursor < (mSmallAllocs.Length() * mChunkSize));
     }
 
     const size_t dstMaxOffset = mChunkSize * mSmallAllocs.Length();
     const size_t dstBaseOffset = mChunkSize * (mSmallAllocs.Length() - 1);
 
     MOZ_ASSERT(dstCursor >= dstBaseOffset);
     MOZ_ASSERT(dstCursor <= dstMaxOffset);